Skip to content

No matter what i do, streaming mode doesnt work. (AttributeError: 'TTSWrapper' object has no attribute 'model') #97

Description

@temtekmedia

It works perfectly with streaming mode off but streaming mode on on the extension>tts menu this happens immedaitely:

(after this long code I have more information about this)

ERROR: Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_utils.py", line 79, in collapse_excgroups
    | yield
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 270, in call
    | async with anyio.create_task_group() as task_group:
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\anyio_backends_asyncio.py", line 781, in aexit
    | raise BaseExceptionGroup(
    | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\applications.py", line 1134, in call
    | await super().call(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\applications.py", line 113, in call
    | await self.middleware_stack(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\errors.py", line 186, in call
    | raise exc
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\cors.py", line 85, in call
    | await self.app(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\exceptions.py", line 63, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    | raise exc
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
    | await app(scope, receive, sender)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call
    | await self.app(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\routing.py", line 716, in call
    | await self.middleware_stack(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\routing.py", line 736, in app
    | await route.handle(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\routing.py", line 290, in handle
    | await self.app(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\routing.py", line 125, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    | raise exc
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
    | await app(scope, receive, sender)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\routing.py", line 112, in app
    | await response(scope, receive, send)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 269, in call
    | with collapse_excgroups():
    | File "C:\Users\Mylly\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in exit
    | self.gen.throw(typ, value, traceback)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_utils.py", line 85, in collapse_excgroups
    | raise exc
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 273, in wrap
    | await func()
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 253, in stream_response
    | async for chunk in self.body_iterator:
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\server.py", line 243, in generator
    | async for chunk in chunks:
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\tts_funcs.py", line 591, in stream_fn
    | async for chunk in self.stream_generation(clear_text,speaker_name_or_path,speaker_wav,language,output_file):
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\tts_funcs.py", line 456, in stream_generation
    | gpt_cond_latent, speaker_embedding = self.get_or_create_latents(speaker_name, speaker_wav)
    | File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\tts_funcs.py", line 260, in get_or_create_latents
    | gpt_cond_latent, speaker_embedding = self.model.get_conditioning_latents(speaker_wav)
    | AttributeError: 'TTSWrapper' object has no attribute 'model'
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\applications.py", line 1134, in call
await super().call(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\applications.py", line 113, in call
await self.middleware_stack(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\errors.py", line 186, in call
raise exc
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\errors.py", line 164, in call
await self.app(scope, receive, _send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\cors.py", line 85, in call
await self.app(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\middleware\exceptions.py", line 63, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
raise exc
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\routing.py", line 716, in call
await self.middleware_stack(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\routing.py", line 736, in app
await route.handle(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\routing.py", line 290, in handle
await self.app(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\routing.py", line 125, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
raise exc
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\fastapi\routing.py", line 112, in app
await response(scope, receive, send)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 269, in call
with collapse_excgroups():
File "C:\Users\Mylly\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette_utils.py", line 85, in collapse_excgroups
raise exc
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 273, in wrap
await func()
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\starlette\responses.py", line 253, in stream_response
async for chunk in self.body_iterator:
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\server.py", line 243, in generator
async for chunk in chunks:
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\tts_funcs.py", line 591, in stream_fn
async for chunk in self.stream_generation(clear_text,speaker_name_or_path,speaker_wav,language,output_file):
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\tts_funcs.py", line 456, in stream_generation
gpt_cond_latent, speaker_embedding = self.get_or_create_latents(speaker_name, speaker_wav)
File "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\venv_stream\lib\site-packages\xtts_api_server\tts_funcs.py", line 260, in get_or_create_latents
gpt_cond_latent, speaker_embedding = self.model.get_conditioning_latents(speaker_wav)
AttributeError: 'TTSWrapper' object has no attribute 'model'

But this code I can run, and I can hear the speech:

(venv_stream) PS X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2> $body = @{

text = "Streaming save test."
speaker_wav = "speakers/calm_female.wav"
language = "en"
output_file = "X:\Software\SillyTavern\STLauncher\SillyTavern-Launcher\voice-generation\XTTsv2\output\stream_test.wav"
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://127.0.0.1:8020/tts_to_audio/" -Method POST -Body $body -ContentType "application/json">>
RIFFJ©♣WAVEfmt ►☺☻�»Ü data°¨♣LIST*INFOICOP▲CC0 / WTFPL / Domaine publicid3 <ID3♥1TXXX'CopyrightCC0 / WTFPL / Domaine public

however it doesnt output anything on the output folder. I also tried to directly download a file but it didnt let me save it because it corrupted instantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions