error AttributeError: 'tuple' object has no attribute 'logits'
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

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'     

- `transformers` version:
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
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.
 
 albert, bert, GPT2, XLM: @LysandreJik 
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Speed and Memory Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 Translation: @sshleifer
 Summarization: @sshleifer
 TextGeneration: @TevenLeScao 
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @TevenLeScao
 blenderbot: @mariamabarham
 Bart: @sshleifer
 Marian: @sshleifer
 T5: @patrickvonplaten
 Longformer/Reformer: @patrickvonplaten
 TransfoXL/XLNet: @TevenLeScao 
 examples/seq2seq: @sshleifer
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 -->

## 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:

1. Summary of the tasks Open Colab Pytorch
2. Masked Language Modeling example
3.

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

Can you replace:

```python
token_logits = model(input).logits
```
by

```python
token_logits = model(input, return_dict=True).logits
```

and see if the error persists? <|||||>Can you give a link to the example, so that we can fix the code snippet? <|||||>Hi Patrick,

The suggested change fixed the problem.

Thank you.
Tzur


On Wed, 7 Oct 2020 at 18:34, Patrick von Platen <notifications@github.com>
wrote:

> Can you give a link to the example, so that we can fix the code snippet?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/transformers/issues/7638#issuecomment-705087242>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEVYDXL4DBQIJO4MPX3QZS3SJSRBXANCNFSM4SHNAGUQ>
> .
>


-- 
Email: tzurvaich@gmail.com
Home: +44 (0) 1480 839198
Mobile: +44 (0) 7825 363873
Israel: +972 (0) 3 7201013
Address:
23 Old Pinewood Way,
Papworth Everard
Cambridge CB23 3GT
UK
<|||||>@patrickvonplaten The same issue is on this page https://huggingface.co/transformers/training.html

In these 2 lines 
`outputs = model(input_ids, attention_mask=attention_mask, labels=labels)`

`outputs = model(input_ids, attention_mask=attention_mask)`

Thanks for the help!!
<|||||>I fixed this problem by update transfromers from 3.0.2 to 4.23.1(the latest version in 2022.10.16)