Skip to content

Add model benchmarking and cleanup examples - #716

Open
KhanN-byte wants to merge 1 commit into
ollama:mainfrom
KhanN-byte:model-benchmark
Open

Add model benchmarking and cleanup examples#716
KhanN-byte wants to merge 1 commit into
ollama:mainfrom
KhanN-byte:model-benchmark

Conversation

@KhanN-byte

Copy link
Copy Markdown

What changed

  • Added examples/benchmark.py to compare installed models using median time to first token, total duration, load duration, prompt throughput, and generation throughput.
  • Added optional warm-up runs, reproducible generation settings, selected-model execution, and CSV summary output.
  • Added examples/modelDetection.py to list installed models and their reported storage usage, select models interactively, and remove them after explicit confirmation.
  • Added cancellation defaults, input validation, per-model error handling, and a warning that shared model layers can affect actual freed space.

Why

These examples make it easier to understand local model performance on a particular machine and safely manage disk space used by installed models.

User impact

The changes add standalone examples only and do not alter the Ollama Python client API. Model removal is never performed without the user typing yes at the confirmation prompt.

Validation

  • pytest -q ollama tests: 98 passed
  • ruff check examples/benchmark.py examples/modelDetection.py: passed
  • ruff format --check examples/benchmark.py examples/modelDetection.py: passed
  • python3 -m py_compile examples/benchmark.py examples/modelDetection.py: passed
  • Benchmark smoke-tested against qwen3.5:4b
  • Model manager smoke-tested by listing installed models and cancelling without deletion

@KhanN-byte
KhanN-byte marked this pull request as ready for review August 8, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant