Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: ❗ XTTS can only generate text with a maximum of 400 tokens. #56

Open
msameeh opened this issue Nov 20, 2024 · 4 comments

Comments

@msameeh
Copy link

msameeh commented Nov 20, 2024

Just got the following error, seems to be hitting the limit in coqui TTS.

Chapter 50:  20%|████████████▌                                                  | 1/5 [10:51<43:25, 651.28s/it]
Traceback (most recent call last):
  File "C:\Users\user\anaconda3\Lib\site-packages\gradio\queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\gradio\blocks.py", line 1935, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\gradio\blocks.py", line 1520, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\anyio\_backends\_asyncio.py", line 2134, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\gradio\utils.py", line 826, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "Y:\dev\python\ebook2audiobook\app.py", line 956, in <lambda>
    lambda *args: convert_ebook_to_audio(
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "Y:\dev\python\ebook2audiobook\app.py", line 801, in convert_ebook_to_audio
    convert_chapters_to_audio_standard_model(chapters_directory, output_audio_directory, temperature, length_penalty, repetition_penalty, top_k, top_p, speed, enable_text_splitting, target_voice, language)
  File "Y:\dev\python\ebook2audiobook\app.py", line 704, in convert_chapters_to_audio_standard_model
    tts.tts_to_file(
  File "C:\Users\user\anaconda3\Lib\site-packages\TTS\api.py", line 334, in tts_to_file
    wav = self.tts(
          ^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\TTS\api.py", line 276, in tts
    wav = self.synthesizer.tts(
          ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\TTS\utils\synthesizer.py", line 389, in tts
    outputs = self.tts_model.synthesize(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\TTS\tts\models\xtts.py", line 425, in synthesize
    return self.full_inference(text, speaker_wav, language, **settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\TTS\tts\models\xtts.py", line 494, in full_inference
    return self.inference(
           ^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\anaconda3\Lib\site-packages\TTS\tts\models\xtts.py", line 543, in inference
    text_tokens.shape[-1] < self.args.gpt_max_text_tokens
AssertionError:  ❗ XTTS can only generate text with a maximum of 400 tokens.
@DrewThomasson
Copy link
Owner

We have a fix for this being implemented in the next coming update

In the mean time You could try setting

enable_text_splitting True

It's also a checkbox option in the web gui as well

Screenshot 2024-11-19 at 10 33 02 PM

See if that fixes it for you in the meantime :)

@davpascoal
Copy link

Hello! tried the Text Splitting and doesn't work. Looking forward to the fix :)

@msameeh
Copy link
Author

msameeh commented Nov 21, 2024

Bump! Does not fix with Text Splitting enabled. Same error as before.

@ROBERT-MCDOWELL
Copy link
Contributor

please wait the version-2.0.0 to test it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants