Official example not working, are you serious?
See original GitHub issueEnvironment info
transformers
version: 4.10.0- Platform: Ubuntu 18.04
- Python version:
- PyTorch version (GPU?): 1.9 GPU
- Tensorflow version (GPU?): 2.4.0 GPU
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?:
Who can help
Information
Model I am using Bert, official code not working 😦
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
model = BertModel.from_pretrained("bert-base-cased")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
https://huggingface.co/bert-base-cased to above code.
https://huggingface.co/bert-base-cased
Exception:
Traceback (most recent call last):
File "/home/zhangguanqun/venv_tf_2.4/lib/python3.6/site-packages/transformers/tokenization_utils_base.py", line 248, in __getattr__
return self.data[item]
KeyError: 'size'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zhangguanqun/projects/huggingface/bert.py", line 15, in <module>
output = model(encoded_input)
File "/home/zhangguanqun/venv_tf_2.4/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/zhangguanqun/venv_tf_2.4/lib/python3.6/site-packages/transformers/models/bert/modeling_bert.py", line 938, in forward
input_shape = input_ids.size()
File "/home/zhangguanqun/venv_tf_2.4/lib/python3.6/site-packages/transformers/tokenization_utils_base.py", line 250, in __getattr__
raise AttributeError
AttributeError
Process finished with exit code 1
What’s wrong with that?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Workers' Right to Refuse Dangerous Work
You refused to work in "good faith." This means that you must genuinely believe that an imminent danger exists; and; A reasonable person...
Read more >Harassment - FAQs | U.S. Equal Employment Opportunity ...
One instance of harassing conduct is generally not sufficient, unless the conduct is very serious, such as a physical assault. If you believe...
Read more >Fact Sheet #28P: Taking Leave from Work When You or Your ...
This fact sheet explains when a mental or physical illness, injury, or other condition meets the FMLA's requirements as a serious health condition....
Read more >Sick Leave to Care for a Family Member with a Serious Health ...
The common cold, influenza, earaches, upset stomach, headaches (other than migraines), routine dental or orthodontia problems, etc., are not serious health ...
Read more >How We Decide If You Are Disabled (Step 4 and Step 5)
Remember that you are not disabled according to our rules unless your illnesses, injuries or conditions prevent you from doing your past work...
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 Free
Top 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
a lot more serious now indeed!
Similar issue on examples https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased-xglue-ntg: @thomwolf @patrickvonplaten