Skip to content

Instantly share code, notes, and snippets.

diff --git a/comfy/lora.py b/comfy/lora.py
index 8760a21f..e6456509 100644
--- a/comfy/lora.py
+++ b/comfy/lora.py
@@ -44,6 +44,12 @@ def load_lora(lora, to_load, log_missing=True):
alpha = lora[alpha_name].item()
loaded_keys.add(alpha_name)
+ aid_p_name = "{}.aid_p".format(x)
+ aid_p = None
#!/usr/bin/env python
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Install dependencies
#
# python -m venv venv
# source ./venv/bin/activate # linux
# call ./venv/scripts/Activate.bat # windows?
#
# pip install transformers peft datasets
#
# Use the PyTorch instructions for your machine:
# [Get started — PyTorch](https://pytorch.org/get-started/locally/)
import argparse
import torch
from safetensors.torch import load_file, safe_open
from library import model_util
def load_state_dict(file_name, dtype):
if model_util.is_safetensors(file_name):
# Copyright © 2023 Dave Lage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE U
import torch
from datasets import Dataset, Image, load_dataset
from torchmetrics.image.fid import FrechetInceptionDistance
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
from torchvision import transforms
import random
from matplotlib import pyplot as plt
import argparse
from pathlib import Path
import numpy
from torchmetrics.functional.multimodal import clip_score
from functools import partial
import torch
from datasets import load_dataset
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
import random
from pathlib import Path
import argparse
import numpy
# Original from https://gist.github.com/Poiuytrezay1/db6b98672675456bed39d45077d44179
# Credit to Poiuytrezay1
import argparse
import os
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
# Original from https://gist.github.com/Poiuytrezay1/db6b98672675456bed39d45077d44179
# Credit to Poiuytrezay1
import argparse
import os
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
import argparse
import os
from collections import defaultdict
from pathlib import Path
import numpy as np
import torch
import tqdm
from PIL import Image
from torchvision import transforms