赞
踩
原因是最新版的Diffusers更新之后,利用新训练的LoRA权重做推理时,加载模型的API更新了,需要将原来的
model_path = "预训练的LoRA权重"
pipe = StableDiffusionPipeline.from_pretrained("stable diffusion底模路径",
torch_dtype=torch.float16, safety_checker = None, requires_safety_checker = False)
pipe.unet.load_attn_procs(model_path)
替换为:
pipeline = StableDiffusionPipeline.from_pretrained("stable diffusion底模路径",
torch_dtype=torch.float16, safety_checker = None, requires_safety_checker = False).to("cuda")
pipeline.load_lora_weights("预训练的LoRA权重", weight_name="pytorch_lora_weights.safetensors")
或
pipeline = AutoPipelineForText2Image.from_pretrained("stable diffusion底模路径",
torch_dtype=torch.float16, safety_checker = None, requires_safety_checker = False).to("cuda")
pipeline.load_lora_weights("预训练的LoRA权重", weight_name="pytorch_lora_weights.safetensors")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。