RobertaTokenizerFast object has no attribute '_convert_token_to_id'
Author: demongolem-biz
Pull request: no

## 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: 4.9
- Platform: Linux
- Python version: 3.6
- Tensorflow version (GPU?): 2.5
- Using GPU in script?: No

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

@patrickvonplaten, @LysandreJik

Models:
Roberta(Tokenizer)Fast


## Information

Model I am using (Bert, XLNet ...):

Roberta(Tokenizer)Fast

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [X ] my own modified scripts: (give details below)

LM-BFF

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [ X] my own task or dataset: (give details below)

Fine-tuning of existing language model for my own task

## To reproduce

Steps to reproduce the behavior:

1) Create RobertaFastTokenizer
2) Try to call _convert_token_to_id

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

The example given by the maintainers of LM-BFF supposedly runs successfully, at least with what they claim is version 3.4 or higher of transformers.  However, upon my inspection of source code of transformers, I see that _convert_token_to_id is not associated with fast tokenizers only with standard tokenizers.  For example, if I view transformers.tokenization_gpt2 (Roberta tokenizer being built on gpt2)  for v 3.4.0, I see _convert_token_to_id present and implemented.  However, if I go to transformers.tokenization_gpt2_fast, it is not there.  Is this a bug, is this something that was removed at some point, or are we simply not able to access _convert_token_to_id when using a Fast tokenizer?


Comments:
Hey @demongolem-biz,

Could you maybe post a short, reproducible code snippet that showcases the problem? Also note that `_convert_token_to_id` is a private method and that the corresponding public method `convert_token_to_id` is the one to be checked.

The code is not mine, I am trying to use someone else's, but here is the `__init__` function from the beginning to the point when `_convert_token_to_id` is used.  I know tokenizer is being passed in, but runtime the error message claims the tokenizer object is a RobertaTokenizerFast.

```
`   def __init__(self, args, tokenizer, cache_dir=None, mode="train", use_demo=False):
        self.args = args
        self.task_name = args.task_name
        self.processor = processors_mapping[args.task_name]
        self.tokenizer = tokenizer
        self.mode = mode

        # If not using demonstrations, use use_demo=True
        self.use_demo = use_demo
        if self.use_demo:
            logger.info("Use demonstrations")
        assert mode in ["train", "dev", "test"]

        # Get label list and (for prompt) label word list
        self.label_list = self.processor.get_labels()
        self.num_labels = len(self.label_list)
        if args.prompt:
            assert args.mapping is not None
            self.label_to_word = eval(args.mapping)

            for key in self.label_to_word:
                # For RoBERTa/BART/T5, tokenization also considers space, so we use space+word as label words.
                if self.label_to_word[key][0] not in ['<', '[', '.', ',']:
                    # Make sure space+word is in the vocabulary
                    assert len(tokenizer.tokenize(' ' + self.label_to_word[key])) == 1
                    self.label_to_word[key] = tokenizer._convert_token_to_id(tokenizer.tokenize(' ' + self.label_to_word[key])[0])
                else:
                    self.label_to_word[key] = tokenizer._convert_token_to_id(self.label_to_word[key])
                logger.info("Label {} to word {} ({})".format(key, tokenizer._convert_id_to_token(self.label_to_word[key]), self.label_to_word[key]))
```
           

`

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.