Instructions to use facebook/mms-tts-hin with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/mms-tts-hin with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-speech", model="facebook/mms-tts-hin")# Load model directly from transformers import AutoTokenizer, AutoModelForTextToWaveform tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-hin") model = AutoModelForTextToWaveform.from_pretrained("facebook/mms-tts-hin") - Notebooks
- Google Colab
- Kaggle
Saving the Audio Files
#6
by TalhaNisarMughal - opened
So I was using this model to perform TTS-hindi but while saving the audio files I faced some errors. So I have resolved the error. If anyone is also facing any error while saving the audio file then you can try this function. It worked for me.
def save_audio_file(output, file):
audio_array = output.numpy().squeeze()
audio_array /=1.414
audio_array *= 32767
audio_array = audio_array.astype(np.int16)
sampling_rate = model.config.sampling_rate
scipy.io.wavfile.write(f"/root/{file}", rate=sampling_rate, data=audio_array)