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
362 stars 146 forks source link

ckpt怎么转化为ppdiffusers格式? #245

Open CQxiaocaimi opened 1 year ago

CQxiaocaimi commented 1 year ago

如题,ckpt怎么转化为ppdiffusers格式,相反ppdiffusers格式怎么转化为ckpt格式。 另外训练出的Lora模型怎么和基础模型合并? 还有训练controlnet时,--pretrained_model_name_or_path runwayml/stable-diffusion-v1-5 \这里是填写基础模型,还是要训练的controlnet模型。如果是基础模型的话,假如我想训练controlnet的ip2p,那ip2p模型需要怎么填写,再加入一个pretrained_model_name_or_path?还是其他。 谢谢。

westfish commented 10 months ago

ckpt怎么转化为ppdiffusers可以参考这个 https://github.com/PaddlePaddle/PaddleMIX/blob/develop/ppdiffusers/scripts/convert_diffusers_model/convert_orig_sd_ckpt_to_ppdiffusers.py

ppdiffusers转化为ckpt目前没有提供相关脚本。

Lora可以通过pipe.load_lora_weights和基础模型合并使用。

--pretrained_model_name_or_path runwayml/stable-diffusion-v1-5 \是基础模型。

ip2p或其他controlnet对应unet_name_or_path这个参数,是通过以下方式加载的:

        self.unet = UNet2DConditionModel.from_pretrained(unet_name_or_path)

        freeze_params(self.unet.parameters())
        logger.info("Freeze unet parameters!")

        self.controlnet = ControlNetModel.from_unet(self.unet, load_weights_from_unet=True)