v2.4.2 - DisTorch Purge VRAM V2 — Ollama Toggle
| EN | 中文 |
This release adds the Ollama toggle on DisTorch Purge VRAM V2 (DisTorchPurgeVRAMV2), placed below HSWQ, for zero-residual purge of Ollama server VRAM used by comfyui-ollama and comfyui-ollama-describer.
Canonical implementation: repository root purge_vram.py (imported by __init__.py). Fallback nodes/purge_vram.py is kept in sync.
Summary
| Item | Detail |
|---|---|
| Node | General Purge VRAM V2 — class id DisTorchPurgeVRAMV2 |
| New UI toggle | Ollama (below HSWQ) |
| Target packs | comfyui-ollama, comfyui-ollama-describer |
| Target memory | External Ollama server GPU/RAM (not in-process PyTorch models in ComfyUI) |
| Goal | GET /api/ps returns no loaded models after purge |
Why this was needed
- Ollama models live in the Ollama daemon, not in ComfyUI
model_management. Standard ComfyUI unload and DistTorch generic purge do not release them. - comfyui-ollama-describer defaults
keep_model_alive=-1, which keeps models loaded indefinitely on the server until explicitly unloaded. HSWQpurge (v2.4.1) targets HSWQ INT8 / PinCache / kitchen residue — a different failure class from Ollama server state.- Without a dedicated path, operators saw: purge node “done” → Task Manager /
nvidia-smistill shows Ollama VRAM → next workflow step conflicts or OOM.
What the Ollama toggle does
When Ollama is enabled on Purge VRAM V2:
1. Discover Ollama server URLs
OLLAMA_HOST/OLLAMA_BASE_URLenvironment variables- Module-level constants on loaded comfyui-ollama / comfyui-ollama-describer packages (
DEFAULT_URL,url,api_host, …) INPUT_TYPES()defaults on describer node classes (api_host,url)- Live
ollama.Clientinstances and Ollama node object fields viagc.get_objects() - Fallback:
http://127.0.0.1:11434,http://localhost:11434
2. Server-side unload loop (per URL, up to 8 rounds)
For each model name reported by GET /api/ps:
POST /api/generatewith empty prompt andkeep_alive: 0(and"0")POST /api/chatwith empty messages andkeep_alive: 0(and"0")ollama.Client.generate/.chatwith the samekeep_alive=0semanticsollama stop <model>CLI when available
Repeat until /api/ps is empty or rounds exhausted. Log FINAL VERIFY OK / FINAL VERIFY FAIL per base URL.
3. Comfy-side state cleanup
- Clear
CHAT_SESSIONSdicts in ollama custom-node modules - Reset class-level
saved_contexton Ollama node classes - Delete files under each pack’s
saved_context/directory (preserves.keep) - Sweep live Ollama node instances: clear
saved_context,messages,context,history,chat_history
4. Completion log
Example summary line:
Ollama: Done — unload_attempts=…, sessions_cleared=…, context_attrs_cleared=…, files_wiped=…, instances_cleared=…, residual=(none)
UI placement
On DisTorchPurgeVRAMV2, enable Ollama together with your other purge toggles as needed. It appears directly under HSWQ in the node UI (see updated screenshot in README).
Related commits (v2.4.1 → v2.4.2)
| Hash | Change |
|---|---|
a69d60d |
Add Ollama toggle under HSWQ |
74b3e4d |
Deepen purge: describer keep_model_alive=-1, multi-URL harvest, /api/ps verify loop |
113fd1a |
README / zh README / changelog / png/pvram2.png |
edde080 |
Changelog release link for v2.4.2 |
Requirements
- Ollama installed and reachable at the harvested URL(s)
- Custom nodes comfyui-ollama and/or comfyui-ollama-describer if you use them in the workflow
- Optional:
ollamaPython package (Client fallback) andollamaCLI onPATHforollama stop
Upgrade
- Update ComfyUI-DistorchMemoryManager to v2.4.2 (or pull
mainat tagv2.4.2). - Restart ComfyUI (or reload custom nodes) so root
purge_vram.pyis imported. - In your workflow, open General Purge VRAM V2 and enable
Ollamawhen you use Ollama-based nodes and need server VRAM reclaimed.
Existing workflows without the toggle unchanged; Ollama defaults to off.