mirror of
https://github.com/matatonic/openedai-speech
synced 2025-06-26 18:16:32 +00:00
gc/empty_cache when swapping xtts models
This commit is contained in:
parent
744967e982
commit
1a553f18d7
7
main.py
7
main.py
@ -130,8 +130,13 @@ async def generate_speech(request: GenerateSpeechRequest):
|
||||
tts_model, speaker = map_voice_to_speaker(voice, 'tts-1-hd')
|
||||
|
||||
if not xtts or xtts.model_name != tts_model:
|
||||
if xtts:
|
||||
import torch, gc
|
||||
del xtts
|
||||
gc.collect()
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
xtts = xtts_wrapper(tts_model, device=args.xtts_device)
|
||||
# XXX probably should GC/torch cleanup here
|
||||
|
||||
# input sample rate is 22050, output is 24000...
|
||||
ffmpeg_args = build_ffmpeg_args("24000", response_format)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user