This file contains hidden or 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
''' | |
It supports only SD-v2 models. | |
usage: | |
python simo2kohya.py --unet <simo's unet weight path> --text <simo's text_encoder weight path> --save_to <save path> | |
(--text is optional) | |
This code may no longer be available due to updates from both @kohya-ss and @cloneofsimo. | |
''' |
This file contains hidden or 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
#Put it on stable-diffusion-webui/scripts | |
#Idea:https://twitter.com/Birchlabs/status/1640033271512702977 | |
#Related to https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/9129 | |
import torch | |
import modules.scripts as scripts | |
import gradio as gr | |
from modules.script_callbacks import CFGDenoiserParams, on_cfg_denoiser, CFGDenoisedParams, on_cfg_denoised | |
from modules.processing import StableDiffusionProcessing, process_images |
This file contains hidden or 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
============================================================================================================== | |
Layer (type (var_name)) Input Shape Output Shape | |
============================================================================================================== | |
UNetModel (UNetModel) [1, 4, 64, 64] [1, 4, 64, 64] | |
├─Sequential (time_embed) [1, 320] [1, 1280] | |
│ └─Linear (0) [1, 320] [1, 1280] | |
│ └─SiLU (1) [1, 1280] [1, 1280] | |
│ └─Linear (2) [1, 1280] [1, 1280] | |
├─ModuleList (input_blocks) -- -- | |
│ └─TimestepEmbedSequential (0) [1, 4, 64, 64] [1, 320, 64, 64] |
This file contains hidden or 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 torch | |
import modules.scripts as scripts | |
import gradio as gr | |
from modules.processing import StableDiffusionProcessing, process_images | |
class Script(scripts.Script): | |
def __init__(self): | |
pass |
This file contains hidden or 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 torch | |
import modules.scripts as scripts | |
import gradio as gr | |
from modules.processing import StableDiffusionProcessing, process_images | |
class Script(scripts.Script): | |
def __init__(self): | |
pass |
This file contains hidden or 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
================================================================================================================================================================ | |
Layer (type (var_name)) Input Shape Output Shape Param # Kernel Shape | |
================================================================================================================================================================ | |
SdxlUNet2DConditionModel (SdxlUNet2DConditionModel) [1, 4, 128, 128] [1, 4, 128, 128] -- -- | |
├─Sequential (time_embed) [1, 320] [1, 1280] -- -- | |
│ └─Linear (0) [1, 320] [1, 1280] 410,880 -- | |
│ └─SiLU (1) [1, 1280] [1, 1280] -- |
This file contains hidden or 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
# python convert_lora_sdxl.py <input_file_name> <output_file_name> <sd2diff or diff2sd> | |
import torch | |
from safetensors.torch import load_file | |
from safetensors.torch import save_file | |
import os | |
import argparse | |
def load(file): | |
if os.path.splitext(file)[1] == ".safetensors": |
This file contains hidden or 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 torch | |
import comfy | |
import copy | |
def chunk_or_none(x, chunk_size, index): | |
if x is None: | |
return None | |
return x.chunk(chunk_size, dim=0)[index] | |
def chunk_or_none_for_control(x, chunk_size, index): |
This file contains hidden or 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
''' | |
1. put this file in ComfyUI/custom_nodes | |
2. load node from <loader> | |
''' | |
import torch | |
from comfy.ldm.modules.diffusionmodules.openaimodel import forward_timestep_embed, timestep_embedding, th | |
# https://github.com/ChenyangSi/FreeU | |
def Fourier_filter(x, threshold, scale): |
This file contains hidden or 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 torch | |
import numpy as np | |
from rembg import remove | |
class RembgMask: | |
@classmethod | |
def INPUT_TYPES(s): | |
return { | |
"required": { | |
"image": ("IMAGE", ), |
OlderNewer