Add Number Normalisation for SpeechT5
Author: tanaymeh
Pull request: yes

# What does this PR do?
This PR will add number normalisation for SpeechT5. Currently, SpeechT5 cannot read numbers, as described in #23480.

Fixes #23480

# Cases covered so far
- [x] Integer number normalisation
- [x] Floating point number normalisation
- [x] Currency normalisation
	- [x] US Dollar `$`
	- [x] cents `¢`
	- [x] Euro `€`
	- [x] Sterling Pound `£`
	- [x] Yen `¥`
	- [x] Other major currency symbols
- [x] Percents `%` 
- [x] Negative numbers (starting with `-`)
- [x] Numbers from 0 to Decillion
- [x] Any combination of those stated and ticked above

## Who can review?
@sanchit-gandhi 

Comments:
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_25447). All of your documentation changes will be reflected on that endpoint.

cc @sanchit-gandhi 

@sanchit-gandhi I added a single test which tests all the covered cases. I also fixed an existing test in the `tests/models/speecht5/test_tokenization_speecht5.py` file which previously was just passing the number '92000' around without normalization but now it would normalize it (see below)

https://github.com/tanaymeh/transformers/blob/afa90898b93c58e712d6d7e3726a66d964282930/tests/models/speecht5/test_tokenization_speecht5.py#L164-L183

> Thanks for adding the tests! LGTM - would just request that we change the default behaviour to not normalise, and maybe add a line in the SpeechT5 tokenizer docs to highlight to users that they can use this great feature?

I have a rather dumb doubt, @sanchit-gandhi: I had added the information about the `normalize` argument in the docstring of the `SpeechT5Tokenizer` class ([here](https://github.com/tanaymeh/transformers/blob/afa90898b93c58e712d6d7e3726a66d964282930/src/transformers/models/speecht5/tokenization_speecht5.py#L68-L69)). Should I add it somewhere else to be shown in the docs? Doesn't the doc builder builds the docstrings and renders them in the docs automatically?

Thanks!

@ArthurZucker I added your suggested changes ([here](https://github.com/tanaymeh/transformers/blob/682bee8d517398b8b9840808ff3a3bb106f6b9fd/src/transformers/models/speecht5/tokenization_speecht5.py#L126-L132) and [here](https://github.com/tanaymeh/transformers/blob/682bee8d517398b8b9840808ff3a3bb106f6b9fd/src/transformers/models/speecht5/tokenization_speecht5.py#L138-L146)).

I also added support for comma-separated numbers [here](https://github.com/tanaymeh/transformers/blob/682bee8d517398b8b9840808ff3a3bb106f6b9fd/src/transformers/models/speecht5/number_normalizer.py#L185-L186).

Please let me know if I missing something or need to change something.

Thanks for your review @sanchit-gandhi and @ArthurZucker. Waiting for review from @ylacombe!

I am rather new to python and transformers.
Can someone please provide me documentation for this? I am doing the following, but I am not sure where I can pass the normalize parameter.
Currently the audio being generated skips all the numbers given in the input text.

```
import sounddevice as sd
import torch
from datasets import load_dataset
from transformers import SpeechT5Processor, SpeechT5HifiGan, SpeechT5ForTextToSpeech

processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
device = "cuda:0" if torch.cuda.is_available() else "cpu"


def synthesise(text):
    inputs = processor(text=text, return_tensors="pt")
    vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
    model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts").to(device)
    speech = model.generate_speech(
        inputs["input_ids"].to(device), speaker_embeddings.to(device), vocoder=vocoder
    )
    return speech.cpu()


def playback_speech(text):
    audio = synthesise(text)
    sd.play(audio.numpy(), samplerate=16000)
    sd.wait()


playback_speech("Numbers from one through ten : 1 2 3 4 5 6 7 8 9 10")
```

@ramkrishna757575 You need to turn `normalize=True` in the `processor`. By default, the number normalization is turned off to ensure backwards compatibility since it's a breaking change.

Inside the `synthesise()` function, you can do:
```python
# ... Rest of the code
def synthesise(text):
    inputs = processor(text=text, return_tensors="pt", normalize=True)
# ... Rest of the code
```

> 

Thanks for the quick reply @tanaymeh.
I tried it, but I got this warning:

`Keyword arguments {'normalize': True} not recognized.`

I checked the version of `transformers` that I have installed and it is currently `4.32.0`

I tried doing this

```
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts", normalize=True)
```

This stops throwing the warning, but also does not speak out the numerals in the input text

@ramkrishna757575 You need to install the latest version of the transformers (that is not yet released), using:
`pip install git+https://github.com/huggingface/transformers`, in this, you will be able to use this setting. 


Thanks a lot @tanaymeh.
This seemed to work.
The issue was the incorrect version of transformers installed.
After I installed the latest unreleased version as you stated, it seems to work.

Thanks again :smiley: 

Thanks for helping out here @tanaymeh! Here's the parameter in the docs (on `main`) @ramkrishna757575: https://huggingface.co/docs/transformers/main/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.normalize

> Thanks for helping out here @tanaymeh! Here's the parameter in the docs (on `main`) @ramkrishna757575: https://huggingface.co/docs/transformers/main/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.normalize

got it...thanks @sanchit-gandhi