Registry / ai-ml / comfy-aimdo

comfy-aimdo

JSON →
library0.4.15pypypi✓ verified 12d 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.

pip install comfy-aimdo
INSTALL
IMPORT
SIG · COMFY-AIMDO
C
comfy-aimdo
ai-mlpythonv0.4.15
Install
1.6s avg
Import
51ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.15 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.038s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.044s · 19MB
16MB installed
● package 16MB
Code
Verified usage

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

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

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 issues
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.
fix
Manually install or update `comfy-aimdo` within ComfyUI's Python environment (e.g., `path/to/ComfyUI/venv/bin/python -m pip install --upgrade comfy-aimdo` or `path/to/ComfyUI/python_env/python.exe -m pip install --upgrade comfy-aimdo` for portable Windows versions).
affects: All versions when used with ComfyUI updates
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.
fix
Ensure your PyTorch installation is version 2.8 or newer. Update PyTorch if necessary (e.g., `pip install --upgrade torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu1XX` for CUDA).
affects: < 0.2.x (when used with PyTorch < 2.8)
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.
fix
If encountering unexpected PyTorch warnings or recompilation loops, temporarily disable dynamic VRAM by removing the `--enable-dynamic-vram` flag when launching ComfyUI to isolate the issue. Consult ComfyUI and PyTorch documentation/issues for specific workarounds or updates.
affects: Potentially all versions, depending on system configuration
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'comfy_aimdo'
This error occurs because the `comfy-aimdo` package is either not installed or not correctly installed within the Python environment that ComfyUI is using, often after a ComfyUI update introduces it as a new dependency.
fix
Open your ComfyUI directory, navigate to your Python environment (e.g., `venv\Scripts` on Windows or `venv/bin` on Linux/macOS), activate it, and then run `pip install comfy-aimdo` or `python.exe -m pip install comfy-aimdo` (for embedded Python environments) to install the missing package.
comfy-aimdo failed to load: Could not find module '...aimdo.dll' (or one of its dependencies). NOTE: comfy-aimdo is currently only support for Nvidia GPUs.
This error typically indicates that the `aimdo.dll` file or its necessary dependencies are missing, corrupted, or cannot be loaded by the system. It commonly happens on systems with AMD GPUs, as `comfy-aimdo` is primarily designed for Nvidia GPUs, or due to interference from anti-virus software, or general Windows DLL loading issues.
fix
For Nvidia users, ensure a proper installation and temporarily disable anti-virus software to check for interference. For AMD users, `comfy-aimdo` is not officially supported, so the recommended fix is to disable DynamicVRAM by launching ComfyUI with the command-line argument `--disable-dynamic-vram`.
RuntimeError: cuFFT error: CUFFT_INTERNAL_ERROR
This internal cuFFT error can occur when DynamicVRAM, enabled by `comfy-aimdo`, interferes with `cuFFT` operations, particularly with specific models like `big-lama.pt` or workflows that heavily utilize `torch.fft.rfftn`.
fix
To resolve this, launch ComfyUI with the `--disable-dynamic-vram` flag to prevent `comfy-aimdo` from hooking into the memory allocation, or consider rolling back to a ComfyUI version where this specific conflict did not occur.
RuntimeError: CUDA out of memory
Despite `comfy-aimdo`'s VRAM offloading capabilities, this error can still occur, especially on GPUs with limited VRAM (e.g., 8GB), when processing very large models or complex workflows (like LTX Audio-Video model 2.3 with FP8 mixed precision). This can be exacerbated by changes in `comfy-aimdo`'s virtual memory management in newer versions.
fix
Try rolling back to an older, more stable version of `comfy-aimdo` (e.g., 0.2.9) and ComfyUI (e.g., v0.16.0), or explicitly disable dynamic VRAM management by using the `--disable-dynamic-vram` or `--disable-async-offload` command-line flags when launching ComfyUI. Adjusting model precision might also help.
Upgrade
Version history
0.4.15latest on PyPI · released Aug 25, 2026
Audit
Dependencies
torchrequiredCore PyTorch VRAM allocator and model operations.
ComfyUIrequiredComfy AIMDO is designed as a core memory management utility for ComfyUI.
pythonrequiredRequires Python 3.9 or newer.
Agent activity
411 hits · last 30 days
node
384
Amazon
1
Perplexity
1
Resources
comfy-aimdo — pip install comfy-aimdo · libregistry