Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ConvertSlow] make sure the order is preserved for addedtokens #31902

Merged
merged 6 commits into from
Jul 11, 2024

Conversation

ArthurZucker
Copy link
Collaborator

@ArthurZucker ArthurZucker commented Jul 11, 2024

What does this PR do?

@zucchini-nlp caught a nice bug: the order of the user defined tokens and control tokens was not preserved

@ArthurZucker ArthurZucker marked this pull request as ready for review July 11, 2024 06:51
@ArthurZucker ArthurZucker requested a review from itazap July 11, 2024 06:51
@zucchini-nlp zucchini-nlp mentioned this pull request Jul 11, 2024
4 tasks
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

]
}

tokenizer.add_tokens([k for _, k in sorted(all_added_tokens.items(), key=lambda x: x[0])])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast fix! Is the sorting here necessary or is it already sorted from enumerate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure that the dict is an ordered dict by default for all python version! just for safety!

@ArthurZucker
Copy link
Collaborator Author

image tests are failing because this is the sentencepiece.model that was uploaded

@ArthurZucker ArthurZucker merged commit f67e0f7 into main Jul 11, 2024
22 checks passed
@ArthurZucker ArthurZucker deleted the fix-convert-slow branch July 11, 2024 09:56
ArthurZucker added a commit that referenced this pull request Jul 11, 2024
)

* preserve the order

* oups

* oups

* nit

* trick

* fix issues
ArthurZucker added a commit that referenced this pull request Jul 11, 2024
)

* preserve the order

* oups

* oups

* nit

* trick

* fix issues
amyeroberts pushed a commit to amyeroberts/transformers that referenced this pull request Jul 19, 2024
…gingface#31902)

* preserve the order

* oups

* oups

* nit

* trick

* fix issues
MHRDYN7 pushed a commit to MHRDYN7/transformers that referenced this pull request Jul 23, 2024
…gingface#31902)

* preserve the order

* oups

* oups

* nit

* trick

* fix issues
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Jul 24, 2024
…gingface#31902)

* preserve the order

* oups

* oups

* nit

* trick

* fix issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants