[PR #5248] [MERGED] cmd: defer stating model info until necessary #16995

Closed
opened 2026-04-16 05:49:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/5248
Author: @bmizerany
Created: 6/24/2024
Status: Merged
Merged: 6/25/2024
Merged by: @bmizerany

Base: mainHead: bmizernay/runnostat


📝 Commits (1)

  • 10cf6ff cmd: defer stating model info until necessary

📊 Changes

2 files changed (+46 additions, -70 deletions)

View changed files

📝 cmd/cmd.go (+33 -32)
📝 cmd/interactive.go (+13 -38)

📄 Description

This commit changes the 'ollama run' command to defer fetching model information until it really needs it. That is, when in interactive mode.

This positively impacts the performance of the command:

; time ./before run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./before run llama3 'hi'  0.02s user 0.01s system 2% cpu 1.168 total
; time ./before run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./before run llama3 'hi'  0.02s user 0.01s system 2% cpu 1.220 total
; time ./before run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./before run llama3 'hi'  0.02s user 0.01s system 2% cpu 1.217 total
; time ./after run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./after run llama3 'hi'  0.02s user 0.01s system 4% cpu 0.652 total
; time ./after run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./after run llama3 'hi'  0.01s user 0.01s system 5% cpu 0.498 total
; time ./after run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with or would you like to chat?

./after run llama3 'hi'  0.01s user 0.01s system 3% cpu 0.479 total
; time ./after run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./after run llama3 'hi'  0.02s user 0.01s system 5% cpu 0.507 total
; time ./after run llama3 'hi'
Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat?

./after run llama3 'hi'  0.02s user 0.01s system 5% cpu 0.507 total

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/5248 **Author:** [@bmizerany](https://github.com/bmizerany) **Created:** 6/24/2024 **Status:** ✅ Merged **Merged:** 6/25/2024 **Merged by:** [@bmizerany](https://github.com/bmizerany) **Base:** `main` ← **Head:** `bmizernay/runnostat` --- ### 📝 Commits (1) - [`10cf6ff`](https://github.com/ollama/ollama/commit/10cf6ff3b43a7d00a05d9a4691e20410bceec674) cmd: defer stating model info until necessary ### 📊 Changes **2 files changed** (+46 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+33 -32) 📝 `cmd/interactive.go` (+13 -38) </details> ### 📄 Description This commit changes the 'ollama run' command to defer fetching model information until it really needs it. That is, when in interactive mode. This positively impacts the performance of the command: ; time ./before run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./before run llama3 'hi' 0.02s user 0.01s system 2% cpu 1.168 total ; time ./before run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./before run llama3 'hi' 0.02s user 0.01s system 2% cpu 1.220 total ; time ./before run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./before run llama3 'hi' 0.02s user 0.01s system 2% cpu 1.217 total ; time ./after run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./after run llama3 'hi' 0.02s user 0.01s system 4% cpu 0.652 total ; time ./after run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./after run llama3 'hi' 0.01s user 0.01s system 5% cpu 0.498 total ; time ./after run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with or would you like to chat? ./after run llama3 'hi' 0.01s user 0.01s system 3% cpu 0.479 total ; time ./after run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./after run llama3 'hi' 0.02s user 0.01s system 5% cpu 0.507 total ; time ./after run llama3 'hi' Hi! It's nice to meet you. Is there something I can help you with, or would you like to chat? ./after run llama3 'hi' 0.02s user 0.01s system 5% cpu 0.507 total --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 05:49:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#16995