pkeffect
@pkeffect
πŸ‡ΊπŸ‡Έ
Β·
1 年前
Β·
1 年前
Ollama Model Unload
Last Updated
1 年前
Created
1 年前
Function
action
v0.0.5
Name
Ollama Model Unload
Downloads
1.2K+
Saves
8+
Description
Creates a button to instantly unload Ollama model(s) that are running in vRAM.

πŸš€ Ollama Model Unloader

Ollama Model Unloader

A powerful Open WebUI extension that helps you free up system resources by unloading Ollama models when they're not in use.

πŸ“‹ Overview

Ollama Model Unloader is a simple but effective tool that allows you to unload AI models from memory with just a click. This is particularly useful when:

  • You need to free up RAM or VRAM on your system
  • You want to switch between different models without restarting Ollama
  • You're experiencing system slowdowns due to multiple loaded models

✨ Features

  • πŸ–₯️ Works with both local and remote Ollama hosts
  • πŸ” Automatically searches multiple locations for Ollama servers
  • πŸ”Œ Supports custom port configurations
  • πŸ“Š Displays real-time progress and results
  • πŸ”„ Automatically collapses output panel when finished (configurable)
  • πŸ›‘οΈ Robust error handling for a smooth experience

βš™οΈ Configuration Options

You can customize the behavior of the Ollama Model Unloader through the following settings:

SettingDescriptionDefault Value
OLLAMA_HOSTSList of Ollama host IPs or hostnames to connect to["localhost", "127.0.0.1", "ollama", "host.docker.internal"]
OLLAMA_PORTPort number for Ollama API11434
WAIT_BETWEEN_UNLOADSSeconds to wait between model unloads0
AUTO_CLOSE_OUTPUTWhether to automatically close/collapse output when finishedTrue
AUTO_CLOSE_DELAYSeconds to wait before automatically closing output3

⚠️ Important Notes

  • Unloading models might not instantly release system RAM if models have spilled over from VRAM. Monitor your system resources.
  • High CPU usage might persist temporarily after unloading if system RAM is heavily utilized.
  • Avoid unloading models while they are actively generating text to prevent potential issues.
  • If issues persist after unloading, consider restarting your Ollama service manually.
  • For remote Ollama instances, ensure the Ollama API is accessible over your network and that any necessary firewalls are configured to allow connections.

πŸ“¦ Installation

  1. In Open WebUI, navigate to the Extensions panel
  2. Find "Ollama Model Unloader" in the community extensions
  3. Click "Install"
  4. The tool will now appear in your toolbar for easy access

πŸ“ Changelog

  • 0.0.5 - Added more error handling and support for remote Ollama servers
  • 0.0.4 - Refactor
  • 0.0.3 - Added error reporting and better checks
  • 0.0.2 - Added status and progress
  • 0.0.1 - Initial upload to openwebui community

πŸ”§ How It Works

When activated, the tool:

  1. Searches for Ollama servers on the configured hosts and port
  2. Gets a list of all currently running models
  3. Sends an API request to unload each model by setting keep_alive to 0
  4. Verifies that models are properly unloaded
  5. Provides status updates throughout the process

πŸ’» Technical Details

The unloader works by making HTTP requests to the Ollama API. Specifically, it:

  • Uses GET /api/ps to find running models
  • Uses POST /api/generate with keep_alive: 0 to unload models
  • Includes comprehensive error handling for network issues, API errors, and unexpected scenarios

πŸ‘¨β€πŸ’» Author

Developed by pkeffect

πŸ”— Links

πŸ“„ License

This project is licensed under the MIT License


Required Open WebUI Version: 0.6.0 or higher


1