+回归测试脚本 (#103)

* deepspeed无法使用时回退到通常路径

* ninja支持中文路径编译补丁:BigVGAN fused cuda kernel

* 缓存参考音频的Mel

* ninja支持中文路径编译方案2:BigVGAN fused cuda kernel

* 增加批次推理:长句实现至少 2~10 倍以上的速度提升~

* fix上层目录为空时报错

* 批次推理:重要修复(漏句/丢句/音频空白)

* 批次推理:新增数据分桶机制,增强稳定性~

* +回归测试脚本

* update 回归测试脚本

* fix merge出错

---------

Co-authored-by: kemuriririn <10inspiral@gmail.com>
Co-authored-by: sunnyboxs <sjt2000@qq.com>
This commit is contained in:
kemuriririn 2025-04-18 18:09:13 +08:00 committed by GitHub
parent 71c5295198
commit a26894de71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 2 deletions

View File

@ -184,7 +184,7 @@ class IndexTTS:
return [
sentence.strip() for sentence in sentences if sentence.strip() and sentence.strip() not in {"'", ".", ","}
]
def bucket_sentences(self, sentences, enable):
"""
Sentence data bucketing
@ -288,7 +288,6 @@ class IndexTTS:
gpt_forward_time = 0
bigvgan_time = 0
# text processing
all_text_tokens = []
self._set_gr_progress(0.1, "text processing...")

28
tests/regression_test.py Normal file
View File

@ -0,0 +1,28 @@
from indextts.infer import IndexTTS
if __name__ == "__main__":
prompt_wav="tests/sample_prompt.wav"
tts = IndexTTS(cfg_path="checkpoints/config.yaml", model_dir="checkpoints", is_fp16=True, use_cuda_kernel=False)
# 单音频推理测试
text="晕 XUAN4 是 一 种 GAN3 觉"
tts.infer(audio_prompt=prompt_wav, text=text, output_path=f"outputs/{text[:20]}.wav", verbose=True)
text='大家好我现在正在bilibili 体验 ai 科技说实话来之前我绝对想不到AI技术已经发展到这样匪夷所思的地步了'
tts.infer(audio_prompt=prompt_wav, text=text, output_path=f"outputs/{text[:20]}.wav", verbose=True)
text="There is a vehicle arriving in dock number 7?"
tts.infer(audio_prompt=prompt_wav, text=text, output_path=f"outputs/{text[:20]}.wav", verbose=True)
# 并行推理测试
text="亲爱的伙伴们,大家好!每一次的努力都是为了更好的未来,要善于从失败中汲取经验,让我们一起勇敢前行,迈向更加美好的明天!"
tts.infer_fast(audio_prompt=prompt_wav, text=text, output_path=f"outputs/{text[:20]}.wav", verbose=True)
text="The weather is really nice today, perfect for studying at home.Thank you!"
tts.infer_fast(audio_prompt=prompt_wav, text=text, output_path=f"outputs/{text[:20]}.wav", verbose=True)
text='''叶远随口答应一声,一定帮忙云云。
教授看叶远的样子也知道这事情多半是黄了
谁得到这样的东西也不会轻易贡献出来这是很大的一笔财富
叶远回来后又自己做了几次试验发现空间湖水对一些外伤也有很大的帮助
找来一只断了腿的兔子喝下空间湖水一天时间兔子就完全好了
还想多做几次试验可是身边没有试验的对象就先放到一边了解空间湖水可以饮用而且对人有利这些就足够了
感谢您的收听下期再见
'''.replace("\n", "")
tts.infer_fast(audio_prompt=prompt_wav, text=text, output_path=f"outputs/{text[:20]}.wav", verbose=True)

BIN
tests/sample_prompt.wav Normal file

Binary file not shown.