mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-20 15:32:32 +08:00
Merge 8705579536 into 138571da95
This commit is contained in:
commit
d31676d377
36
main.py
36
main.py
@ -31,7 +31,41 @@ setup_logger(log_level=args.verbose, use_stdout=args.log_stdout)
|
|||||||
|
|
||||||
faulthandler.enable(file=sys.stderr, all_threads=False)
|
faulthandler.enable(file=sys.stderr, all_threads=False)
|
||||||
|
|
||||||
import comfy_aimdo.control
|
try:
|
||||||
|
import comfy_aimdo.control
|
||||||
|
except ImportError:
|
||||||
|
logging.info("comfy-aimdo not installed. DynamicVRAM will not be available.")
|
||||||
|
import types
|
||||||
|
|
||||||
|
class _AimdoStub:
|
||||||
|
"""No-op stub for comfy_aimdo submodules when the package is not installed.
|
||||||
|
|
||||||
|
All attribute accesses return self and all calls return False (falsy),
|
||||||
|
which prevents any aimdo-guarded code paths from activating while still
|
||||||
|
allowing the import to succeed on non-NVIDIA hardware (e.g. AMD/ROCm).
|
||||||
|
"""
|
||||||
|
def __getattr__(self, name):
|
||||||
|
return _AimdoStub()
|
||||||
|
|
||||||
|
def __call__(self, *args, **kwargs):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def __bool__(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def __float__(self):
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
_aimdo_pkg = types.ModuleType('comfy_aimdo')
|
||||||
|
for _submod_name in ('control', 'model_vbar', 'torch', 'host_buffer', 'model_mmap'):
|
||||||
|
_stub = _AimdoStub()
|
||||||
|
setattr(_aimdo_pkg, _submod_name, _stub)
|
||||||
|
sys.modules[f'comfy_aimdo.{_submod_name}'] = _stub
|
||||||
|
sys.modules['comfy_aimdo'] = _aimdo_pkg
|
||||||
|
import comfy_aimdo # Now resolves to the stub from sys.modules
|
||||||
|
|
||||||
if enables_dynamic_vram():
|
if enables_dynamic_vram():
|
||||||
comfy_aimdo.control.init()
|
comfy_aimdo.control.init()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user