[Bug] Qwen-Image-2.1 validate_full 未加载训练权重,实际验证的是基座模型
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 90/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python, pytorch
- Domain
- machine-learning
Research direction
Start with examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py and compare it with examples/qwen_image/model_training/validate_full/Qwen-Image-2512.py and the sibling validate_lora script. Run the full-training validation command after checking the epoch output naming in the referenced training script. Done means the validation script reads models/train/Qwen-Image-2.1_full/epoch-1.safetensors and clearly produces the full-training validation image.
Written by the indexing model from the issue text.
Description
问题
examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py 加载的是原始 Qwen/Qwen-Image-2.1,没有任何加载训练产物的语句,因此验证的是未微调的基座模型。
脚本不报错、能正常出图,容易被误判为"全量训练没效果"。
复现
全量训练输出到 models/train/Qwen-Image-2.1_full 后执行:
python examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py
epoch-1.safetensors 从未被读取。
判断依据
-
文档
docs/*/Pipeline_Usage/Model_Training.md写明validate_full的用途是"全量训练完成后,运行这个脚本加载模型,验证效果"。 -
全仓库 136 个
validate_full/*.py中只有这一个不加载任何权重(其余要么pipe.dit.load_state_dict(...),要么ModelConfig(path=<ckpt>)):$ for f in $(find examples -path "*validate_full*" -name "*.py"); do grep -qE "load_state_dict|load_lora|ModelConfig\(\s*path=|ckpt|checkpoint" "$f" \ || echo "$f" done examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py # ↑ 唯一一个,1 / 136 -
该文件自
7f65ecc8新增起就没有加载语句,7f31effa仅删除了num_inference_steps=50;当前main(7686e54d)仍未修复。 -
同目录的
validate_lora/Qwen-Image-2.1.py是正确的,有
pipe.load_lora(pipe.dit, "models/train/Qwen-Image-2.1_lora/epoch-4.safetensors")。
建议修复
参考 examples/qwen_image/model_training/validate_full/Qwen-Image-2512.py:
from diffsynth.pipelines.qwen_image_21 import QwenImage21Pipeline, ModelConfig
+from diffsynth import load_state_dict
import torch
pipe = QwenImage21Pipeline.from_pretrained(
...
processor_config=ModelConfig(model_id="Qwen/Qwen-Image-2.1", origin_file_pattern="processor/"),
)
+state_dict = load_state_dict("models/train/Qwen-Image-2.1_full/epoch-1.safetensors")
+pipe.dit.load_state_dict(state_dict)
prompt = "dog,white and brown dog, sitting on wall, under pink flowers"
image = pipe(prompt, seed=0, height=1024, width=1024)
-image.save("image.png")
+image.save("image_full.png")
epoch-1 对应 full/Qwen-Image-2.1.sh 中的 --num_epochs 2:ModelLogger.on_epoch_end 的 epoch_id 从 0 开始,故最后一个 epoch 文件是 num_epochs - 1。
环境
- DiffSynth-Studio 2.1.8(
d2d684ad),main(7686e54d)仍可复现 - 涉及文件:
examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py
- Dominant language
- Python
- Stars
- 13.1k
- Forks
- 1.3k
- Avg merge
- 13h 15m
- Merged PRs (30d)
- 46
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.
More from modelscope/DiffSynth-Studio
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
modelscope/DiffSynth-Studio#1668 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
modelscope/DiffSynth-Studio#1499 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
modelscope/DiffSynth-Studio#1373 · 5 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
modelscope/DiffSynth-Studio#1704 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
modelscope/DiffSynth-Studio#1701 ·
All issues in modelscope/DiffSynth-Studio
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·