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

fix: create a copy for tokenizer object #18408

Merged

Conversation

YBooks
Copy link
Contributor

@YBooks YBooks commented Aug 1, 2022

What does this PR do?

To not have the object in the PreTrainedTokenizerFast and not impact its padding/truncating attribute we can just have a deep copy of the object
Fixes # (18406)

Who can review?

@LysandreJik @sgugger

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 1, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@sgugger sgugger merged commit df5e423 into huggingface:main Aug 1, 2022
@maclandrol
Copy link

maclandrol commented Sep 19, 2022

@YBooks , this PR creates another issue since deepcopy of tokenizer object is not possible when a Custom Pretokenizer is used.

tokenizer.pre_tokenizer = Custom()

See open issue in tokenizers here: huggingface/tokenizers#581

I suggest using another serialization/loading scheme instead of copy.

@sgugger
Copy link
Collaborator

sgugger commented Sep 19, 2022

Would like to open a PR with a fix?

@maclandrol
Copy link

Yes, I will give it a try.

oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
xght pushed a commit to xght/transformers that referenced this pull request Dec 17, 2022
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.

4 participants