Registry / ai-ml / comfy-aimdo

comfy-aimdo

JSON →
library0.2.12pypypi✓ verified 35d ago

Comfy AIMDO (AI Model Dynamic Offloader) is a core utility for ComfyUI, acting as a PyTorch VRAM allocator. It implements on-demand offloading of model weights when the primary PyTorch VRAM allocator comes under pressure, aiming to prevent out-of-memory errors and optimize GPU memory usage for AI models. It is currently at version 0.2.12 and is actively maintained as an integral part of the ComfyUI ecosystem.

ai-ml
Install & Compatibility
Where this runs
tested against v0.4.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.049s · 17.9MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.6s · import 0.060s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The primary public API is within the 'control' submodule, not the top-level package.

import comfy_aimdo.control

Comfy AIMDO is a backend VRAM management solution, not typically used directly by end-user Python scripts. Its functionality is integrated into ComfyUI and activated upon launching ComfyUI, often via the `--enable-dynamic-vram` flag. This quickstart demonstrates how to launch ComfyUI to utilize Comfy AIMDO's features. Replace `COMFYUI_PATH` with your actual ComfyUI installation directory.

# 1. Ensure Comfy AIMDO is installed (it's often a dependency of ComfyUI). # pip install comfy-aimdo # 2. Launch ComfyUI with dynamic VRAM management enabled. # Comfy AIMDO operates as a backend, and its functionality is typically activated # by launching ComfyUI with specific flags, rather than direct Python API calls. # This example assumes you have ComfyUI installed and its 'main.py' is runnable. import subprocess import os # Path to your ComfyUI directory comfyui_path = os.environ.get('COMFYUI_PATH', './ComfyUI') # Command to launch ComfyUI with dynamic VRAM (AIMDO) enabled # The --enable-dynamic-vram flag tells ComfyUI to utilize comfy-aimdo if detected command = [ os.path.join(comfyui_path, 'python_env/python.exe') if os.name == 'nt' else os.path.join(comfyui_path, 'venv/bin/python'), os.path.join(comfyui_path, 'main.py'), '--enable-dynamic-vram', '--listen' # Optional: listen on all interfaces ] print(f"Launching ComfyUI with AIMDO: {' '.join(command)}") try: # This will block until ComfyUI exits. For non-blocking, use Popen without .wait() process = subprocess.run(command, check=True, text=True, capture_output=True) print("ComfyUI output:") print(process.stdout) if process.stderr: print("ComfyUI errors (if any):") print(process.stderr) except FileNotFoundError: print(f"Error: ComfyUI or its Python environment not found at {comfyui_path}.") print("Please ensure COMFYUI_PATH environment variable is set correctly or adjust the 'comfyui_path' variable.") except subprocess.CalledProcessError as e: print(f"Error launching ComfyUI: {e}") print("Stderr:") print(e.stderr) print("Stdout:") print(e.stdout) except Exception as e: print(f"An unexpected error occurred: {e}") print("ComfyUI launched (or attempted to launch). Check your browser at http://127.0.0.1:8188 (or specified --listen address).")
Debug
Known footguns
gotchaAfter updating ComfyUI, users frequently encounter `ModuleNotFoundError: No module named 'comfy_aimdo'`. This often happens because ComfyUI's update mechanism might not automatically update or install all its core dependencies in the virtual environment.
breakingDynamic VRAM support via Comfy AIMDO requires PyTorch version 2.8 or later. Using `--enable-dynamic-vram` with older PyTorch versions (e.g., < 2.8) will result in a fallback to legacy `ModelPatcher`, leading to potentially unreliable VRAM estimates and reduced performance benefits, especially on Windows.
gotchaSome users have reported 'Torch Dynamo recompilation issues' or warnings from PyTorch when `comfy-aimdo` is active, leading to temporary disabling of AIMDO for troubleshooting. These issues can be subtle and might relate to specific hardware or PyTorch configurations.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
344 hits · last 30 days
bytedance
12
chatgpt-user
9
ahrefsbot
4
amazonbot
4
oai-searchbot
4
gptbot
3
dotbot
1
script
1
commoncrawl
1
Resources