fix(create_hook_lora): lazy import comfy.hooks/comfy.utils to fix CI pipeline (#744)

This commit is contained in:
Will Miao
2026-07-21 18:44:04 +08:00
parent cf64043f7d
commit a9dbb15ffa

View File

@@ -9,9 +9,6 @@ from __future__ import annotations
import logging
import os
import comfy.hooks # type: ignore
import comfy.utils # type: ignore
from ..utils.utils import get_lora_info_absolute
from .utils import (
FlexibleOptionalInputType,
@@ -59,6 +56,10 @@ class CreateHookLoraLM:
"""
del text # used by the frontend widget only
# Lazy imports: comfy is not available in CI/test environment at module level
import comfy.hooks # type: ignore # noqa: C0415
import comfy.utils # type: ignore # noqa: C0415
prev_hooks: comfy.hooks.HookGroup | None = kwargs.get("prev_hooks")
hook_group = prev_hooks.clone() if prev_hooks is not None else comfy.hooks.HookGroup()