mirror of
https://github.com/FunAudioLLM/CosyVoice.git
synced 2026-02-05 18:09:24 +08:00
add empty cache
This commit is contained in:
@@ -209,6 +209,7 @@ class CosyVoiceModel:
|
|||||||
self.mel_overlap_dict.pop(this_uuid)
|
self.mel_overlap_dict.pop(this_uuid)
|
||||||
self.hift_cache_dict.pop(this_uuid)
|
self.hift_cache_dict.pop(this_uuid)
|
||||||
self.flow_cache_dict.pop(this_uuid)
|
self.flow_cache_dict.pop(this_uuid)
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
def vc(self, source_speech_token, flow_prompt_speech_token, prompt_speech_feat, flow_embedding, stream=False, speed=1.0, **kwargs):
|
def vc(self, source_speech_token, flow_prompt_speech_token, prompt_speech_feat, flow_embedding, stream=False, speed=1.0, **kwargs):
|
||||||
# this_uuid is used to track variables related to this inference thread
|
# this_uuid is used to track variables related to this inference thread
|
||||||
@@ -262,6 +263,7 @@ class CosyVoiceModel:
|
|||||||
self.llm_end_dict.pop(this_uuid)
|
self.llm_end_dict.pop(this_uuid)
|
||||||
self.mel_overlap_dict.pop(this_uuid)
|
self.mel_overlap_dict.pop(this_uuid)
|
||||||
self.hift_cache_dict.pop(this_uuid)
|
self.hift_cache_dict.pop(this_uuid)
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|
||||||
|
|
||||||
class CosyVoice2Model(CosyVoiceModel):
|
class CosyVoice2Model(CosyVoiceModel):
|
||||||
@@ -393,3 +395,4 @@ class CosyVoice2Model(CosyVoiceModel):
|
|||||||
with self.lock:
|
with self.lock:
|
||||||
self.tts_speech_token_dict.pop(this_uuid)
|
self.tts_speech_token_dict.pop(this_uuid)
|
||||||
self.llm_end_dict.pop(this_uuid)
|
self.llm_end_dict.pop(this_uuid)
|
||||||
|
torch.cuda.empty_cache()
|
||||||
|
|||||||
Reference in New Issue
Block a user