gitmylo / audio-webui

A webui for different audio related Neural Networks
MIT License
973 stars 90 forks source link

[BUG REPORT] Error wile cooshing tts model\multilingual\multi-dataset\xtts_v1 #146

Open ShmuelRonen opened 10 months ago

ShmuelRonen commented 10 months ago

the error: AttributeError: 'TTS' object has no attribute 'languages'

I use is on window 10 with rtx3090

Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().

You must agree to the terms of service to use this model. | > Please see the terms of service at https://coqui.ai/cpml.txt | > "I have read, understood and agreed the Terms and Conditions." - [y/n] | | > y Downloading model to C:\Users\derec\AppData\Local\tts\tts_models--multilingual--multi-dataset--xtts_v1 100%|██████████████████████████████████████████████████████████████████████████| 2.99G/2.99G [00:53<00:00, 56.4MiB/s] 100%|██████████████████████████████████████████████████████████████████████████| 4.38k/4.38k [00:00<00:00, 4.97kiB/s] 100%|█████████████████████████████████████████████████████████████████████████████| 272k/272k [00:00<00:00, 696kiB/s] Model's license - CPML Check https://coqui.ai/cpml.txt for more info. Using model: xtts Traceback (most recent call last): File "W:\audio-webui\venv\lib\site-packages\gradio\routes.py", line 437, in run_predict output = await app.get_blocks().process_api( File "W:\audio-webui\venv\lib\site-packages\gradio\blocks.py", line 1352, in process_api result = await self.call_function( File "W:\audio-webui\venv\lib\site-packages\gradio\blocks.py", line 1077, in call_function prediction = await anyio.to_thread.run_sync( File "W:\audio-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "W:\audio-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "W:\audio-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "W:\audio-webui\webui\modules\implementations\ttsmodels.py", line 303, in load_tts return gradio.update(value=model), self.tts_speakers() File "W:\audio-webui\webui\modules\implementations\ttsmodels.py", line 276, in tts_speakers languages = list(dict.fromkeys(self.current_model.languages)) if self.current_model.is_multi_lingual else [] File "W:\audio-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1614, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'TTS' object has no attribute 'languages'

gitmylo commented 10 months ago

Is this only with xtts or also with other models?

ShmuelRonen commented 9 months ago

There are that works ans some makes Error

gitmylo commented 9 months ago

I'll go through a few and see whatever errors i can fix then.

Th3rdSergeevich commented 9 months ago

According to TTS.api library, XTTS model doesn't seem to have a language manager, given that there's a stub code for is_multi_lingual property:

@property
def is_multi_lingual(self):
    # TODO: fix this
    if "xtts" in self.model_name:
        return True
    if hasattr(self.synthesizer.tts_model, "language_manager") and self.synthesizer.tts_model.language_manager:
        return self.synthesizer.tts_model.language_manager.num_languages > 1
    return False

That is primarily Coqui TTS issue. The temporary workaround would be to edit languages property so the list of supported languages would be returned:

@property
def languages(self):
    if not self.is_multi_lingual:
        return None
    if "xtts" in self.model_name:
        return ["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn"]
    return self.synthesizer.tts_model.language_manager.language_names

However, after implementing the workaround, I get the following error:

Traceback (most recent call last):
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\gradio\routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\gradio\blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\gradio\blocks.py", line 1077, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "H:\Various\TTSWORKS\audio-webui\venv\lib\site-packages\gradio\helpers.py", line 602, in tracked_fn
    response = fn(*args)
  File "H:\Various\TTSWORKS\audio-webui\webui\ui\tabs\text_to_speech.py", line 79, in _generate
    inputs = [values[i] for i in range(len(inputs)) if
  File "H:\Various\TTSWORKS\audio-webui\webui\ui\tabs\text_to_speech.py", line 80, in <listcomp>
    inputs[i] in all_components_dict[loader.model]]  # Filter and convert inputs
AttributeError: type object 'TTSModelLoader' has no attribute 'model'
nekogecko2 commented 9 months ago

I was going to make another feature request for this. I'd like to have xtts support in audio webui as another alternative voice cloner.

https://huggingface.co/spaces/coqui/xtts

gitmylo commented 9 months ago

Alright, I'll fix this today

gitmylo commented 9 months ago

Although, fixing it would be another hacky fix for something coqui should do themselves. And I had plans to move TTS to an extension in #143. I should probably do that first.