precompiled_charsmap checking before adding to the normalizers' list for XLNetTokenizerFast conversion.
Author: shahad-mahmud
Pull request: yes

# What does this PR do?

There is a small change to check the `precompiled_charsmap` during the conversion of a slow tokenizer to `XLNetTokenizerFast`. It will check if the `precompiled_charsmap` is empty before initializing `normalizers.Precompiled` from the tokenizers library. If a [Sentencepiece](https://github.com/google/sentencepiece) tokenizer model is trained with `identity` normalization rule, i.e. no normalization is applied, it fails to initialize a XLNetTokenizerFast as discussed in issue #24616. This PR solves this issue.


Fixes #24616 


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@ArthurZucker 

<!-- Your PR 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.

Models:

- text models: @ArthurZucker and @younesbelkada
- vision models: @amyeroberts
- speech models: @sanchit-gandhi
- graph models: @clefourrier

Library:

- flax: @sanchit-gandhi
- generate: @gante
- pipelines: @Narsil
- tensorflow: @gante and @Rocketknight1
- tokenizers: @ArthurZucker
- trainer: @sgugger

Integrations:

- deepspeed: HF Trainer/Accelerate: @pacman100
- ray/raytune: @richardliaw, @amogkam

Documentation: @sgugger, @stevhliu and @MKhalusova

HF projects:

- accelerate: [different repo](https://github.com/huggingface/accelerate)
- datasets: [different repo](https://github.com/huggingface/datasets)
- diffusers: [different repo](https://github.com/huggingface/diffusers)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Maintained examples (not research project or legacy):

- Flax: @sanchit-gandhi
- PyTorch: @sgugger
- TensorFlow: @Rocketknight1

 -->


Comments:
_The documentation is not available anymore as the PR was closed or merged._

Hey @ArthurZucker I have incorporated the changes so that it supports all the models. 

It is failing in one test case and it seems the test case is not related to this PR. From details I see that it fails due to the `module 'PIL.Image' has no attribute 'LINEAR'` error. Can it be related to the module or environment where the test is running? Do I need to work on this test case for this PR?

For the `test_exotic_models tests`, a fix, pinning the Pillow version has now been merged into main. Could you rebase to include these and trigger a re-run of the CI?

Hey @ArthurZucker and @amyeroberts all tests passed after the rebase. Can you have a look?

Perfect! Thanks for addressing this and contributing! 🤗