optimize vc code

This commit is contained in:
lyuxiang.lx
2025-04-15 16:15:20 +08:00
parent c07cd3d730
commit 37e48dd318
2 changed files with 17 additions and 62 deletions

View File

@@ -128,7 +128,7 @@ class CosyVoice:
def inference_vc(self, source_speech_16k, prompt_speech_16k, stream=False, speed=1.0):
model_input = self.frontend.frontend_vc(source_speech_16k, prompt_speech_16k, self.sample_rate)
start_time = time.time()
for model_output in self.model.vc(**model_input, stream=stream, speed=speed):
for model_output in self.model.tts(**model_input, stream=stream, speed=speed):
speech_len = model_output['tts_speech'].shape[1] / self.sample_rate
logging.info('yield speech len {}, rtf {}'.format(speech_len, (time.time() - start_time) / speech_len))
yield model_output