This repository was archived by the owner on Jan 15, 2024. It is now read-only.
[BUGFIX] Fix handling of duplicate special tokens in Vocabulary#749
Merged
eric-haibin-lin merged 2 commits intodmlc:masterfrom Jun 4, 2019
Merged
Conversation
Example use case in scripts/tests/test_dataprocessor.py where eos_token ==
padding_token. Prior to this fix, eos_token == padding_token lead to a corrupted
vocabulary index.
Example of the corrupted index:
> v = nlp.Vocab(...)
> v.idx_to_token
['<unk>', '<eos>', '<eos>', 'c', 'b', 'a']
> v.token_to_idx
{'<unk>': 0, '<eos>': 2, 'c': 3, 'b': 4, 'a': 5}
Codecov Report
@@ Coverage Diff @@
## master #749 +/- ##
==========================================
- Coverage 90.5% 90.48% -0.02%
==========================================
Files 65 65
Lines 6076 6077 +1
==========================================
Hits 5499 5499
- Misses 577 578 +1
|
leezu
added a commit
to leezu/gluon-nlp
that referenced
this pull request
Jun 3, 2019
This adds backwards compatiblity for deserializing some vocabularies serialized before dmlc#749
leezu
added a commit
to leezu/gluon-nlp
that referenced
this pull request
Jun 3, 2019
This adds backwards compatiblity for deserializing some vocabularies serialized before dmlc#749
Member
|
Job PR-749/1 is complete. |
leezu
added a commit
to leezu/gluon-nlp
that referenced
this pull request
Jun 3, 2019
This adds backwards compatiblity for deserializing some vocabularies serialized before dmlc#749
szha
reviewed
Jun 3, 2019
Member
szha
left a comment
There was a problem hiding this comment.
How does it affect deserialization of existing vocab (e.g. concern of index mismatch in token embedding)?
szha
approved these changes
Jun 3, 2019
Member
szha
left a comment
There was a problem hiding this comment.
In case this would cause index mismatch for any token embedding, we should also find a way to alert user.
Contributor
Author
leezu
added a commit
to leezu/gluon-nlp
that referenced
this pull request
Jun 3, 2019
This adds backwards compatiblity for deserializing some vocabularies serialized before dmlc#749
eric-haibin-lin
approved these changes
Jun 4, 2019
leezu
added a commit
to leezu/gluon-nlp
that referenced
this pull request
Jun 4, 2019
This adds backwards compatiblity for deserializing some vocabularies serialized before dmlc#749
leezu
added a commit
to leezu/gluon-nlp
that referenced
this pull request
Jun 6, 2019
This adds backwards compatiblity for deserializing some vocabularies serialized before dmlc#749
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Example use case in scripts/tests/test_dataprocessor.py where
eos_token == padding_token. Prior to this fix,eos_token == padding_tokenlead to acorrupted vocabulary index.
Example of the corrupted index:
Checklist
Essentials
Changes
Comments
vocabularies will be restored exactly as serialized.
[FEATURE] Flexible vocabulary #732 and resulting execution of sanity
checks during deserialization would prevent deserialization of vocabularies
with a corrupt index. I added some backwards compatibility code for loading the corrupted serialized files in [FEATURE] Flexible vocabulary #732