thu-ml / thu-ml/TurboDiffusion
Merge_models.py doesn't merge SLA's proj_l layers?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 277
- Avg merge
- 2h 57m
- Merged PRs (30d)
- 2
Description
After merging models using merge_models.py, I found that I cannot use --attention_type sla or --attention_type sagesla when inferencing with the merged model.
After debugging, I determined that the merged model does not satisfy has_sagesla_weights = any('proj_l' in k for k in state_dict.keys()), meaning the SLA proj_l layers were not merged into the final model.
Looking at the merge logic in merge_models.py, I see that only layers present in both diff_base_sd and diff_target_sd are merged:
if key in diff_base_sd and key in diff_target_sd:
d_base_tensor = diff_base_sd[key] # pretrained
d_target_tensor = diff_target_sd[key] # SLA
My Setup
base:wan2pt1_1pt3B_res480p_t2v_rCM_3000.pthdiff_base:Wan2.1-T2V-1.3B.pth(pretrained Wan2.1 model)diff_target:wan2pt1_1pt3B_res480p_t2v_SLA_4000.pth(SLA fine-tuned model)
Since the pretrained Wan2.1 model (diff_base_sd) doesn't have SLA layers, they cannot be merged with the SLA fine-tuned model.
Questions
- Am I using the wrong
diff_base_sd? - Is
merge_models.pydesigned this way, meaning merged models can only use--attention_type originalfor inference?
Any guidance on how to properly merge models to retain SLA functionality would be greatly appreciated.
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 merge_models.py and inspect the branch that merges keys shared by diff_base_sd and diff_target_sd. Reproduce the merge with the listed Wan2.1 and SLA checkpoints, then inspect the resulting state_dict for proj_l keys and test inference with --attention_type sla or --attention_type sagesla. Done means the merge behavior is clarified or corrected so SLA functionality is retained when the inputs support it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai-infra-agents, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100