Skip to content

Commit afbcf40

Browse files
authored
fix: 修复prompt_cache里面没有cache住ref_audio_path,导致每次TTS推理都需要加载一遍reference_audio的bug【首次音频帧从3.2s -> 1.7s】 (#1235)
1 parent e4b17c4 commit afbcf40

File tree

1 file changed

+4
-0
lines changed
  • GPT_SoVITS/TTS_infer_pack

1 file changed

+4
-0
lines changed

GPT_SoVITS/TTS_infer_pack/TTS.py

+4
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,11 @@ def set_ref_audio(self, ref_audio_path:str):
360360
'''
361361
self._set_prompt_semantic(ref_audio_path)
362362
self._set_ref_spec(ref_audio_path)
363+
self._set_ref_audio_path(ref_audio_path)
363364

365+
def _set_ref_audio_path(self, ref_audio_path):
366+
self.prompt_cache["ref_audio_path"] = ref_audio_path
367+
364368
def _set_ref_spec(self, ref_audio_path):
365369
audio = load_audio(ref_audio_path, int(self.configs.sampling_rate))
366370
audio = torch.FloatTensor(audio)

0 commit comments

Comments
 (0)