[BUG] LoRA WebUI 的 seed 没有传入 `generate()`,导致推理结果无法可靠复现
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 37.8k
- Forks
- 4.3k
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
LoRA WebUI 提供了推理 seed 输入框,但当前代码只在 lora_ft_webui.py 中执行了 torch.manual_seed(seed) 和 np.random.seed(seed),随后调用 current_model.generate() 时没有把 seed 参数传进去。
底层 VoxCPM.generate() / _generate() 本身支持 seed 参数。如果 LoRA WebUI 不显式传入 seed,底层会按 seed=None 处理,并自行生成新的随机 seed。因此用户在 LoRA WebUI 里固定 seed 后,推理结果可能仍然无法可靠复现。
这个问题会影响 LoRA checkpoint 的 A/B 测试。比如用户想固定参考音频、参考文本、目标文本、CFG、steps 和 seed,只切换不同 LoRA checkpoint 来比较效果时,结果可能并不是严格可比的。
环境:
- 系统:Windows
- 模型:本地 VoxCPM2
- 启动入口:lora_ft_webui.py
- 仓库 commit:f5a1c6a6b901bc732e20f0d59a369f6829ad717a
相关代码:
在 lora_ft_webui.py 中,seed 被读取并设置:
if seed != -1:
torch.manual_seed(seed)
np.random.seed(seed)
但后面调用 current_model.generate() 时没有传入 seed 参数。
期望行为:
LoRA WebUI 中设置的 seed 应该传入 current_model.generate(),这样用户才能在固定 seed 的情况下稳定复现结果,并可靠比较不同 LoRA checkpoint 的差异。
建议修复:
在 lora_ft_webui.py 中调用 current_model.generate() 时增加 seed 参数,例如:
generation_seed = None if seed in (None, "", -1) else int(seed)
然后在 current_model.generate(...) 中加入:
seed=generation_seed
另外也可以考虑像主 WebUI 一样显示 last_successful_seed,方便用户记录实际成功生成时使用的 seed。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lora_ft_webui.py by tracing the seed input from its current torch.manual_seed() and np.random.seed() handling to the current_model.generate() call. Check the underlying VoxCPM.generate() and _generate() seed behavior, then verify that a fixed seed produces reproducible LoRA WebUI output and that the unset-seed path remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100