mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
refactor: Remove unused imports and dependencies from utils, recipe_routes, requirements, and pyproject files. See #278
This commit is contained in:
@@ -37,10 +37,6 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import copy
|
import copy
|
||||||
import folder_paths
|
import folder_paths
|
||||||
import torch
|
|
||||||
import safetensors.torch
|
|
||||||
from diffusers.utils.state_dict_utils import convert_unet_state_dict_to_peft
|
|
||||||
from diffusers.loaders import FluxLoraLoaderMixin
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -69,6 +65,8 @@ def get_loras_list(kwargs):
|
|||||||
|
|
||||||
def load_state_dict_in_safetensors(path, device="cpu", filter_prefix=""):
|
def load_state_dict_in_safetensors(path, device="cpu", filter_prefix=""):
|
||||||
"""Simplified version of load_state_dict_in_safetensors that just loads from a local path"""
|
"""Simplified version of load_state_dict_in_safetensors that just loads from a local path"""
|
||||||
|
import safetensors.torch
|
||||||
|
|
||||||
state_dict = {}
|
state_dict = {}
|
||||||
with safetensors.torch.safe_open(path, framework="pt", device=device) as f:
|
with safetensors.torch.safe_open(path, framework="pt", device=device) as f:
|
||||||
for k in f.keys():
|
for k in f.keys():
|
||||||
@@ -79,6 +77,10 @@ def load_state_dict_in_safetensors(path, device="cpu", filter_prefix=""):
|
|||||||
|
|
||||||
def to_diffusers(input_lora):
|
def to_diffusers(input_lora):
|
||||||
"""Simplified version of to_diffusers for Flux LoRA conversion"""
|
"""Simplified version of to_diffusers for Flux LoRA conversion"""
|
||||||
|
import torch
|
||||||
|
from diffusers.utils.state_dict_utils import convert_unet_state_dict_to_peft
|
||||||
|
from diffusers.loaders import FluxLoraLoaderMixin
|
||||||
|
|
||||||
if isinstance(input_lora, str):
|
if isinstance(input_lora, str):
|
||||||
tensors = load_state_dict_in_safetensors(input_lora, device="cpu")
|
tensors = load_state_dict_in_safetensors(input_lora, device="cpu")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import time
|
|||||||
import base64
|
import base64
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import torch
|
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
@@ -1018,6 +1017,8 @@ class RecipeRoutes:
|
|||||||
shape_info = tensor_image.shape
|
shape_info = tensor_image.shape
|
||||||
logger.debug(f"Tensor shape: {shape_info}, dtype: {tensor_image.dtype}")
|
logger.debug(f"Tensor shape: {shape_info}, dtype: {tensor_image.dtype}")
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
# Convert tensor to numpy array
|
# Convert tensor to numpy array
|
||||||
if isinstance(tensor_image, torch.Tensor):
|
if isinstance(tensor_image, torch.Tensor):
|
||||||
image_np = tensor_image.cpu().numpy()
|
image_np = tensor_image.cpu().numpy()
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ dependencies = [
|
|||||||
"aiohttp",
|
"aiohttp",
|
||||||
"jinja2",
|
"jinja2",
|
||||||
"safetensors",
|
"safetensors",
|
||||||
"diffusers",
|
|
||||||
"watchdog",
|
|
||||||
"beautifulsoup4",
|
"beautifulsoup4",
|
||||||
"piexif",
|
"piexif",
|
||||||
"Pillow",
|
"Pillow",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
aiohttp
|
aiohttp
|
||||||
jinja2
|
jinja2
|
||||||
safetensors
|
safetensors
|
||||||
watchdog
|
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
piexif
|
piexif
|
||||||
Pillow
|
Pillow
|
||||||
@@ -9,7 +8,5 @@ olefile
|
|||||||
requests
|
requests
|
||||||
toml
|
toml
|
||||||
numpy
|
numpy
|
||||||
torch
|
|
||||||
natsort
|
natsort
|
||||||
msgpack
|
msgpack
|
||||||
diffusers>=0.33.1
|
|
||||||
|
|||||||
Reference in New Issue
Block a user