PaddlePaddle / PaddleMIX

Paddle Multimodal Integration and eXploration, supporting mainstream multi-modal tasks, including end-to-end large-scale multi-modal pretrain models and diffusion model toolbox. Equipped with high performance and flexibility.
Apache License 2.0
242 stars 102 forks source link

inpaint是否能使用lora #460

Open guzichen opened 3 months ago

guzichen commented 3 months ago

在Inpait中使用lora报错 pipe = StableDiffusionInpaintPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", safety_checker=None) pipe.load_lora_weights("./",weight_name="lora.safetensors",from_diffusers=True) pipe.fuse_lora()

错误信息: 'StableDiffusionInpaintPipeline' object has no attribute 'fuse_lora'

如何在inpaint中使用lora?

软件版本: paddle 2.5.2 ppdiffusers 0.19.4

JunnYu commented 3 months ago

0.19.4版本中不包含 fuse_lora 这个接口,现在的develop分支需要配合 USE_PEFT_BACKEND = True的环境变量才可以使用。

# 设置环境变量 USE_PEFT_BACKEND
import os
os.environ["USE_PEFT_BACKEND"] = "True"
from ppdiffusers import StableDiffusionInpaintPipeline

pipe = StableDiffusionInpaintPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", safety_checker=None)
pipe.load_lora_weights("./",weight_name="lora.safetensors",from_diffusers=True)
pipe.fuse_lora()