Text-to-Speech
coqui

How to use a model I have trained?

#57
by Blakus - opened

Although I clone the space, modify the app.py to point to my custom model in Hugging Face, and use my HF token, it always throws errors.
Is it even possible to use a customized model? Thanks.

look to where the xtts model is stored to see if you have all of your files in your dir your storing your model files are named exactly the same

also you ned to downgrade tts for some reason for loading custom models

pip install tts==0.21.3

other than that idk

I always get an error. no sufficient values to unpack, expect 4 or something like that.
How should I modify the app.py so that it points correctly to my model or, otherwise, how should I format the path to my hugginface repository where my custom model is located?
It seems that the error lies in the way the code expects the path of the model to be passed to it. (tts_models/multilingual/multi-dataset/xtts_v2)
where does that path even point to? to the coqui xtts repository in hugginface?

Btw, the custom path should be something like XTTS_custom/Model/es/my_custom_model ? to take into account the 4 values in the model path?

tts_models/multilingual/multi-dataset/xtts_v2

is a literal path on the device running the model

the beginning part is missing

it should be located around here (At least for linux)
# Get the current user's home directory
USER_HOME=$(eval echo ~${SUDO_USER:-$USER})
# Set the destination directory and file URL
DEST_DIR="$USER_HOME/.local/share/tts/tts_models--multilingual--multi-dataset--xtts_v2"

Also you could just like

Go into the files for the hugginface space and replace these files with your custom model's versions of these files

config.json
model.pth
vocab.json

It is worth clarifying that I always use as reference the Coqui XTTS space. in the space files tab, I do not see the model files (they are hidden)? If so, I can replace them with my files, as you say? And in that case the app.py should not be modified?

Wait...

Are you using the Coqui XTTS-v2 space here or the Coqui XTTS demo space?

In both these cases, you shouldn't have to modify the app.py file as long as the model files you're swapping out have the same names.

  • If you're using the XTTS-v2 space, then I can see the model files in its files tab, so you should just be able to swap them out.
    • Else, you're going to have to hunt down the folder where the base model is stored, as I showed before, so you can swap out the files.
  • If you're using the XTTS demo space, then it looks like you're going to have to hunt down the base model files to swap them out as shown before as well.

So if your hunting them down you may have to modify the dockerfile idk but you probs know what your doing with that part

Thank you very much for your detailed answers. To put you in context, I'm basically trying to use the xtts demo space, (by duplicating the space), as I'm interested in using the gui as a demonstration of a custom model for a client. I will try the methods you told me.

No problem! lol here to help

But yeah I guess your gonna have to find someway to hunt down that folder where the xtts models are stored in the space and just swap out your models with it.
-Also I can make no guarantee of this bruit force method working lol.
-But I am confident in it working as this bruit force method worked when I ran it on locally on Mac, Windows, and multiple Linux Distros.

(BTW heads up if you using this for anything commercial the xtts model license is in like a weird never-ending limbo state)

LINK to discussion about it:
https://github.com/coqui-ai/TTS/issues/3490

Sign up or log in to comment