Matrix multiplication error for ReformerModelWithLMHead when tie_word_embeddings is True
Author: Bluelari2
Pull request: no

## Environment info

- `transformers` version: 4.3.2
- Platform: Windows 10
- Python version: 3.8.5
- PyTorch version (GPU?): 1.7.0 cpu-only
- Tensorflow version (GPU?): not installed
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help

- longformer, reformer, transfoxl, xlnet: @patrickvonplaten

## Information

Model I am using (Bert, XLNet ...): Reformer

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

1. Run the following script:
```python
import torch
from transformers import ReformerConfig, ReformerModelWithLMHead

config = ReformerConfig(is_decoder=True, tie_word_embeddings=True)
model = ReformerModelWithLMHead(config)

inp = torch.randint(0, 100, (1, 4096))
out = model(inp)
```

2. The error:
```
Traceback (most recent call last):
  File "./test.py", line 8, in <module>
    out = model(inp)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\transformers\models\reformer\modeling_reformer.py", line 2248, in forward
    logits = self.lm_head(sequence_output)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\transformers\models\reformer\modeling_reformer.py", line 1761, in forward
    return apply_chunking_to_forward(self.forward_chunk, self.chunk_size_lm_head, self.seq_len_dim, hidden_states)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\transformers\modeling_utils.py", line 1787, in apply_chunking_to_forward
    return forward_fn(*input_tensors)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\transformers\models\reformer\modeling_reformer.py", line 1764, in forward_chunk
    hidden_states = self.decoder(hidden_states)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\linear.py", line 93, in forward
    return F.linear(input, self.weight, self.bias)
  File "C:\Users\xe442\anaconda3\envs\pytorch\lib\site-packages\torch\nn\functional.py", line 1692, in linear
    output = input.matmul(weight.t())
RuntimeError: mat1 and mat2 shapes cannot be multiplied (4096x512 and 256x320)
```

## Expected behavior

There should be no errors.


Comments:
Hey @xe442,

Actually Reformer cannot make use of `tie_word_embeddings=True` because the output word embedding layer is twice as big as the input layer (because of Reformer's architecture, see section 3) in this blog: https://huggingface.co/blog/reformer

But, we should in this case give a better error message! Feel free to open a PR to add such an error message :-)

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.