mirror of
https://github.com/FunAudioLLM/CosyVoice.git
synced 2026-02-04 17:39:25 +08:00
fix triton token2wav model cache thread unsafety
This commit is contained in:
@@ -28,6 +28,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.utils.dlpack import to_dlpack
|
from torch.utils.dlpack import to_dlpack
|
||||||
@@ -235,17 +236,17 @@ class TritonPythonModel:
|
|||||||
stream = True
|
stream = True
|
||||||
else:
|
else:
|
||||||
stream = False
|
stream = False
|
||||||
request_id = request.request_id()
|
uuid = uuid4().hex
|
||||||
audio_hat = self.token2wav_model.model.token2wav(token=target_speech_tokens,
|
audio_hat = self.token2wav_model.model.token2wav(token=target_speech_tokens,
|
||||||
prompt_token=prompt_speech_tokens,
|
prompt_token=prompt_speech_tokens,
|
||||||
prompt_feat=prompt_speech_feat,
|
prompt_feat=prompt_speech_feat,
|
||||||
embedding=prompt_spk_embedding,
|
embedding=prompt_spk_embedding,
|
||||||
token_offset=token_offset,
|
token_offset=token_offset,
|
||||||
uuid=request_id,
|
uuid=uuid,
|
||||||
stream=stream,
|
stream=stream,
|
||||||
finalize=finalize)
|
finalize=finalize)
|
||||||
if finalize:
|
if finalize:
|
||||||
self.token2wav_model.model.hift_cache_dict.pop(request_id)
|
self.token2wav_model.model.hift_cache_dict.pop(uuid)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
tts_mel, _ = self.token2wav_model.model.flow.inference(
|
tts_mel, _ = self.token2wav_model.model.flow.inference(
|
||||||
|
|||||||
Reference in New Issue
Block a user