noamaanMulla-03/transformers-issues huggingface dataset:
Couldn't reach server GPT-2 
Author: MSMOON
Pull request: no
Labels: name: External

I have tried to use gpt2 using ubuntu and vagrant. This is the code:
`
import torch
from lm_scorer.models.auto import AutoLMScorer as LMScorer
scorer = LMScorer.from_pretrained("gpt2")
`
I get this error: 
> AH01215: OSError: Couldn't reach server at 'https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-config.json' to download pretrained model configuration file.

It has worked before but I had to reset my virtual environment and now it no longer worked. I think it has something to do with apache configurations. 

Also, It works in the terminal but not in python script.

Comments:
I also created this stack overflow question here: https://stackoverflow.com/questions/61944526/oserror-couldnt-reach-server-gpt2-config-json

It is odd that it works from CLI but not from within your script. That does not make a lot of sense. Can you try this?

```python
scorer = LMScorer.from_pretrained("gpt2", force_download=True)
```

Thanks, Bram. I tried that code but I get the same error. I believe it has something to do with 1) apache2 or ubuntu config and what I've allowed it to connect to or 2) some download I am missing because it has worked previously.

I tried downloading the gpt2 config, model.bin, and vocab file but I would either get the same error as above or get this error:

> ValueError: Unrecognized model name.Can be one of: gpt2, gpt2-medium, gpt2-large, gpt2-xl, distilgpt2:

If you are sure that you have manually downloaded all files to the correct folder, you can disable the online look-up. This is useful if you have, as you say, network restrictions.

```python
scorer = LMScorer.from_pretrained("gpt2", local_files_only=True)
```

Still nothing yet. 
1. I downloaded everything from https://huggingface.co/gpt2#list-files
2. Added files to the same directory the script is in
3. changed names (e.g. gpt2-config.json to config.json)

Is there anything I am missing?



This is likely to be a problem with the LMScorer rather than with this transformers library. Looking t the source code, it does not pass they keyword arguments down to model init. I suggest that you make an issue over at the library that you used.

https://github.com/simonepri/lm-scorer/blob/master/lm_scorer/models/gpt2.py

Still nothing. I believe it is my apache2 configurations for access but I haven't figure out how yet. 

Closing this. See continuation here: https://github.com/simonepri/lm-scorer/issues/8#event-3386811426
Fix two bugs on MNLI dataset and SST-2 respectively.
Author: stdcoutzyx
Pull request: yes

The text index of test data of SST-2 are 1 rather than 0.

The label of MNLI task has a tricky swap on MNLI dataset, which should also be involved in get_labels() of dataset for correctness. 

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=h1) Report
> Merging [#4546](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/a34a9896ac2a4a33ff9cd805c76eed914c8d8965&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `42.85%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/4546/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #4546      +/-   ##
==========================================
- Coverage   77.87%   77.85%   -0.02%     
==========================================
  Files         123      123              
  Lines       20566    20568       +2     
==========================================
- Hits        16016    16014       -2     
- Misses       4550     4554       +4     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/data/processors/glue.py](https://codecov.io/gh/huggingface/transformers/pull/4546/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL3Byb2Nlc3NvcnMvZ2x1ZS5weQ==) | `49.44% <0.00%> (-0.19%)` | :arrow_down: |
| [src/transformers/data/datasets/glue.py](https://codecov.io/gh/huggingface/transformers/pull/4546/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9kYXRhL2RhdGFzZXRzL2dsdWUucHk=) | `86.36% <60.00%> (+0.20%)` | :arrow_up: |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4546/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `73.44% <0.00%> (-0.42%)` | :arrow_down: |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4546/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `88.50% <0.00%> (-0.17%)` | :arrow_down: |
| [src/transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4546/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ191dGlscy5weQ==) | `90.41% <0.00%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=footer). Last update [a34a989...6e60ed9](https://codecov.io/gh/huggingface/transformers/pull/4546?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


LGTM
Tokenization_utils doesn't work with Pytorch-Lightning on 2.10.0 version
Author: sirily
Pull request: no

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): Bert with pytorch-lightning

Language I am using the model on (English, Chinese ...): English

The problem arises when using
*  my own modified scripts: Pytorch Dataset with tokenizer inside

The tasks I am working on is:
* my own task or dataset

## To reproduce

Take a look at [this colab link](https://colab.research.google.com/drive/1SH1xRzhNwgnSn382OLCoMFi_-8CCqk5y?usp=sharing). 

I've copied the method from pytorch-lightning which shows an error on 2.10.0 transformers when process a batch. Doing the same with transformers 2.8.0 cause no error.

```
/usr/local/lib/python3.6/dist-packages/transformers/tokenization_utils.py in __getattr__(self, item)
    201 
    202     def __getattr__(self, item: str):
--> 203         return self.data[item]
    204 
    205     def keys(self):

KeyError: 'cuda'
```

## Expected behavior

No error
     
- `transformers` version: 2.10.0
- Platform: Linux
- Python version: 3.6.9
- PyTorch version (GPU?): 1.5.0+cu101
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

Comments:
If you are using `pytorch-lightning`  then you won't need to transfer data on GPU or TPU manually. `lightning` takes care of that for you

I have copied the method, which transfer data from pytorch-lightning, so you can reproduce the error.

Okay, sorry I misunderstood the question.

It is my bad English, I guess. Do you need more explanation, or the question is clear now?

The reason is in latest version  `batch_encode_plus` returns an instance of `BatchEncoding` and in 2.8.0 it return a `dict`. So you can just do it like this
in your collate function
```
return dict(tokens), torch.tensor(labels, dtype=torch.long)
```

I think tokenizer should handle it itself, so tagging @mfuntowicz 

BatchEncoding is indeed a UserDict, if you want to access the actual dict, you can use the data attribute:

```python
be = tokenizer.batch_encode_plus(...)
be.data
```

Thank you! So it's not a bug, but an expected behaviour
run_tf_ner.py TFTrainer logdir cannot be none
Author: jx669
Pull request: no

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): bert 

Language I am using the model on (English, Chinese ...): bert-base-multilingual-cased

The problem arises when using:
* [x] the official example scripts: (give details below)
run_tf_ner.py

* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [x] an official GLUE/SQUaD task: (give the name)
germeval2014ner
* [ ] my own task or dataset: (give details below)

## To reproduce
run_tf_ner.py (original)
run.sh (see below)

Steps to reproduce the behavior:

1. 
run.sh

```
export MAX_LENGTH=128
export BERT_MODEL=bert-base-multilingual-cased
export OUTPUT_DIR=germeval-model
export BATCH_SIZE=32
export NUM_EPOCHS=1
export SAVE_STEPS=750
export SEED=1
export data_dir=data

python run_tf_ner.py --data_dir ./data/ \
--labels ./data/labels.txt \
--model_name_or_path $BERT_MODEL \
--output_dir $OUTPUT_DIR \
--max_seq_length  $MAX_LENGTH \
--num_train_epochs $NUM_EPOCHS \
--per_gpu_train_batch_size $BATCH_SIZE \
--save_steps $SAVE_STEPS \
--seed $SEED \
--do_train \
--do_eval \
--do_predict
```

2. error message
```
Traceback (most recent call last):
  File "run_tf_ner.py", line 295, in <module>
    main()
  File "run_tf_ner.py", line 220, in main
    compute_metrics=compute_metrics,
  File "/usr/local/lib/python3.6/dist-packages/transformers/trainer_tf.py", line 48, in __init__
    self._setup_training()
  File "/usr/local/lib/python3.6/dist-packages/transformers/trainer_tf.py", line 65, in _setup_training
    self._create_summary_writer()
  File "/usr/local/lib/python3.6/dist-packages/transformers/trainer_tf.py", line 88, in _create_summary_writer
    self.writer = tf.summary.create_file_writer(self.args.logging_dir)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/summary_ops_v2.py", line 377, in create_file_writer_v2
    raise ValueError("logdir cannot be None")
ValueError: logdir cannot be None
```

## Expected behavior
I did not change the code or the data. I was trying to reproduce exactly the German NER tf2.0 example: [https://github.com/huggingface/transformers/tree/master/examples/token-classification](url)
<!-- A clear and concise description of what you would expect to happen. -->

## Environment info
google colab gpu
<!-- 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:
- Platform:
- Python version:
- PyTorch version (GPU?):
- Tensorflow version (GPU?): tensorflow gpu 2.2.0
- Using GPU in script?:yes
- Using distributed or parallel set-up in script?: no


Comments:
Hello,

This is because you have to specify `--logging_dir /path/to/logs` as parameter. There will be a default location for the next release of the TF Trainer.

Right. I later passed a parameter in run_tf_ner.py and it worked. I felt somewhere in the Trainer or run_tf_ner.py, it needs to be indicated. 

Thanks for your prompt response!
Fix longformer attention mask type casting when using apex
Author: wfangtw
Pull request: yes

Fix for issue [#4525](https://github.com/huggingface/transformers/issues/4525). 

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=h1) Report
> Merging [#4574](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/b86e42e0ac1b59f21f0eccf351d3346bbe3ed4eb&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/4574/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #4574      +/-   ##
==========================================
- Coverage   78.09%   78.08%   -0.01%     
==========================================
  Files         123      123              
  Lines       20624    20624              
==========================================
- Hits        16106    16105       -1     
- Misses       4518     4519       +1     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_longformer.py](https://codecov.io/gh/huggingface/transformers/pull/4574/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19sb25nZm9ybWVyLnB5) | `97.40% <100.00%> (ø)` | |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4574/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `73.44% <0.00%> (-0.42%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=footer). Last update [b86e42e...8528090](https://codecov.io/gh/huggingface/transformers/pull/4574?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
Coversion between tokenizers
Author: imbalu007
Pull request: no
Labels: name: Core: Tokenization

I want to convert GPT2 tokens to BERT tokens. Is there any API that can directly convert between the Tokenizers?

Comments:
GPT-2 and BERT have very different tokenization mechanism. What do you mean by "convert between the tokenizers"? What do you want to do?

I want to use Bert as encoder and GPT2 as decoder. Then I want to evaluate the generated text with another Bert as discriminator (like the technique [here](https://arxiv.org/pdf/1703.00955.pdf)). I want the decoder to generate text just based on the context vector (refer to the above link). So I don't think I can use EncoderDecoderModel (am I right?)
Add nn.Module as superclass
Author: shoarora
Pull request: yes

Add nn.Module as superclass of `MMBTModel` to fix #4532 

Comments:
Are there upstream issues?  I can't see how my one-liner is breaking these tests

# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=h1) Report
> Merging [#4533](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/e19b978151419fe0756ba852b145fccfc96dbeb4&el=desc) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/4533/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #4533   +/-   ##
=======================================
  Coverage   77.86%   77.87%           
=======================================
  Files         123      123           
  Lines       20566    20566           
=======================================
+ Hits        16014    16015    +1     
+ Misses       4552     4551    -1     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_mmbt.py](https://codecov.io/gh/huggingface/transformers/pull/4533/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19tbWJ0LnB5) | `22.11% <100.00%> (ø)` | |
| [src/transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4533/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190Zl91dGlscy5weQ==) | `88.66% <0.00%> (ø)` | |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4533/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `73.85% <0.00%> (+0.41%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=footer). Last update [e19b978...42d544b](https://codecov.io/gh/huggingface/transformers/pull/4533?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Re-ran the tests and they pass, this was a transient (connectivity?) error.

This PR looks reasonable to me. I'll just cc @suvrat96 for information
No crossattention layers in decoder from pretrained encoder-decoder model
Author: hammad001
Pull request: no

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): BERT

Language I am using the model on (English, Chinese ...): English

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

Custom sequence to sequence task.

## To reproduce

Steps to reproduce the behavior:

1. Run the following script:
```
from transformers import EncoderDecoderModel
model = EncoderDecoderModel.from_encoder_decoder_pretrained('bert-base-uncased', 'bert-base-uncased') 
print(model.get_decoder())
```
2. You will find there's no crossattention layers in the decoder.

## Expected behavior

Cross attention layers initialized (not weights, but the layers themselves) in the decoder.

## Environment info
     
- `transformers` version: 2.9.0
- Platform: Linux-5.5.6-1.el7.x86_64-x86_64-with-debian-buster-sid
- Python version: 3.7.4
- PyTorch version (GPU?): 1.3.0 (True)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: NO
- Using distributed or parallel set-up in script?:NO



Comments:
A simple fix could be:

1. Adding in file [modeling_encoder_decoder.py](https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_encoder_decoder.py) @ line 140:

```
kwargs_decoder["is_decoder"]=True
```

2. Adding in file [modeling_auto.py](https://github.com/huggingface/transformers/blob/61d22f9cc7fbb0556d1e14447957a7ac6441421b/src/transformers/modeling_auto.py#L570) @ line 570

```
if not isinstance(config, PretrainedConfig):
    config = AutoConfig.from_pretrained(pretrained_model_name_or_path, **kwargs)
    if kwargs.pop("is_decoder", None):
        config.is_decoder=True
```

That's is it! It should be good to go. The crossattention layers will be initialized; although it's weights will not be initialized. That will have to be trained.
                    



Hi @hammad001 - thanks a lot for finding this bug. It has helped me a lot. This PR: https://github.com/huggingface/transformers/pull/4680 should fix it :-)
add longformer docs
Author: flozi00
Pull request: yes


Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=h1) Report
> Merging [#4646](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/e444648a302dc8520beec96356a4bf500944355c&el=desc) will **decrease** coverage by `1.57%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/4646/graphs/tree.svg?width=650&height=150&src=pr&token=9qOlN6Hb1c)](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #4646      +/-   ##
==========================================
- Coverage   77.42%   75.85%   -1.58%     
==========================================
  Files         128      128              
  Lines       21017    21017              
==========================================
- Hits        16273    15942     -331     
- Misses       4744     5075     +331     
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/transformers/modeling\_longformer.py](https://codecov.io/gh/huggingface/transformers/pull/4646/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19sb25nZm9ybWVyLnB5) | `18.51% <0.00%> (-78.31%)` | :arrow_down: |
| [src/transformers/configuration\_longformer.py](https://codecov.io/gh/huggingface/transformers/pull/4646/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9jb25maWd1cmF0aW9uX2xvbmdmb3JtZXIucHk=) | `76.92% <0.00%> (-23.08%)` | :arrow_down: |
| [src/transformers/modeling\_t5.py](https://codecov.io/gh/huggingface/transformers/pull/4646/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ190NS5weQ==) | `77.18% <0.00%> (-6.35%)` | :arrow_down: |
| [src/transformers/modeling\_bert.py](https://codecov.io/gh/huggingface/transformers/pull/4646/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9tb2RlbGluZ19iZXJ0LnB5) | `86.77% <0.00%> (-0.19%)` | :arrow_down: |
| [src/transformers/file\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/4646/diff?src=pr&el=tree#diff-c3JjL3RyYW5zZm9ybWVycy9maWxlX3V0aWxzLnB5) | `73.85% <0.00%> (+0.41%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=footer). Last update [e444648...200b97a](https://codecov.io/gh/huggingface/transformers/pull/4646?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Docs were provided in another PR - closing.
Error when loading a trained Encoder-Decoder model. 
Author: Xunzhuo
Pull request: no

# 🐛 Bug Report
When loading the config the in configuration_auto.py the model_type is expected on the form encoder-decoder 
but in configuration_encoder_decoder.py 
model_type is on the form encoder_decoder which raises a KeyError.

Comments:
Hi @Xunzhuo,
Multiple bugs were fixed in #4680 . Can you please take a look whether this error persists?

okay tks!
Cannnot Import from transformers
Author: saurabh896
Pull request: no
Labels: name: wontfix

name: Installation

# 🐛 Bug

## Information
I am trying to import  TFGPT2LMHeadModel in transformers.Python giving below error.
cannot import name 'TFGPT2LMHeadModel' from 'transformers
## To reproduce
import tensorflow as tf
from transformers import TFGPT2LMHeadModel,GPT2Tokenizer

tokenizer = GPT2Tokenizer.from_pretrained("gpt2")

# add the EOS token as PAD token to avoid warnings
model = TFGPT2LMHeadModel.from_pretrained("gpt2", pad_token_id=tokenizer.eos_token_id)

# encode context the generation is conditioned on
input_ids = tokenizer.encode('I enjoy walking with my cute dog', return_tensors='tf')

# generate text until the output length (which includes the context length) reaches 50
greedy_output = model.generate(input_ids, max_length=50)

print("Output:\n" + 100 * '-')
print(tokenizer.decode(greedy_output[0], skip_special_tokens=True))

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

## Environment info
<!-- You can run the command `python transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version:
- Platform:
- Python version:
- PyTorch version (GPU?):
- Tensorflow version (GPU?):
- Using GPU in script?:
- Using distributed or parallel set-up in script?:


Comments:
In order to import the tensorflow models, you need to have TF2+ installed. Please update your environment info if you *do* have TF2 installed in the environment in which you're running your script.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.