error AttributeError: 'tuple' object has no attribute 'logits'
See original GitHub issueEnvironment info
AttributeError Traceback (most recent call last) <ipython-input-4-594fed3b7299> in <module>() 6 input = tokenizer.encode(sequence, return_tensors=“pt”) 7 mask_token_index = torch.where(input == tokenizer.mask_token_id)[1] ----> 8 token_logits = model(input).logits 9 mask_token_logits = token_logits[0, mask_token_index, :] 10 top_5_tokens = torch.topk(mask_token_logits, 5, dim=1).indices[0].tolist()
AttributeError: ‘tuple’ object has no attribute ‘logits’
transformersversion: Successfully installed sacremoses-0.0.43 sentencepiece-0.1.91 tokenizers-0.8.1rc2 transformers-3.3.1- Platform: Masked Language Modeling - Colab PyTorch
- Python version: Python 3.6.9
- PyTorch version (GPU?):
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:
Who can help
Information
Model I am using (Bert, XLNet …):
The problem arises when using:
- [V ] 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:
- Summary of the tasks Open Colab Pytorch
- Masked Language Modeling example
Expected behavior
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
The question-answering example in the doc throws an ...
Admittedly I am a beginner to HuggingFace, though I do have some ... AttributeError: 'tuple' object has no attribute 'start_logits'```.
Read more >AttributeError: 'tuple' object has no attribute 'log_softmax'
This is a well known problem. Try one the following solutions: disable aux_logits when the model is created here by also passing ...
Read more >Python AttributeError: 'tuple' object has no attribute
AttributeError: 'tuple' object has no attribute. Learn Data Science with. This error occurs when attempting to access the values of a tuple incorrectly....
Read more >If input.dim() == 2 and bias is not None: AttributeError: 'tuple ...
If input.dim() == 2 and bias is not None: AttributeError: 'tuple' object has no attribute 'dim.
Read more >AttributeError: 'tuple' object has no attribute in Python
The Python "AttributeError: 'tuple' object has no attribute" occurs when we access an attribute that doesn't exist on a tuple. To solve the ......
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
Can you replace:
by
and see if the error persists?
I fixed this problem by update transfromers from 3.0.2 to 4.23.1(the latest version in 2022.10.16)