UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte 
When I trying to load a saved fine-tuned BERT model, I am facing 'UnicodeDecodeError'. The sample code is 

```
from transformers import AutoTokenizer, AutoModel, AdamW, get_linear_schedule_with_warmup, BertConfig

self.bert_layer = AutoModel.from_pretrained(bert_model)
config = BertConfig.from_pretrained("models1/our_fine_tuned_model_definition+comment.pt", output_hidden_states=True) 
state_dict = torch.load("models1/our_fine_tuned_model_definition+comment.pt", map_location=torch.device('cpu'))
self.bert_layer.load_state_dict(state_dict, config=config)
```

## 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: 3.3.1
- Platform: Ubuntu
- Python version: 3.7.9
- PyTorch version (GPU?): 1.6.0(yes)
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No




## Error:
```
Traceback (most recent call last):                                                                                                                                                    
File "PhenoBERT_trained_using_finetuned_model_1.py", line 374, in <module>                                                                                                          
   net = SentencePairClassifier(bert_model, freeze_bert=freeze_bert)
File "PhenoBERT_trained_using_finetuned_model_1.py", line 107, in __init__                                                                                                        
    config = BertConfig.from_pretrained("models1/our_fine_tuned_model_definition+comment.pt", output_hidden_states=True)                                                             
  File "/home/pratik/anaconda3/lib/python3.7/site-packages/transformers/configuration_utils.py", line 315, in from_pretrained                                                           
  config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)                                                                                                
  File "/home/pratik/anaconda3/lib/python3.7/site-packages/transformers/configuration_utils.py", line 360, in get_config_dict                                                           
  config_dict = cls._dict_from_json_file(resolved_config_file)                                                                                                                      
  File "/home/pratik/anaconda3/lib/python3.7/site-packages/transformers/configuration_utils.py", line 442, in _dict_from_json_file                                                      text = reader.read() 
File "/home/pratik/anaconda3/lib/python3.7/codecs.py", line 322, in decode                                                                                                            
 (result, consumed) = self._buffer_decode(data, self.errors, final)                                                                                                              
 UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte                             

Hi! Could you please put the information required in the issue template? I.e, everything related to your environment.<|||||>@LysandreJik I have updated the original question based on your suggestion. <|||||>You're loading your configuration with:

```py
config = BertConfig.from_pretrained("models1/our_fine_tuned_model_definition+comment.pt", output_hidden_states=True) 
```

Is `models1/our_fine_tuned_model_definition+comment.pt` a directory containing a `config.json` file?<|||||>No, that folder does not contain any `config.json` file. Actually, I took the pretrained SciBERT model and saved it in my local system using the following comment 

```
path_to_model='models1/our_fine_tuned_model_definition+comment.pt'
torch.save(net_copy.state_dict(), path_to_model)
```

As a novice, I am not sure how to save the `config.json` file. Please help me with that. 

Thanks in advance. <|||||>I recommend reading the [quickstart (#using-the-model)](https://huggingface.co/transformers/quicktour.html#using-the-model) to understand the loading/saving of models!

I guess you loaded the model this way:

```py
from transformers import AutoModel

model = AutoModel.from_pretrained("allenai/scibert_scivocab_cased")
```
you should save the model like this:
```py
model.save_pretrained("directory")
```

This will create a directory containing the following:

```py
!ls directory
config.json  pytorch_model.bin
```

You can then load your configuration from that very easily:

```py
BertConfig.from_pretrained("directory")
```
or load the model directly using `AutoModel` or `BertModel`:
```py
AutoModel.from_pretrained("directory")
# or
BertModel.from_pretrained("directory")
```<|||||>Please note that when downloading the `allenai/scibert_scivocab_cased` model, it's cached in your system. You can then freely reload it with the same identifier without re-downloading the model.

Except if you modify the model, for example by fine-tuning, you shouldn't need to save it to disk manually.<|||||>@LysandreJik Thanks a lot <|||||>My pleasure. Closing the issue as resolved.