Skip to content

nunchaku_patch.py imports torch at module level, triggering ComfyUI startup warning #53

Description

@LacklusterOpsec

patches/nunchaku_patch.py line 9 does import torch at module level.
This file is loaded during ComfyUI's prestartup phase (via prestartup_script.py),
which causes the guard at main.py:225 to fire:

WARNING: Potential Error in code: Torch already imported, torch should never be imported before this point.

Fix: move import torch inside the functions that need it, and use
from __future__ import annotations so type hints don't require torch at
module load time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions