Allow registerable Components
# 🚀 Feature request

Currently, the Auto* classes use hardcoded mappings from model_name to class. This means they cannot be used to extend transformers with custom implementations, which in turn makes it difficult to perform experiments for example using alternate tokenisation particularly integration with other frameworks such as Allen NLP.

I have a custom tokeniser that is based on the tokenizers library. Since it uses a custom python pre-tokenisation step it cannot be serialised to the tokenizer.json file. To get around this I created a custom class that builds the pipeline on the fly. i.e.

```
class CustomUnigramTokenizer(PreTrainedTokenizerFast,FromParams):
    def __init__(
        self,
        tokenizer_file:str=None,
        bos_token:str="<s>",
        eos_token:str="</s>",
        sep_token:str="</s>",
        cls_token:str="<s>",
        unk_token:str="<unk>",
        pad_token:str="<pad>",
        mask_token:str="<mask>",
        **kwargs
    ):
        super().__init__(
            tokenizer_file=tokenizer_file,
            bos_token=bos_token,
            eos_token=eos_token,
            unk_token=unk_token,
            sep_token=sep_token,
            cls_token=cls_token,
            pad_token=pad_token,
            mask_token=mask_token,
            **kwargs,
        )
        self.backend_tokenizer.pre_tokenizer = self._pre_tokenizer()
```

The issue is I have to use `CustomUnigramTokenizer.from_pretrained()` rather than `AutoTokenizer.from_pretrained()`

Most frameworks, i.e. the trainers in the transformers library, or the allennlp library use `AutoTokenizer.from_pretrained()`

So it would be nice if I could register my implementation, i.e.

AutoTokenizer.register(model_name="my_custom_model", CustomUnigramTokenizer)

Allowing AutoTokenizer.from_pretrained("/path_to_my_custom_tokeniser")

I'm assuming I have a config.json in /path_to_my_custom_tokeniser with model_name="my_custom_model"

Even better would be an allennlp registration system, i.e.

```
PreTrainedTokenizer.register("my_custom_model")
class CustomUnigramTokenizer(PreTrainedTokenizerFast,FromParams):
    def __init__():
```

## Motivation

It's quite difficult to extend transformers and experiment with different configurations.
Similar question to https://github.com/huggingface/transformers/issues/10256, and it is indeed a nice proposal!<|||||>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.