[Reformer] combine reformer model with other tokenizers
Author: flozi00
Pull request: no

# 🐛 Bug

## Information

Model I am using (Bert, XLNet ...): reformer

Language I am using the model on (English, Chinese ...): english

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below) it's based on the reformer mlm notebook, with tokenizer from t5 or roberta

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below) masked language modeling

## To reproduce

Steps to reproduce the behavior:

1. replace the tokenizer from reformer with t5 or roberta
2.
3.

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

<pre><code>
  File "train_reformer.py", line 163, in <module>
    trainer.train()
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/trainer.py", line 499, in train
    tr_loss += self._training_step(model, inputs, optimizer)
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/trainer.py", line 622, in _training_step
    outputs = model(**inputs)
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/.local/lib/python3.8/site-packages/apex/amp/_initialize.py", line 196, in new_fwd
    output = old_fwd(*applier(args, input_caster),
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 1853, in forward
    reformer_outputs = self.reformer(
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 1623, in forward
    encoder_outputs = self.encoder(
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/n
wandb: Waiting for W&B process to finish, PID 142384
n/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 1368, in forward
    hidden_states = _ReversibleFunction.apply(
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 1267, in forward
    layer_outputs = layer(
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 1145, in forward
    attn_outputs = self.attention(
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 10wandb: Program failed with code 1. Press ctrl-c to abort syncing.
06, in forward
    self_attention_outputs = self.self_attention(
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/anaconda3/envs/transformers/lib/python3.8/site-packages/transformers/modeling_reformer.py", line 805, in forward
    query_vectors = self.query(hidden_states)
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 87, in forward
    return F.linear(input, self.weight, self.bias)
  File "/home/a-ware/.local/lib/python3.8/site-packages/torch/nn/functional.py", line 1612, in linear
    output = input.matmul(weight.t())
RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
wandb: Process crashed early, not syncing files
</code></pre>


## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version: master
- Platform:
- Python version: 3.8
- PyTorch version (GPU?): 1.4
- Tensorflow version (GPU?):
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

Comments:
I'm not sure I completely understand your process. You're loading a Reformer model - which one, with which checkpoint?

You want to use another tokenizer. Which one, loaded from which checkpoint?

I am using this notebook: https://github.com/patrickvonplaten/notebooks/blob/master/Reformer_For_Masked_LM.ipynb
The tokenizer I am using is the t5-large from the modelhub.

Restarting my complete System solved the problem, seems like there was an error with cuda or the anaconda enviroment