This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
import sys | |
from typing import Sequence, Mapping, Any, Union | |
import torch | |
import gradio as gr | |
from huggingface_hub import hf_hub_download | |
import spaces | |
from comfy import model_management |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |