userx
@userx
·
a year ago
·
a year ago
Unload Models from VRAM
Last Updated
a year ago
Created
a year ago
Function
action
v1.1.2
Name
Unload Models from VRAM
Downloads
407+
Saves
1+
Description
Unloads all models from VRAM using Ollama's REST API.

Unload Models from VRAM

Welcome to the Unload Models from VRAM function for Open‑WebUI!
This streamlined tool effortlessly frees GPU memory by unloading models through Ollama’s REST API. If your VRAM feels a bit crowded, clear it out with a single click—think of it as spring‑cleaning for your digital workspace. 😉


Overview

This function:

  • Retrieves Loaded Models: Calls /api/ps to list models currently in VRAM.
  • Unloads Each Model: Sends a POST to /api/generate (prompt:"", keep_alive:0, stream:false) for every model found.
  • One‑Click Action: Just hit the “Unload Models from VRAM” button—no extra confirmation screens.
  • Configurable Settings: Endpoint URL, time‑outs, SSL verification, delay, and logging level are all adjustable.
  • Robust Error Handling: Clear emitter messages and detailed logs help you troubleshoot misconfigurations, time‑outs, or connection issues.
  • Progress Feedback: Real‑time status updates (with a progress bar) keep you informed while each model unloads.

Features

FeatureDescription
REST API IntegrationSeamlessly interacts with Ollama’s API.
Configurable Endpoint & Time‑outDefaults: http://host.docker.internal:11434, 3 s.
SSL Verification ToggleVERIFY_SSL valve lets you enable or disable TLS cert checks.
Adjustable Logging LevelDEBUG, INFO, WARNING, ERROR, CRITICAL.
Selective UnloadPass a models list in the request body to unload just one or two heavyweights.
Delay Between UnloadsOptional (default 200 ms) delay ensures the UI renders progress nicely.
Graceful Error HandlingConcise user messages + verbose logs when you need them.
Asynchronous OperationNon‑blocking design keeps the chat UI responsive.

Configuration

ValveDefaultPurpose
OLLAMA_ENDPOINThttp://host.docker.internal:11434Base URL of the Ollama REST API.
REQUEST_TIMEOUT3 secondsHTTP request time‑out.
UNLOAD_DELAY_MS200Wait time between model unloads (set 0 for maximum speed).
VERIFY_SSLtrueToggle TLS certificate verification.
LOG_LEVELINFOLogging verbosity.
  • Version: 1.1.2
  • Required Open‑WebUI Version: 0.6.0


0