daswer123 / xtts-api-server

A simple FastAPI Server to run XTTSv2
MIT License
292 stars 67 forks source link

Docker won't run #35

Open AgentScrubbles opened 6 months ago

AgentScrubbles commented 6 months ago

It looks like the download functions for the models is currently broken. I've tried the default image and have also tried to tinker with it myself.

The models will download, and I can verify they are on the disk, but it appears that it immediately has no idea where the model/configs are. In the code it seems to confuse /app/models and /app/xtts_api_server/models, so maybe there's something there?

Full output from running the docker image:

2023-12-31 04:50:30.093 | INFO     | xtts_api_server.tts_funcs:create_directories:221 - Folder in the path /app/output has been created
2023-12-31 04:50:30.094 | INFO     | xtts_api_server.server:<module>:76 - Model: 'v2.0.2' starts to load,wait until it loads
[XTTS] Downloading config.json...
100%|██████████| 4.36k/4.36k [00:00<00:00, 2.51MiB/s]
[XTTS] Downloading model.pth...
100%|██████████| 1.86G/1.86G [00:34<00:00, 54.1MiB/s]
[XTTS] Downloading vocab.json...
100%|██████████| 335k/335k [00:00<00:00, 2.48MiB/s]
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/xtts_api_server/__main__.py", line 46, in <module>
    from xtts_api_server.server import app
  File "/app/xtts_api_server/server.py", line 77, in <module>
    XTTS.load_model()
  File "/app/xtts_api_server/tts_funcs.py", line 146, in load_model
    self.model = TTS(model_path=checkpoint_dir,config_path=config_path).to(self.device)
  File "/usr/local/lib/python3.10/dist-packages/TTS/api.py", line 70, in __init__
    self.config = load_config(config_path) if config_path else None
  File "/usr/local/lib/python3.10/dist-packages/TTS/config/__init__.py", line 91, in load_config
    with fsspec.open(config_path, "r", encoding="utf-8") as f:
  File "/usr/local/lib/python3.10/dist-packages/fsspec/core.py", line 103, in __enter__
    f = self.fs.open(self.path, mode=mode)
  File "/usr/local/lib/python3.10/dist-packages/fsspec/spec.py", line 1295, in open
    f = self._open(
  File "/usr/local/lib/python3.10/dist-packages/fsspec/implementations/local.py", line 180, in _open
    return LocalFileOpener(path, mode, fs=self, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/fsspec/implementations/local.py", line 302, in __init__
    self._open()
  File "/usr/local/lib/python3.10/dist-packages/fsspec/implementations/local.py", line 307, in _open
    self.f = open(self.path, mode=self.mode)
FileNotFoundError: [Errno 2] No such file or directory: '/app/xtts_api_server/models/v2.0.2/config.json'
AgentScrubbles commented 6 months ago

This appears to work when I run your direct container from Dockerhub, daswer123/xtts-api-server, but not when I build the container myself. Maybe it's just a documentation thing that I'm missing?

daswer123 commented 6 months ago

Hi docker was not created by me, I was helped, it was quite a long time ago, I unfortunately do not have the opportunity to test the docker. After the holidays I will try to fix this problem with the help of a friend's computer.

AgentScrubbles commented 6 months ago

Thanks, I took a quick stab at it but I need to understand the underlying code more. I think it just needs a clearer mapping of the model directory to a specific folder. It may be a good idea to extract that to an environment variable if it isn't already, then always reference that environment variable for saving/loading models

daswer123 commented 6 months ago

I upgraded my pc and now I can fully work with docker. I've redone the docker file and it should work now

AgentScrubbles commented 6 months ago

Thanks I'll try it out!

AgentScrubbles commented 6 months ago

Update, sorry for the lateness, so I've tried it and it's running, but not picking up my model either. I'm still poking at it, I want to double check to see if it's my specific image or if there's something else wrong with it, will have an update soon.

rhamblen commented 5 months ago

Ive got the docker running on URAID... the docker runs and I can connect to XTTS in ST, but there are no voices. I put the speakers folder in the app folder and voices still not found. Im thinking that its not looking at the correct location for the files it needs.

CMD ["bash", "-c", "python3 -m xtts_api_server -hs 127.0.0.1 -p 8020 -sf 'xtts-server/speakers' -o 'xtts-server/output' -mf 'xtts-server/models' --deepspeed"]

Would be nice if we could use an environment variable and then set our own startup options. For example I would like to use streaming mode.