Multilingual Fix for the issue : NameError: name 'model' is not defined
I had this issue :
Traceback (most recent call last):
File "E:\chatterbox\txt\mytest_fr.py", line 10, in
While running this adapted script ( with device "cuda" fixed ) :
_import torchaudio as ta from chatterbox.tts import ChatterboxTTS from chatterbox.mtl_tts import ChatterboxMultilingualTTS
multilingual_model = ChatterboxMultilingualTTS.from_pretrained(device="cuda")
french_text = "Après avoir largement perdu, lundi, le vote de confiance qu’il avait sollicité (194 voix pour, 364 contre), François Bayrou, nommé premier ministre en décembre, vient de remettre sa démission au président de la République, Emmanuel Macron. Il doit expédier les affaires courantes en attendant un successeur, le cinquième chef du gouvernement depuis le début du second quinquennat d’Emmanuel Macron, en 2022. Le chef de l’Etat « nommera un nouveau premier ministre dans les tout prochains jours », a annoncé lundi soir l’Elysée." wav_french = multilingual_model.generate(french_text, language_id="fr") ta.save("test-french.wav", wav_french, model.sr)_
To fix it I had to modifiy the last line of my code : ta.save("test-french.wav", wav_french, multilingual_model.sr)
That looks to me like just an error in your code - not chatterbox's. You stored the instantiated model in a variable named multilingual_model, then tried to reference it by a different name (model), which is undefined since you didn't define it. You just have to reference whatever variable name you define, whatever you call it. Anyway, it looks like you already identified how to fix it on your own, so this issue is resolved, right?
Hi Doctor ! Thanks for the reply. I haven't been using chatterbox lately but I'll definitly check your correction feedback if I need to reuse it. Wish you a good Christmas time !!