More informative panic message when you try to train on data that is too short - #566
Open
sandbergja wants to merge 1 commit into
Open
More informative panic message when you try to train on data that is too short#566sandbergja wants to merge 1 commit into
sandbergja wants to merge 1 commit into
Conversation
…too short Before this commit, if your data contained a line with, say, only 4 characters, when you run `create_and_write_language_model_files`, it will fail with a somewhat mysterious message: ``` attempt to subtract with overflow ``` This is because the trainer is attempting to extract a five-gram, but you can't make a five-gram with only 4 characters! This commit provides a somewhat more useful panic message: ``` input text must be at least 5 chars ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks so much for this cool project!
While experimenting with it locally, I attempted to create a new language model with
create_and_write_language_model_files, and got a panic with the somewhat mysterious message:It was because my input file had a line with only 4 characters, but the model creation was trying to extract a five-gram.
In case it is useful, here is a PR to provide a (for me, at least) more useful panic message -- please feel free to close this pr if it is not helpful!