[Refactor] lora: reuse load_weights packed mapping (#991)

Signed-off-by: dongbo910220 <1275604947@qq.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: Jiangyun Zhu <riverclouds.zhu@qq.com>
This commit is contained in:
authored and GitHub committed 2026-03-04 02:58:43 +00:00
1 parent a3240fd484
commit 675c35db97
11 files changed
+70 -42

No files matched your search

@@ -965,13 +965,17 @@ class WanTransformer3DModel(nn.Module):
"""
tp_rank = get_tensor_model_parallel_rank()
tp_size = get_tensor_model_parallel_world_size()
# Stacked params mapping for self-attention QKV fusion
# Stacked params mapping for self-attention QKV fusion.
# Format: (param_name, shard_name, shard_id)
# Note: Only fuse attn1 (self-attention), NOT attn2 (cross-attention)
stacked_params_mapping = [
# self-attention QKV fusion
(".attn1.to_qkv", ".attn1.to_q", "q"),
(".attn1.to_qkv", ".attn1.to_k", "k"),
(".attn1.to_qkv", ".attn1.to_v", "v"),
]
# Expose packed shard mappings for LoRA handling of fused projections.
self.stacked_params_mapping = stacked_params_mapping
# Remap scale_shift_table to new module location
weight_name_remapping = {