Skip to content

animatediff lora 微调报错 #287

@JoshonSmith

Description

@JoshonSmith

执行 example的AnimateDiff下面的lora微调脚本 scripts/lora/sft.sh 报错:

验证阶段报错

File "/data/miniconda3/envs/ms-swift/lib/python3.10/site-packages/swift/aigc/animatediff.py", line 557, in animatediff_sft
validation_pipeline = AnimateDiffPipeline(
File "/data/miniconda3/envs/ms-swift/lib/python3.10/site-packages/diffusers/pipelines/animatediff/pipeline_animatediff.py", line 138, in init
unet = UNetMotionModel.from_unet2d(unet, motion_adapter)
File "/data/miniconda3/envs/ms-swift/lib/python3.10/site-packages/diffusers/models/unet_motion_model.py", line 450, in from_unet2d
model.load_motion_modules(motion_adapter)
File "/data/miniconda3/envs/ms-swift/lib/python3.10/site-packages/diffusers/models/unet_motion_model.py", line 483, in load_motion_modules
self.down_blocks[i].motion_modules.load_state_dict(down_block.motion_modules.state_dict())
File "/data/miniconda3/envs/ms-swift/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for ModuleList:
Missing key(s) in state_dict: "0.proj_in.weight", "0.proj_in.bias", "0.transformer_blocks.0.attn1.to_q.weight", "0.transformer_blocks.0.attn1.to_k.weight", "0.transformer_blocks.0.attn1.to_v.weight", "0.transformer_blocks.0.attn1.to_out.0.weight", "0.transformer_blocks.0.attn1.to_out.0.bias", "0.transformer_blocks.0.attn2.to_q.weight", "0.transformer_blocks.0.attn2.to_k.weight", "0.transformer_blocks.0.attn2.to_v.weight", "0.transformer_blocks.0.attn2.to_out.0.weight", "0.transformer_blocks.0.attn2.to_out.0.bias", "0.transformer_blocks.0.ff.net.0.proj.weight", "0.transformer_blocks.0.ff.net.0.proj.bias", "0.transformer_blocks.0.ff.net.2.weight", "0.transformer_blocks.0.ff.net.2.bias", "0.proj_out.weight", "0.proj_out.bias", "1.proj_in.weight", "1.proj_in.bias", "1.transformer_blocks.0.attn1.to_q.weight", "1.transformer_blocks.0.attn1.to_k.weight", "1.transformer_blocks.0.attn1.to_v.weight", "1.transformer_blocks.0.attn1.to_out.0.weight", "1.transformer_blocks.0.attn1.to_out.0.bias", "1.transformer_blocks.0.attn2.to_q.weight", "1.transformer_blocks.0.attn2.to_k.weight", "1.transformer_blocks.0.attn2.to_v.weight", "1.transformer_blocks.0.attn2.to_out.0.weight", "1.transformer_blocks.0.attn2.to_out.0.bias", "1.transformer_blocks.0.ff.net.0.proj.weight", "1.transformer_blocks.0.ff.net.0.proj.bias", "1.transformer_blocks.0.ff.net.2.weight", "1.transformer_blocks.0.ff.net.2.bias", "1.proj_out.weight", "1.proj_out.bias".
Unexpected key(s) in state_dict: "0.proj_in.base_layer.weight", "0.proj_in.base_layer.bias", "0.transformer_blocks.0.attn1.to_q.base_layer.weight", "0.transformer_blocks.0.attn1.to_k.base_layer.weight", "0.transformer_blocks.0.attn1.to_v.base_layer.weight", "0.transformer_blocks.0.attn1.to_out.0.base_layer.weight", "0.transformer_blocks.0.attn1.to_out.0.base_layer.bias", "0.transformer_blocks.0.attn2.to_q.base_layer.weight", "0.transformer_blocks.0.attn2.to_k.base_layer.weight", "0.transformer_blocks.0.attn2.to_v.base_layer.weight", "0.transformer_blocks.0.attn2.to_out.0.base_layer.weight", "0.transformer_blocks.0.attn2.to_out.0.base_layer.bias", "0.transformer_blocks.0.ff.net.0.proj.base_layer.weight", "0.transformer_blocks.0.ff.net.0.proj.base_layer.bias", "0.transformer_blocks.0.ff.net.2.base_layer.weight", "0.transformer_blocks.0.ff.net.2.base_layer.bias", "0.proj_out.base_layer.weight", "0.proj_out.base_layer.bias", "1.proj_in.base_layer.weight", "1.proj_in.base_layer.bias", "1.transformer_blocks.0.attn1.to_q.base_layer.weight", "1.transformer_blocks.0.attn1.to_k.base_layer.weight", "1.transformer_blocks.0.attn1.to_v.base_layer.weight", "1.transformer_blocks.0.attn1.to_out.0.base_layer.weight", "1.transformer_blocks.0.attn1.to_out.0.base_layer.bias", "1.transformer_blocks.0.attn2.to_q.base_layer.weight", "1.transformer_blocks.0.attn2.to_k.base_layer.weight", "1.transformer_blocks.0.attn2.to_v.base_layer.weight", "1.transformer_blocks.0.attn2.to_out.0.base_layer.weight", "1.transformer_blocks.0.attn2.to_out.0.base_layer.bias", "1.transformer_blocks.0.ff.net.0.proj.base_layer.weight", "1.transformer_blocks.0.ff.net.0.proj.base_layer.bias", "1.transformer_blocks.0.ff.net.2.base_layer.weight", "1.transformer_blocks.0.ff.net.2.base_layer.bias", "1.proj_out.base_layer.weight", "1.proj_out.base_layer.bias".

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions