Convert pytorch-pretrained-bert to new version (transformers)
So I have this code for albert:

```py
from transformers import AlbertTokenizer, AlbertForMaskedLM

tokenizer = AlbertTokenizer.from_pretrained('albert-base-v2')
model = AlbertForMaskedLM.from_pretrained('albert-base-v2')
input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute", add_special_tokens=True)).unsqueeze(0)  # Batch size 1
outputs = model(input_ids, masked_lm_labels=input_ids)
loss, prediction_scores = outputs[:2]
```

How do i convert it to old format:

```py
from pytorch_pretrained_bert import BertTokenizer, BertModel, BertForMaskedLM

 tokenizer = BertTokenizer.from_pretrained('bert-large-cased')
 model = BertForMaskedLM.from_pretrained('bert-large-cased') 
 tokenized_text_tmp = tokenizer.tokenize(text)
 indexed_tokens_tmp = tokenizer.convert_tokens_to_ids(text_tokens_tmp)
 predictions = model(tokens_tensors, segments_tensors, attention_mask_tensors)
```

How do i get functions tokenizer.convert_tokens_to_ids and tokenizer.tokenize from old version into new one. 
I need to first tokenize text and only after convert it to ids. Because in old code I do this way, changing in new format would take a very long time, because I did a lot of speed optimization and adding of padding.






Have you tried using the exact same methods `tokenize` and `convert_tokens_to_ids`?<|||||>```py
from transformers import AlbertTokenizer, AlbertForMaskedLM
tokenizer = AlbertTokenizer.from_pretrained('albert-base-v2)
model = AlbertForMaskedLM.from_pretrained('albert-base-v2)   

text = "[CLS] Who was Jim Henson ? [SEP]"
tokenized_text = tokenizer.tokenize(text)
indexed_tokens = tokenizer.convert_tokens_to_ids(tokenized_text)

segments_ids = [0 for x in range(0,len(tokenized_text))]
tokens_tensor = torch.tensor([indexed_tokens])
tokens_tensor = tokens_tensor.to('cuda')

with torch.no_grad():
    predictions_0 = model(tokens_tensor)

print(tokenized_text)  
print(predictions_0)  
del predictions_0 
```<|||||>I cannot copy but predictions_0 does not contain 2 elements, but just one.
so:  

loss, prediction_scores = outputs[:2] gives me an error (not in range)

prediction_scores = outputs[0] works, but i do not know what is the output, i hope logits.<|||||>I had to format your first comment as it was unreadable, please [see how to use code blocks](https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks).

In your first snipped you're using:

```py
outputs = model(input_ids, masked_lm_labels=input_ids)
```

while in the second snippet:

```py
predictions_0 = model(tokens_tensor)
```

You're not sending the `masked_lm_labels`, which is what is used to compute the loss. If you were to use these labels, the loss would be computed, resulting in a tuple with 2 elements as an output.

Here's the [documentation](https://huggingface.co/transformers/model_doc/albert.html#transformers.AlbertForMaskedLM) for the `AlbertForMaskedLM` model.
<|||||>Thanks,