TypeError: 'NoneType' object is not callable
Author: sw-ot-ashishpatel
Pull request: no
Labels: name: wontfix

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-d477193005ba> in <module>
     12                                         output_attentions=True)
     13     input_ids = torch.tensor([tokenizer.encode("Let's see all hidden-states and attentions on this text")])
---> 14     all_hidden_states, all_attentions = model(input_ids)[-2:]

TypeError: 'NoneType' object is not callable

Comments:
What is the code you are running to get this error?

I assume it is when trying to run the "quick tour" from the readme. I'm getting the same error and found a similar issue in #712 where the feedback was "usually, this comes from the library not being able to reach AWS S3 servers to download the pretrained weights". However, I also tried running it on Google Colab (with 1Gbit connection) with the same result.

```
ERROR:pytorch_transformers.modeling_utils:Model name 'xlm-mlm-enfr-1024' was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc). We assumed 'xlm-mlm-enfr-1024' was a path or url but couldn't find any file associated to this path or url.
ERROR:pytorch_transformers.modeling_utils:Model name 'xlm-mlm-enfr-1024' was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc). We assumed 'xlm-mlm-enfr-1024' was a path or url but couldn't find any file associated to this path or url.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-3ed6cc19ece0> in <module>()
     41                                     output_attentions=True)
     42 input_ids = torch.tensor([tokenizer.encode("Let's see all hidden-states and attentions on this text")])
---> 43 all_hidden_states, all_attentions = model(input_ids)[-2:]
     44 
     45 # Models are compatible with Torchscript

TypeError: 'NoneType' object is not callable
````

Yes [bas020](https://github.com/bsa020) I have same error. I ran the same "quick tour".

@bsa020 I got the same issue in both Google Colab and my PC. Any idea how to solve it?

As I understand, in the loop 
`for model_class, tokenizer_class, pretrained_weights in MODELS:
    # Load pretrained model/tokenizer
    tokenizer = tokenizer_class.from_pretrained(pretrained_weights)
    model = model_class.from_pretrained(pretrained_weights)

    # Encode text
    input_ids = torch.tensor([tokenizer.encode("Here is some text to encode")])
    with torch.no_grad():
        last_hidden_states = model(input_ids)[0]  # Models outputs are now tuples`

the value of variable `pretrained_weights` is 'xlm-mlm-enfr-1024', not 'bert-base-uncased'. That's why we got error when running 
`model = model_class.from_pretrained('bert-base-uncased',
                                    output_hidden_states=True,
                                    output_attentions=True)
input_ids = torch.tensor([tokenizer.encode("Let's see all hidden-states and attentions on this text")])
all_hidden_states, all_attentions = model(input_ids)[-2:]`

I got the same issue. How to fix the problem??

@Susan19900316 just change `pretrained_weights` into `bert-base-uncased`

Done Let me try. Thanks all for help.

I'm not sure if this issue should be closed before the readme is updated? @rodgzilla @sw-ot-ashishpatel 

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.