XLNet model on S3 not set up correctly? 
Hi all, 

**I'm trying to initialize an XLNetForSequenceClassification model as follows:** 

```
from transformers import XLNetForSequenceClassification, XLNetConfig
configuration = XLNetConfig()
model = XLNetForSequenceClassification.from_pretrained("xlnet-base-cased", config=configuration)
```

**However I'm getting an error:** 

> RuntimeError: Error(s) in loading state_dict for XLNetForSequenceClassification:
> 	size mismatch for transformer.mask_emb: copying a param with shape torch.Size([1, 1, 768]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024]).
> 	size mismatch for transformer.word_embedding.weight: copying a param with shape torch.Size([32000, 768]) from checkpoint, the shape in current model is torch.Size([32000, 1024]).
> 	size mismatch for transformer.layer.0.rel_attn.q: copying a param with shape torch.Size([768, 12, 64]) from checkpoint, the shape in current model is torch.Size([1024, 16, 64]).
>     ...

**I can get my code to run by specifying in my config:** 

```
configuration.d_model = 768 # hidden size --> should be 1024 
configuration.n_head = 12 # number of attention heads --> should be 16
configuration.d_inner = 3072 # FFN inner hidden size --> should be 4096
```

But I am somewhat confused: These adjustments to the model are not in line with XLNet as introduced in the [XLNet paper](https://arxiv.org/pdf/1906.08237.pdf) (page 13). Am I understanding something wrong here, or is the XLNet model on S3 not set up correctly? 
After looking into this some more. It looks like my issue was arising from the fact that the XLNet authors published both a 'base' and 'large' version of their model: 

![image](https://user-images.githubusercontent.com/61122332/77469528-84cfd800-6e0f-11ea-8995-8a569bd2dc16.png)

It seems like the config defaults to the 'large' version, but I am loading the 'base' version. Adjustments to the parameters as outlined make sense in this light. <|||||>There are simpler ways to do what you describe; first of all, you don't have to specify the configuration file, the model will load it automatically:

```py
from transformers import XLNetForSequenceClassification, XLNetConfig

model = XLNetForSequenceClassification.from_pretrained("xlnet-base-cased")
```

Secondly, you can also instantiate a configuration from a pre-trained checkpoint:

```py
from transformers import XLNetForSequenceClassification, XLNetConfig
configuration = XLNetConfig.from_pretrained("xlnet-base-cased")
model = XLNetForSequenceClassification.from_pretrained("xlnet-base-cased", config=configuration)
```