Official example not working, are you serious?
## 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! -->

- `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
<!-- 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.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @Rocketknight1

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

Model hub:

- for issues with a model report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

## Information

@LysandreJik

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](url) 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?
I think it's because you try to pass the tensorflow output from tokenizer to an pytorch model.
Either use tfbertmodel or let the tokenizer return "pt" instead of "tf" tensors<|||||>@flozi00 You are right, if I change BertModel to TFBertModel, everything goes well.
BUT, the above codes come from [OFFICIAL TUTORIAL](https://huggingface.co/bert-base-cased),
PLEASE modify the doc to stop misleading others.<|||||>I think both official examples are wrong. The quote is from the [official link](https://huggingface.co/bert-base-cased):

Here is how to use this model to get the features of a given text in PyTorch:

```python
from transformers import BertTokenizer, TFBertModel       # <--- should be just BertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
model = TFBertModel.from_pretrained("bert-base-cased")    # <--- should be just BertModel
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')  
output = model(**encoded_input)
```
and in TensorFlow:

```python
from transformers import BertTokenizer, BertModel       # <--- should be  with TFBertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
model = BertModel.from_pretrained("bert-base-cased")    # <--- should be  with TFBertModel
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```<|||||>Just corrected it :-)<|||||>a lot more serious now indeed!<|||||>Such is the onus on HF to deliver correctly that one mistake can some question the seriousness of the whole enterprise :D<|||||>Similar issue on examples https://huggingface.co/microsoft/xprophetnet-large-wiki100-cased-xglue-ntg:
@thomwolf @patrickvonplaten 
```python
from transformers import XLMProphetNetTokenizer, XLMProphetNetForConditionalGeneration, ProphetNetConfig

# should be just XLMProphetNetForConditionalGeneration & XLMProphetNetTokenizer
model = ProphetNetForConditionalGeneration.from_pretrained('microsoft/xprophetnet-large-wiki100-cased-xglue-ntg')
tokenizer = ProphetNetTokenizer.from_pretrained('microsoft/xprophetnet-large-wiki100-cased-xglue-ntg')
...
```<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.