Add Bert Word Piece Tokenizer - #7141
Merged
Merged
Conversation
Requires a Vocab File like the one from the published Bert models (e.g. vocab.txt in https://storage.googleapis.com/bert_models/2018_11_23/multi_cased_L-12_H-768_A-12.zip)
AlexDBlack
suggested changes
Feb 11, 2019
AlexDBlack
left a comment
Contributor
There was a problem hiding this comment.
Overall good, as expected. NavigableMap use here is cool :)
Some minor nitpicks here and there.
Only issue of note I can see here: some of the BERT models are lower case only... We should probably have that configurable somewhere, with an appropriate toLowerCase() call in the tokenizer when enabled?
* Update Copyright header * Use @slf4j * Share split pattern between Stream and non-stream versions * Share vocab search between Stream and non-stream versions * Continue search only in the sub tree that will have the result * Allow lowerCase only vocab configuration * Make BertWordPieceTokenzier safer to use with threads * Allow passing an input stream in addition to a file to BertWordPieceTokenizerFactory * Add documentation on the expected file format for vocab files
Member
Author
|
@AlexDBlack I've implemented the requested changes, fixed some more bugs I've found along the way, |
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.
Requires a Vocab File like the one from the published Bert models
(e.g. vocab.txt in https://storage.googleapis.com/bert_models/2018_11_23/multi_cased_L-12_H-768_A-12.zip)
Tests require https://github.com/deeplearning4j/dl4j-test-resources/pull/185