Skip to content

Better warning when loading a tokenizer with AutoTokenizer w/o Sneten…#8881

Merged
LysandreJik merged 1 commit intomasterfrom
better-sentencepiece-warning
Dec 1, 2020
Merged

Better warning when loading a tokenizer with AutoTokenizer w/o Sneten…#8881
LysandreJik merged 1 commit intomasterfrom
better-sentencepiece-warning

Conversation

@LysandreJik
Copy link
Copy Markdown
Member

…cePiece

Currently, initializing a sentencepiece AutoTokenizer without having sentencepiece installed results in the following error:

AttributeError: 'NoneType' object has no attribute 'from_pretrained'

This improves the error message to:

 This tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed in order to use this tokenizer.

Fix #8864

Copy link
Copy Markdown
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!

@LysandreJik LysandreJik merged commit a947386 into master Dec 1, 2020
@LysandreJik LysandreJik deleted the better-sentencepiece-warning branch December 1, 2020 18:13
stas00 pushed a commit to stas00/transformers that referenced this pull request Dec 5, 2020
@thomwolf
Copy link
Copy Markdown
Member

thomwolf commented Dec 9, 2020

Thanks!

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.

AttributeError: 'NoneType' object has no attribute 'from_pretrained'

3 participants