Comfy-Org / Comfy-Org/ComfyUI

Cache up to X models with automatic LRU unloading

Open
#11,930 2 comments 0 reactions 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Feature Idea

Would it be possible to add a setting like “Cache up to X models” in ComfyUI, where only a limited number of models are kept in memory at once, and when the limit is reached, the system automatically unloads the least recently used model and replaces it with the newly requested one?

I’m aware that cache-lru exists, but it applies at the node level rather than specifically to model handling, which makes it less effective for controlling VRAM/RAM usage when frequently switching between large models.

A model-focused LRU cache would give users more predictable memory control, reduce OOM errors, and improve workflow efficiency when working with multiple checkpoints, LoRAs, or diffusion models in a single session.

### Existing Solutions

_No response_

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.