modelscope / modelscope/DiffSynth-Studio
训练minimax- h3的nf4模型的lora,使用adapter训练时融合lora会报错
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.1k
- Forks
- 1.3k
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 45
Description
[rank0]: Traceback (most recent call last):
[rank0]: File "/data4/hjhuang/code/DiffSynth-Studio-2.1.4/examples/minimax_h3/model_training/train.py", line 190, in
[rank0]: model = MiniMaxH3TrainingModule(
[rank0]: File "/data4/hjhuang/code/DiffSynth-Studio-2.1.4/examples/minimax_h3/model_training/train.py", line 50, in init
[rank0]: self.switch_pipe_to_training_mode(
[rank0]: File "/data4/hjhuang/code/DiffSynth-Studio-2.1.4/diffsynth/diffusion/training_module.py", line 322, in switch_pipe_to_training_mode
[rank0]: pipe.load_lora(getattr(pipe, preset_lora_model), preset_lora_path)
[rank0]: File "/data4/hjhuang/code/DiffSynth-Studio-2.1.4/diffsynth/diffusion/base_pipeline.py", line 280, in load_lora
[rank0]: lora_loader.fuse_lora_to_base_model(module, lora, alpha=alpha)
[rank0]: File "/data4/hjhuang/code/DiffSynth-Studio-2.1.4/diffsynth/utils/lora/general.py", line 67, in fuse_lora_to_base_model
[rank0]: state_dict_base["weight"] = state_dict_base["weight"].to(device=self.device, dtype=self.torch_dtype) + weight_lora
[rank0]: RuntimeError: The size of tensor a (57802752) must match the size of tensor b (21504) at non-singleton dimension 0
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 with examples/minimax_h3/model_training/train.py, then trace switch_pipe_to_training_mode in diffsynth/diffusion/training_module.py through load_lora in diffsynth/diffusion/base_pipeline.py. Inspect diffsynth/utils/lora/general.py around line 67 and compare the base and LoRA tensor shapes for the NF4 adapter. Done means the MiniMax H3 NF4 training example can fuse the adapter without the reported size-mismatch error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100