Skip to main content

AI Model Dynamic Offloader

This project is a pytorch VRAM allocator that implements on-demand offloading of model weights when the primary pytorch VRAM allocator comes under pressure.

Support:

  • Nvidia GPUs (CUDA) and AMD GPUs (ROCm/HIP)
  • PyTorch 2.8+
  • CUDA 12.8+ (Nvidia) / ROCm 7+ (AMD)
  • Windows 11+ / Linux as per python ManyLinux support

How it works:

  • The pytorch application creates a Virtual Base Address Register (VBAR) for a model. Creating a VBAR doesn't cost any VRAM, only GPU virtual address space (which is pretty much free).
  • The pytorch application allocates tensors for model weights within the VBAR. These tensors are initially un-allocated and will segfault if touched.
  • The pytorch application faults in the tensors using the fault() API at the time the tensor is needed. This is where VRAM actually gets allocated.
If the fault() is successful (sufficient VRAM for this tensor):
  1. If the fault() resultant signature is changed or unknown:
    • The application uses tensor::_copy() to populate the weight data on the GPU.
    • The application saves the returned signature against this weight for future comparison
  2. The layer uses the weight tensor.
  3. The application calls unpin() on the tensor to allow it to be freed under pressure later if needed.
If the fault() is unsuccessful (offloaded weight):
  1. The application allocates a temporary regular GPU tensor.
  2. Uses _copy to populate weight data on the GPU.
  3. The layer uses the temporary as the weight.
  4. Pytorch garbage collects the temp when the layer is finished.

see examples/example.py


Priorities:

  • The most recent VBARs are the highest priority and lower addresses in the VBAR take priority over higher addresses.
  • Applications should order their tensor allocations in the VBAR in load-priority order with the lowest addresses for the highest priority weights.
  • Calling fault() on a weight that is higher priority than other weights will cause those lower priority weights to get freed to make space.
  • Having a weight evicted sets that VBAR's watermark to that weight's level. Any weights in the same VBAR above the watermark automatically fail the fault() API. This avoids constantly faulting in all weights each model iteration while allowing the application to just blindly call fault() every layer and check the results. There is no need for the application to manage any VRAM quotas or watermarks.
  • Existing VBARs can be pushed to top priority with the prioritize() API. This allows use of an already loaded or partially model (e.g. using the same model twice in a complex workflow). Using prioritize resets the offload watermark of that model to no offloading, giving its weights priority over any other currently loaded models.

Backend:

  • VBAR allocation is done with cuMemAddressReserve(), faulting with cuMemCreate() and cuMemMap() and all frees done with appropriate converse APIs.
  • For consistency with VBAR memory management, main pytorch allocator plugin is also implemented with cuMemAddressReserve -> cuMemCreate -> cuMemMap. This also behaves a lot better on Windows systems with System Memory fallback.

On AMD, the equivalent HIP APIs (hipMemAddressReserve -> hipMemCreate -> hipMemMap, and their converse calls) are used throughout via the same flow.

Caveats:

  • There is no real way for this allocator to tell the difference between high usage and bad fragmentation in the pytorch caching allocator. As we always return success to the pytorch caching allocator it experiences no pressure while weights are being offloaded which means it can run in an extremely fragmented mode. The assumption is model weight access patterns are reasonably regular over blocks or iterations and it finds a good set of sizes to cache. What you should generally do though, is completely flush the pytorch caching allocator before each new model run, which avoids completely un-used reservations from taking priority over the next models weights.

Metadata

Release files for comfy-aimdo 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for comfy-aimdo 0.6.1
File Actions
comfy_aimdo-0.6.1-py3-none-any.whl Python 3 none any Details for comfy_aimdo-0.6.1-py3-none-any.whl
comfy_aimdo-0.6.1-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details for comfy_aimdo-0.6.1-cp39-abi3-win_arm64.whl
comfy_aimdo-0.6.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for comfy_aimdo-0.6.1-cp39-abi3-win_amd64.whl
comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Total release size: 1.7 MB

Release files / comfy_aimdo-0.6.1-py3-none-any.whl

Download URL comfy_aimdo-0.6.1-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fb0985542026cb88faa988d6d096479f19664198389a6c4b91861fd9b999e32
BLAKE2b-256 checksum
How to use checksums
b8d4229b0c52d009dfbc37d71f739342948e7df806ea474dc1405ff9fe1eaa77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / comfy_aimdo-0.6.1-cp39-abi3-win_arm64.whl

Download URL comfy_aimdo-0.6.1-cp39-abi3-win_arm64.whl
Size 260.0 kB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
6b4c1e4ac014c95eb40b7bbd0ee4e7efe0a55ec1c6ea7c40a80cc9a15bec6f79
BLAKE2b-256 checksum
How to use checksums
079e146200e9551043e3e87d994973b44dea46e59dbaf7978a74727b55da3234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / comfy_aimdo-0.6.1-cp39-abi3-win_amd64.whl

Download URL comfy_aimdo-0.6.1-cp39-abi3-win_amd64.whl
Size 284.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8ba72f76febc69134817c02b8fb2716e94dc0301560469ae03e1807ba35eddf6
BLAKE2b-256 checksum
How to use checksums
a1fa8695d06273e7aa45eeda8b4d5e14123d389c9bceaf294128393fd2d12f6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 443.0 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f41eb142a360cd7f4b8c01bcdf228c4fe11bc0a13782e593c2efc2e9958254b1
BLAKE2b-256 checksum
How to use checksums
bba1b959d4aa00744cd6b3d704932acd3e56d3282d0981f33ecafcf029993dbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL comfy_aimdo-0.6.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 668.3 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9d5b1a82751d97648c87faedc65898fad8ab5cbc39448210791e933bef469892
BLAKE2b-256 checksum
How to use checksums
5826ced518da3f25302a41cc89e5d7654297f04aba20cc3627ddf5a44c111245
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for comfy-aimdo 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for comfy_aimdo-0.6.1-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.1 This release

5 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page