cannot import name AddedToken
See original GitHub issue🐛 Bug
Information
Model I am using (Bert, XLNet …): Albert
Language I am using the model on (English, Chinese …): English
27 from typing import List, Optional, Sequence, Tuple, Union
28
—> 29 from tokenizers import AddedToken, Encoding 30 from tokenizers.decoders import Decoder 31 from tokenizers.implementations import BaseTokenizer
ImportError: cannot import name ‘AddedToken’
The problem arises when using:
- the official example scripts: (give details below)
- my own modified scripts: (give details below)
The tasks I am working on is:
- an official GLUE/SQUaD task: (give the name):
- my own task or dataset: (give details below)
To reproduce
Steps to reproduce the behavior:
Expected behavior
Environment info
transformers
version:- Platform:
- Python version:
- PyTorch version (GPU?):
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
ImportError caused by file with the same name in working dir ...
I think I've understood what causes the issue - it is shadowing file with the same name in package transformer (that internally import ......
Read more >Source code for transformers.tokenization_utils_base
class AddedToken(UserString): # """ AddedToken represents a token to be added to a Tokenizer # An AddedToken can have special options defining the...
Read more >Hugging Face on Twitter: "@DiogoCortiz Sorry about that. Is ...
Today I am getting the error "cannot import name 'BertWordPieceTokenizer'" when I do "from tokenizers import BertWordPieceTokenizer".
Read more >tokenizers - PyPI
Train new vocabularies and tokenize using 4 pre-made tokenizers (Bert WordPiece and the 3 most common BPE versions). Extremely fast (both training and ......
Read more >Source code for paddlenlp.transformers.tokenizer_utils
We can't do it directly within the loop because of how # python iteration works ... whose name ends with `_token`) as attributes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you need install transformers this way:
Created another environment from scratch and it got resolved.