Skip to content

sammcj/gollama

Repository files navigation

Gollama

Gollama is a tool for managing Ollama models.

It provides a TUI (Text User Interface) for listing, inspecting, deleting, copying, and pushing Ollama models as well as optionally linking them to LM Studio.

The application allows users to interactively select models, sort, filter, edit, run, unload and perform actions on them using hotkeys.

Table of Contents

Features

The project started off as a rewrite of my llamalink project, but I decided to expand it to include more features and make it more user-friendly.

It's in active development, so there are some bugs and missing features, however I'm finding it useful for managing my models every day, especially for cleaning up old models.

  • List available models
  • Display metadata such as size, quantisation level, model family, and modified date
  • Edit / update a model's Modelfile
  • Sort models by name, size, modification date, quantisation level, family etc
  • Select and delete models
  • Run and unload models
  • Inspect model for additional details
  • Link models to LM Studio
  • Copy / rename models
  • Push models to a registry
  • Show running models
  • Has some cool bugs

Installation

From go:

go install github.com/sammcj/gollama@HEAD

From Github:

Download the most recent release from the releases page and extract the binary to a directory in your PATH.

e.g. zip -d gollama*.zip -d gollama && mv gollama /usr/local/bin

Usage

To run the gollama application, use the following command:

gollama

Tip: I like to alias gollama to g for quick access:

echo "alias g=gollama" >> ~/.zshrc

Key Bindings

  • Space: Select
  • Enter: Run model (Ollama run)
  • i: Inspect model
  • t: Top (show running models) (Work in progress)
  • D: Delete model
  • e: Edit model new
  • c: Copy model
  • U: Unload all models
  • P: Push model
  • n: Sort by name
  • s: Sort by size
  • m: Sort by modified
  • k: Sort by quantisation
  • f: Sort by family
  • l: Link model to LM Studio
  • L: Link all models to LM Studio
  • r: Rename model (Work in progress)
  • q: Quit

Top

Top (t)

Inspect

Inspect (i)

Command-line Options

  • -l: List all available Ollama models and exit
  • -L: Link all available Ollama models to LM Studio and exit new
  • -s <search term>: Search for models by name new
    • OR operator ('term1|term2') returns models that match either term
    • AND operator ('term1&term2') returns models that match both terms
  • -e <model>: Edit the Modelfile for a model new
  • -ollama-dir: Custom Ollama models directory
  • -lm-dir: Custom LM Studio models directory
  • -cleanup: Remove all symlinked models and empty directories and exit
  • -no-cleanup: Don't cleanup broken symlinks
  • -u: Unload all running models
  • -v: Print the version and exit
Simple model listing

Gollama can also be called with -l to list models without the TUI.

gollama -l

List (gollama -l):

Edit

Gollama can be called with -e to edit the Modelfile for a model.

gollama -e my-model
Search

Gollama can be called with -s to search for models by name.

gollama -s my-model # returns models that contain 'my-model'

gollama -s 'my-model|my-other-model' # returns models that contain either 'my-model' or 'my-other-model'

gollama -s 'my-model&instruct' # returns models that contain both 'my-model' and 'instruct'

Configuration

Gollama uses a JSON configuration file located at ~/.config/gollama/config.json. The configuration file includes options for sorting, columns, API keys, log levels etc...

Example configuration:

{
  "default_sort": "modified",
  "columns": [
    "Name",
    "Size",
    "Quant",
    "Family",
    "Modified",
    "ID"
  ],
  "ollama_api_key": "",
  "ollama_api_url": "http://localhost:11434",
  "lm_studio_file_paths": "",
  "log_level": "info",
  "log_file_path": "/Users/username/.config/gollama/gollama.log",
  "sort_order": "Size",
  "strip_string": "my-private-registry.internal/",
  "editor": "",
  "docker_container": ""
}
  • strip_string can be used to remove a prefix from model names as they are displayed in the TUI. This can be useful if you have a common prefix such as a private registry that you want to remove for display purposes.
  • docker_container - experimental - if set, gollama will attempt to perform any run operations inside the specified container.
  • editor - experimental - if set, gollama will use this editor to open the Modelfile for editing.

Installation and build from source

  1. Clone the repository:

    git clone https://github.com/sammcj/gollama.git
    cd gollama
  2. Build:

    go get
    make build
  3. Run:

    ./gollama

Logging

Logs can be found in the gollama.log which is stored in $HOME/.config/gollama/gollama.log by default. The log level can be set in the configuration file.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

sammcj
Sam
josekasna
Jose Almaraz
jralmaraz
Jose Roberto Almaraz

Acknowledgements

Thank you to folks such as Matt Williams and Fahd Mirza for giving this a shot and providing feedback.

Matt Williams - My favourite way to run Ollama: Gollama Fahd Mirza - Gollama - Manage Ollama Models Locally

License

Copyright © 2024 Sam McLeod

This project is licensed under the MIT License. See the LICENSE file for details.