Lora参数融合后保存模型导入报错

pipe = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16).to("cuda")
pipe.load_lora_weights("lora.safetensors")

pipe.save_pretrained("model")

这样会带来错误:

ValueError: Cannot load <class 'diffusers.models.unets.unet_2d_condition.UNet2DConditionModel'> from hypersd/unet because the following keys are missing: 
 down_blocks.2.attentions.1.transformer_blocks.0.attn2.to_q.weight, down_blocks.3.resnets.1.conv1.weight, down_blocks.3.resnets.0.conv2.weight, up_blocks.3.attentions.0.transformer_blocks.0.attn1.to_k.weight, up_blocks.1.resnets.2.conv1.weight, up_blocks.2.attentions.1.transformer_blocks.0.ff.net.0.proj.bias, up_blocks.0.resnets.1.conv_shortcut.bias, up_blocks.3.attentions.2.transformer_blocks.

因为lora参数还没真正融合,要先

pipe.unload_lora_weights()

再保存,就保存lora参数和pipe融合的版本了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值