Skip to main content

'''# Ollama Benchmark Tool

This tool provides a comprehensive benchmarking suite for Ollama models, allowing you to measure their performance on your specific hardware. It automates the process of setting up Ollama (if not already present), pulling models, running various benchmark tasks, and collecting detailed system information.

Features

  • Automated Ollama Management: Automatically checks for Ollama installation, downloads and installs it if missing, and ensures the Ollama server is running.
  • Ollama Version Detection: Automatically detects and reports the exact Ollama version used for the benchmark.
  • Model Quantization Detection: Captures the specific quantization level of the model (e.g., gemma3:1b-q4_0) as this impacts performance and memory footprint.
  • Model Pulling: Seamlessly pulls specified Ollama models before benchmarking.
  • Performance Metrics: Measures key performance indicators such as:
    • Tokens per second (TPS): Overall, prompt evaluation, and response generation.
    • Time to First Token (TTFT): Latency for the first token generation.
  • System Information Collection: Gathers detailed hardware information (CPU, RAM, GPU, OS, device model) to provide context for benchmark results.
  • Extensible Benchmark Tasks: Comes with a set of predefined benchmark tasks and is designed to be easily extensible with new tasks.

Installation

You can install the ollamabench package using pip:

pip install .

Usage

To run a benchmark for a specific Ollama model, use the following command:

python -m ollamabench.benchmark_runner <model_name> [--warmup-runs <number_of_runs>]
  • <model_name>: The Ollama model to benchmark (e.g., gemma3:1b, llama2).
  • --warmup-runs <number_of_runs>: (Optional) Number of warm-up runs before actual benchmarking. Defaults to 1.

After the benchmark completes, you will be prompted to upload the results to the Ollama Benchmark API. Pressing Enter (or typing 'y'/'yes') will upload the results, while typing 'n'/'no' will skip the upload.

Example

python -m ollamabench.benchmark_runner gemma3:1b --warmup-runs 3

The benchmark results, including system information, Ollama version, model details, and task-specific metrics, will be printed to the console.

Project Structure

  • src/ollamabench/benchmark_runner.py: The main script to run the benchmark.
  • src/ollamabench/ollama_manager.py: Handles Ollama installation, server management, version detection, and model pulling.
  • src/ollamabench/sys_info.py: Collects detailed system hardware information.
  • src/ollamabench/benchmark_tasks.py: Defines the benchmark tasks.
  • src/ollamabench/result_formatter.py: (If applicable) Formats the benchmark results.
  • src/ollamabench/submission_client.py: (If applicable) Handles submission of results.

Dependencies

The project relies on the following Python libraries:

  • ollama: Python client for Ollama.
  • psutil: For system and process utilities.
  • requests: For making HTTP requests (e.g., to Ollama API, GitHub API).
  • wmi (Windows only): For Windows Management Instrumentation.
  • pynvml (Windows/Linux, optional): For NVIDIA GPU monitoring.

These dependencies are automatically installed when you install the package using pip. ''

Release files for ollamabench 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ollamabench 0.2.0
File Size Uploaded
ollamabench-0.2.0.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ollamabench 0.2.0
File Interpreter ABI Platform
ollamabench-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.6 kB

Release files / ollamabench-0.2.0.tar.gz

Download URL ollamabench-0.2.0.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ec294f8ba7a9e8c1402265a66d542fd2d2f8e6a84c89dd6368b4d24c733e0822
BLAKE2b-256 checksum
How to use checksums
83d5a11b28ecb5611822310fdefece89f75f59b73cbe0b427ff00d508383f2ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / ollamabench-0.2.0-py3-none-any.whl

Download URL ollamabench-0.2.0-py3-none-any.whl
Size 21.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae7db383f7ab6cf48ce821d8194f0f4eb0af86bea6d6bda5a04b991e2f50e07e
BLAKE2b-256 checksum
How to use checksums
81d002ac24357f9417b2f909914155cfd6a9bedcb3298f7ab1f9cb979b83bcd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page