MOSS-TTSDv1.0微调问题
https://github.com/OpenMOSS/MOSS-TTS/blob/main/moss_tts_delay/finetuning/README_zh.md 参照这个的MOSS- TTSD部分对v1.0进行微调,似乎不可行,微调后模型胡言乱语
Thank you for the feedback. The information provided so far is still not sufficient for us to locate the issue. Please help provide the following key details:
-
What exact base model did you fine-tune?
- Was it
OpenMOSS-Team/MOSS-TTSD-v1.0orOpenMOSS-Team/MOSS-TTS? - Please share the actual
--model-pathyou used.
- Was it
-
What does your training data format look like?
- Please provide a few anonymized raw JSONL examples.
- In particular, we need to see fields such as
text,reference/ref_audio,language, andaudio. - If this is for TTSD, please confirm whether the
textcontains speaker tags like[S1] / [S2], and whether their order is aligned with thereferencelist.
-
How did you run inference for validation after fine-tuning?
- Please share the full inference script you used.
-
What exactly do you mean by “胡言乱语”?
- For example, is the issue incorrect content, repeated speech, speaker confusion, wrong language, unintelligible audio, or something else?
-
Did the training process itself look normal?
- Roughly how many steps / epochs did you train for?
- How many hours of data and how many speakers were used?
- What were your learning rate, batch size, mixed precision setting, and gradient accumulation steps?
With these details, we will be in a much better position to determine whether the issue comes from the base model choice, data format, training setup, or inference pipeline.
The .py files under the MOSS-TTSD-v1.0 directory need to be copied to the generated checkpoint directory. The default in the SFT code is to copy the .py files from the moss-tts-delay folder. Hope this helps!
感谢您的回复,以下是针对每个问题的回复,希望能帮助您定位问题,我是用的是moss_tts_delay/finetuning路径下的微调代码
- 使用的基础模型为本地部署的 OpenMOSS-Team/MOSS-TTSD-v1.0。
2.训练数据为JSONL格式,共约100条,60min,字段如下: { "audio": "/path/to/000001.wav", "text": "[S1]哈喽,大家好...今天我们请来了一位重量级嘉宾。[S2]谢谢小雅,很高兴能在这里...", "reference": [ "/path/to/speaker1.wav", "/path/to/speaker2.wav" ], "language": "zh" } 整个数据集均使用 2 个说话人。
3.推理代码沿用MOSS-TTSDv1.0的推理代码,将模型路径设置为微调后的模型路径。
4.胡言乱语具体是指随机生成的完全无法理解的噪音,与推理脚本无明显关系。
5.训练过程整体正常,总计训练500步,loss从初始~4.5下降到~0.05,趋势正常,约100条样本,60min,2个说话人的数据被使用,学习率设置为1e-5,梯度累计4步,混合精度设置为bf16,采用FSDP4卡并行,其余训练参数基本保持默认参数。
ps.另外需要注意的一点是,我发现使用该微调代码直接微调MOSS-TTSDv1.0,会因为n-vq值不一致而报错(moss_tts_delay的n-vq为32,而MOSS-TTSDv1.0的n-vq为16),因此我在moss_tts_delay/finetuning/prepare_data.py中显式指定了n-vq为16。并且,在微调获得的模型文件夹中,我将原始的processing_moss_tts.py文件替换为OpenMOSS-Team/MOSS-TTSD-v1.0文件夹下的processing_moss_tts.py文件(否则依然会因为n-vq值不一致而报错)。我发现,这两个脚本的主要区别在于,OpenMOSS-Team/MOSS-TTSD-v1.0的processing_moss_tts.py对n-vq有如下处理(568-588行),确保了编码后维度的一致性:
Always follow model RVQ channels (e.g. n_vq=16) and truncate
# tokenizer outputs (e.g. 32-layer RVQ) to the first n_vq layers.
n_vq = self.model_config.n_vq
normalized_audio_codes_list: List[torch.Tensor] = []
for audio_codes in audio_codes_list:
if audio_codes.dim() != 2:
raise RuntimeError(
f"Expect audio codes with rank 2, got {tuple(audio_codes.shape)}"
)
# Handle possible [NQ, T] layout.
if audio_codes.shape[1] < n_vq and audio_codes.shape[0] >= n_vq:
audio_codes = audio_codes.transpose(0, 1)
if audio_codes.shape[1] < n_vq:
raise RuntimeError(
f"audio_codes channels ({audio_codes.shape[1]}) < model n_vq ({n_vq})"
)
audio_codes = audio_codes[:, :n_vq]
normalized_audio_codes_list.append(audio_codes)
再次感谢您的回复和耐心阅读,希望以上信息能帮助您定位到具体问题,如果还有其他未尽事宜,请随时和我联系。
顺便问下官方大佬,v1.0版本的官方微调和流式推理代码何时更新,期待您的回复,不胜感激!
I suspect the issue might be due to inconsistencies between training and inference.
https://github.com/OpenMOSS/MOSS-TTS/blob/8f78205e098e449effbcd85f8814aeb5da908a70/moss_tts_delay/finetuning/sft.py#L43
In the default sft.py, we use MossTTSDelayProcessor.
However, the user prmopt template for MOSS-TTSD-v1.0 is slightly different from that of MOSS-TTS:
MOSS-TTS: https://huggingface.co/OpenMOSS-Team/MOSS-TTS/blob/main/processing_moss_tts.py#L54
MOSS-TTSD: https://huggingface.co/OpenMOSS-Team/MOSS-TTSD-v1.0/blob/main/processing_moss_tts.py#L62
If you are still using the MOSS-TTSD inference code during inference, please modify the Processor class used in sft.py and choose to import it from processing_moss_tts.py in the MOSS-TTSD repository.
The .py files under the MOSS-TTSD-v1.0 directory need to be copied to the generated checkpoint directory. The default in the SFT code is to copy the .py files from the moss-tts-delay folder. Hope this helps!
Thank you very much for your reply. I am glad to find it works!
Thanks everyone for the info! Great project—I really hope to see constant updates moving forward.