wrong output for Bert-larged-uncased
I am running Bert for the pytorch version:

from transformers import BertConfig, BertTokenizer, BertModel

config_class, model_class, tokenizer_class = (BertConfig, BertModel, BertTokenizer)
        
transformer_config = config_class.from_pretrained(pretrained_model + "/bert_config.json")
tokenizer = tokenizer_class.from_pretrained(pretrained_model, do_lower_case = True)
transformer_model = model_class.from_pretrained(pretrained_model, config=transformer_config)

last_hidden_states, pooling_output =transformer_model(input_ids_tensor, attention_mask_tensor, segment_ids_tensor)

The output of 'transformer_model' -- last_hidden_states, should be a Tensor. But the result is 'last_hidden_state', that means it is a string object. What's wrong with it ?

Hi @Twsschx 

In the newer version of transformers, PyTorch models have outputs that are instances of subclasses of `ModelOutput`,
to access it as a tuple, you can use slicing, or to get a particular tensor, just provide the key to the output class.

i.e 
```python3
last_hidden_states, pooling_output =transformer_model(input_ids_tensor, attention_mask_tensor, segment_ids_tensor)[:] # slice
```

or 
```python3
output =transformer_model(input_ids_tensor, attention_mask_tensor, segment_ids_tensor)
last_hidden_state = output["last_hidden_states"]
pooling_output = output["pooler_output"]
```

And if you want the models to output tuple like the previous versions, then pass `return_dict=False` to `forward`

```python3
last_hidden_states, pooling_output = transformer_model(**inputs, return_dict=False)
```

You can find more about output classes in this [doc](https://huggingface.co/transformers/main_classes/output.html).<|||||>Thanks. It helps me a lot!<|||||>This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.