This guide uses the diffusers
library to merge checkpoints. It requires checkpoints to be in the diffusers accepted format. If you need to convert original sd checkpoints to diffusers, you can follow this guide.
-
Install dependencies
pip install omegaconf safetensors diffusers transformers torch
-
Download the models you would like to merge. In this example, we'll use one checkpoint from civitai.
wget https://civitai.com/api/download/models/9901 -O 9901.safetensors wget https://civitai.com/api/download/models/6987 -O 6987.safetensors
-
Convert the checkpoint as described in the intro link. For example, if your script is named
convert.py
, do the following:python convert.py --checkpoint_path 9901.safetensors --dump_path refined_checkpoint/ --scheduler_type pndm --from_safetensors python convert.py --checkpoint_path 6987.safetensors --dump_path realistic_vision_v1.3_checkpoint/ --scheduler_type pndm --from_safetensors
-
First let's generate some images with the different models and the same seed to use as a reference.
python generate.py python generate2.py
-
Merge models.
python merge.py