This commit is contained in:
yumoqing 2025-05-11 06:34:17 +00:00
parent 330d3cd077
commit fa1e38952f

View File

@ -1,4 +1,23 @@
# TTS小模型 # TTS小模型
我们创建一个webserver 参考[这里](https://huggingface.com/nari-labs/dia-1.6b)提供的安装和代码
```
import soundfile as sf
from dia.model import Dia
model = Dia.from_pretrained("nari-labs/Dia-1.6B")
text = "[S1] Dia is an open weights text to dialogue model. [S2] You get full control over scripts and voices. [S1] Wow. Amazing. (laughs) [S2] Try it now on Git hub or Hugging Face."
output = model.generate(text)
sf.write("simple.mp3", output, 44100)
```
上述代码有三个问题
1. output的类型是np.int64不被audio格式支持
2. sf.write不支持mp3格式需要换成wav
3. 生成的wav文件没有语音
目前12问题解决第三个问题依然存在
## 依赖 ## 依赖