config: allow setting context length through env var (#8938)

* envconfig: allow setting context length through env var
This commit is contained in:
Parth Sareen 2025-02-24 13:26:35 -08:00 committed by GitHub
parent 4604b10306
commit 314573bfe8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 1 deletions

View file

@ -10,6 +10,8 @@ import (
"strconv"
"strings"
"time"
"github.com/ollama/ollama/envconfig"
)
// StatusError is an error with an HTTP status code and message.
@ -609,7 +611,7 @@ func DefaultOptions() Options {
Runner: Runner{
// options set when the model is loaded
NumCtx: 2048,
NumCtx: int(envconfig.ContextLength()),
NumBatch: 512,
NumGPU: -1, // -1 here indicates that NumGPU should be set dynamically
NumThread: 0, // let the runtime decide