NameError: name 'DUMMY_INPUTS' is not defined
Author: techwithshadab
Pull request: no
Labels: name: wontfix

## ❓ Can someone help me with resolving this error?
<!-- A clear and concise description of the question. -->
![image](https://user-images.githubusercontent.com/10863620/68379756-7771c400-0174-11ea-8d8d-7b72159c555f.png)


Comments:
> ##  Can someone help me with resolving this error?
> ![image](https://user-images.githubusercontent.com/10863620/68379756-7771c400-0174-11ea-8d8d-7b72159c555f.png)

Without any other information, it's very difficult to understand which is the problem with your Jupyter Notebook! **Which is the content of your directory?** Moreover, **provide the steps to reproduce this bug!**
Please, link your Jupyter Notebook and **provide more information** (e.g. OS, PyTorch version, TensorFlow version, Transformers version, etc.)

@TheEdoardo93 Below are the package version details which I'm using on Windows 10 64 bit machine:
jupyter                            1.0.0 
tensorflow                         2.0.0
torch                              1.3.0+cpu           
torchvision                        0.4.1+cpu
transformers                       2.1.1

I have trained the model on colab GPU version, now was trying to load the pre-trained model on my local machine.
Link of the notebook: https://colab.research.google.com/drive/1URz5MkjZwH621zGG_89S2KahCCBK0Se8
It's working fine on colab, but when I'm trying to resume on my local machine from loading the trained model, I'm getting this error.
Let me know if any more info needed.

Same problem here, using transformers in Tensorflow 2.0.0b0. Training is ok:

```
import tensorflow as tf
import tensorflow_datasets
from transformers import *

tf.compat.v1.enable_eager_execution()

tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
model = TFBertForSequenceClassification.from_pretrained('bert-base-cased')
data = tensorflow_datasets.load('glue/mrpc')

train_dataset = glue_convert_examples_to_features(data['train'], tokenizer, max_length=128, task='mrpc')
valid_dataset = glue_convert_examples_to_features(data['validation'], tokenizer, max_length=128, task='mrpc')
train_dataset = train_dataset.shuffle(100).batch(32).repeat(2)
valid_dataset = valid_dataset.batch(64)

optimizer = tf.keras.optimizers.Adam(learning_rate=3e-5, epsilon=1e-08, clipnorm=1.0)
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
metric = tf.keras.metrics.SparseCategoricalAccuracy('accuracy')
model.compile(optimizer=optimizer, loss=loss, metrics=[metric])

history = model.fit(train_dataset, epochs=2, steps_per_epoch=115,
                    validation_data=valid_dataset, validation_steps=7)

model.save_pretrained('/home/rubens_gmail_com/tf')

Train for 115 steps, validate for 7 steps
Epoch 1/2
115/115 [==============================] - 57s 494ms/step - loss: 0.5496 - accuracy: 0.7331 - val_loss: 0.4226 - val_accuracy: 0.8235
Epoch 2/2
115/115 [==============================] - 34s 291ms/step - loss: 0.2939 - accuracy: 0.8817 - val_loss: 0.4039 - val_accuracy: 0.8456
````
But this line of code give the following error:

```
pytorch_model = BertForSequenceClassification.from_pretrained('/home/rubens_gmail_com/tf', from_tf=True,num_labels = 8)

NameError                                 Traceback (most recent call last)
<ipython-input-19-ebb1b098c156> in <module>
----> 1 pytorch_model = BertForSequenceClassification.from_pretrained('/home/rubensvectomobile_gmail_com/tf', from_tf=True,num_labels = 8)

~/.local/lib/python3.7/site-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    357                 try:
    358                     from transformers import load_tf2_checkpoint_in_pytorch_model
--> 359                     model = load_tf2_checkpoint_in_pytorch_model(model, resolved_archive_file, allow_missing_keys=True)
    360                 except ImportError as e:
    361                     logger.error("Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see "

~/.local/lib/python3.7/site-packages/transformers/modeling_tf_pytorch_utils.py in load_tf2_checkpoint_in_pytorch_model(pt_model, tf_checkpoint_path, tf_inputs, allow_missing_keys)
    199 
    200     if tf_inputs is None:
--> 201         tf_inputs = tf.constant(DUMMY_INPUTS)
    202 
    203     if tf_inputs is not None:

NameError: name 'DUMMY_INPUTS' is not defined
```
PyTorch, Tensorflow, transformers are up to date, as well as nvidia-ml-py3 and fast.ai. I'm on GCP using Debian, Anaconda environment w/ 8 x V100.



Have same issue following the examples. Everything most recent version. I am on a MacBook Pro. Virtualenv environment. Python3.  

I had the same issue. I think it was fixed with this commit - https://github.com/huggingface/transformers/pull/1509/commits/099358675899f759110ad8ccecc22c2fab9b1888.

Perhaps try to re-install from source as @LysandreJik has mentioned in https://github.com/huggingface/transformers/issues/1532, or just follow the file path in the error and manually make the changes yourself. Works for me now. :)

```
201      -      tf_inputs = tf.constant(DUMMY_INPUTS)
         +      tf_inputs = tf_model.dummy_inputs
```

As I mentioned here [issue](https://github.com/huggingface/transformers/issues/1810#issuecomment-553108898) I was able to make a workaround, as I'm using GCP:

I installed `transformers` using:

```
conda install -c conda-forge transformers
```

In Python 3.7.4, then I added `DUMMY_INPUTS = [[7, 6, 0, 0, 1], [1, 2, 3, 0, 0], [0, 0, 0, 4, 5]]` after variable `logger` in  `/opt/anaconda3/lib/python3.7/site-packages/transformers/modeling_tf_utils.py`, because it was missing.

It was interesting, because in GCP, transformers were not showing in `python3` , only in `sudo python3`

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.