Skip to content

Instantly share code, notes, and snippets.

@deltheil
Last active October 2, 2023 08:29
Show Gist options
  • Save deltheil/0e55b1b625e0b292239e9e42a69d9d4e to your computer and use it in GitHub Desktop.
Save deltheil/0e55b1b625e0b292239e9e42a69d9d4e to your computer and use it in GitHub Desktop.
IP-Adapter Plus with Refiners: prerequisites
# IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models
# https://github.com/tencent-ailab/IP-Adapter
# (1) Install (see also https://github.com/finegrain-ai/refiners#install)
git clone https://github.com/finegrain-ai/refiners.git
cd refiners
poetry install --all-extras
poetry run pip install --upgrade torch torchvision
# (2) Convert weights into Refiners format
poetry shell
python scripts/conversion/convert_transformers_clip_text_model.py --from "SG161222/Realistic_Vision_V4.0_noVAE" --to clip_text.safetensors --half
python scripts/conversion/convert_diffusers_unet.py --from "SG161222/Realistic_Vision_V4.0_noVAE" --to unet.safetensors --half
python scripts/conversion/convert_diffusers_autoencoder_kl.py --from "stabilityai/sd-vae-ft-mse" --to lda.safetensors --subfolder "" --half
python scripts/conversion/convert_transformers_clip_image_model.py --to clip_image.safetensors --half
curl -LO https://huggingface.co/h94/IP-Adapter/resolve/main/models/ip-adapter-plus_sd15.bin
python scripts/conversion/convert_diffusers_ip_adapter.py --from ip-adapter-plus_sd15.bin --half
# (3) Download demo image for IP-Adapter Plus
curl -O https://raw.githubusercontent.com/tencent-ailab/IP-Adapter/main/assets/images/statue.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment