Skip to content

Instantly share code, notes, and snippets.

@apolinario
apolinario / convert_diffusers_sdxl_lora_to_webui.py
Created December 30, 2023 02:23
Script for converting a HF Diffusers trained SDXL LoRAs (be it in the old, new or PEFT format) to the Kohya format used by some WebUIs such as AUTOMATIC1111, ComfyUI, SD.Next and others.
# Script for converting a HF Diffusers trained SDXL LoRAs (be it in the old, new or PEFT format)
# To the Kohya format used by some WebUIs such as AUTOMATIC1111, ComfyUI, SD.Next and others.
import argparse
import os
import torch
from safetensors.torch import load_file, save_file
from diffusers.utils import convert_state_dict_to_peft, convert_unet_state_dict_to_peft