From 421c9b88ae7acfc6560fcc2fb10bdb14e0fa6bb8 Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Wed, 10 Sep 2025 16:36:03 -0700 Subject: [PATCH] Fix import order --- comfy/lora_types.py | 4 ++-- comfy/utils.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/comfy/lora_types.py b/comfy/lora_types.py index 631bcf87c..c08006467 100644 --- a/comfy/lora_types.py +++ b/comfy/lora_types.py @@ -1,5 +1,5 @@ from __future__ import annotations -from typing import Protocol, List, Dict, Optional, NamedTuple, Callable, Literal, Any +from typing import Protocol, List, Dict, Optional, NamedTuple, Callable, Literal, Any, TypeAlias, Union import torch PatchOffset = tuple[int, int, int] @@ -28,7 +28,7 @@ class PatchTuple(NamedTuple): function: PatchFunction -ModelPatchesDictValue = list[PatchTuple | PatchWeightTuple] +ModelPatchesDictValue: TypeAlias = list[Union[PatchTuple, PatchWeightTuple]] class PatchSupport(Protocol): diff --git a/comfy/utils.py b/comfy/utils.py index 04385ff5a..7e5d72104 100644 --- a/comfy/utils.py +++ b/comfy/utils.py @@ -50,7 +50,6 @@ from .component_model.deprecation import _deprecate_method from .component_model.executor_types import ExecutorToClientProgress, ProgressMessage from .component_model.tqdm_watcher import TqdmWatcher from .execution_context import current_execution_context -from .gguf import gguf_sd_loader MMAP_TORCH_FILES = args.mmap_torch_files DISABLE_MMAP = args.disable_mmap @@ -136,6 +135,8 @@ def load_torch_file(ckpt: str, safe_load=False, device=None, return_metadata=Fal sd.update(safetensors.torch.load_file(str(checkpoint_file), device=device.type)) elif ckpt.lower().endswith(".gguf"): # from gguf + # avoiding circular imports here by importing it lazily + from .gguf import gguf_sd_loader sd = gguf_sd_loader(ckpt) metadata = {"format": "gguf"} else: