mirror of https://github.com/ollama/ollama.git
Merge 8b878f5d1b
into bc71278670
This commit is contained in:
commit
7e489aae3c
|
@ -835,7 +835,7 @@ func DefaultOptions() Options {
|
||||||
NumBatch: 512,
|
NumBatch: 512,
|
||||||
NumGPU: -1, // -1 here indicates that NumGPU should be set dynamically
|
NumGPU: -1, // -1 here indicates that NumGPU should be set dynamically
|
||||||
NumThread: 0, // let the runtime decide
|
NumThread: 0, // let the runtime decide
|
||||||
UseMMap: nil,
|
UseMMap: envconfig.UseMMap(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,21 @@ func Bool(k string) func() bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BoolPtr(k string) func() *bool {
|
||||||
|
return func() *bool {
|
||||||
|
if s := Var(k); s != "" {
|
||||||
|
b, err := strconv.ParseBool(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &b
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// LogLevel returns the log level for the application.
|
// LogLevel returns the log level for the application.
|
||||||
// Values are 0 or false INFO (Default), 1 or true DEBUG, 2 TRACE
|
// Values are 0 or false INFO (Default), 1 or true DEBUG, 2 TRACE
|
||||||
func LogLevel() slog.Level {
|
func LogLevel() slog.Level {
|
||||||
|
@ -203,6 +218,8 @@ var (
|
||||||
ContextLength = Uint("OLLAMA_CONTEXT_LENGTH", 4096)
|
ContextLength = Uint("OLLAMA_CONTEXT_LENGTH", 4096)
|
||||||
// Auth enables authentication between the Ollama client and server
|
// Auth enables authentication between the Ollama client and server
|
||||||
UseAuth = Bool("OLLAMA_AUTH")
|
UseAuth = Bool("OLLAMA_AUTH")
|
||||||
|
// Set default value for UseMMap
|
||||||
|
UseMMap = BoolPtr("OLLAMA_USE_MMAP")
|
||||||
)
|
)
|
||||||
|
|
||||||
func String(s string) func() string {
|
func String(s string) func() string {
|
||||||
|
@ -289,6 +306,7 @@ func AsMap() map[string]EnvVar {
|
||||||
"OLLAMA_CONTEXT_LENGTH": {"OLLAMA_CONTEXT_LENGTH", ContextLength(), "Context length to use unless otherwise specified (default: 4096)"},
|
"OLLAMA_CONTEXT_LENGTH": {"OLLAMA_CONTEXT_LENGTH", ContextLength(), "Context length to use unless otherwise specified (default: 4096)"},
|
||||||
"OLLAMA_NEW_ENGINE": {"OLLAMA_NEW_ENGINE", NewEngine(), "Enable the new Ollama engine"},
|
"OLLAMA_NEW_ENGINE": {"OLLAMA_NEW_ENGINE", NewEngine(), "Enable the new Ollama engine"},
|
||||||
"OLLAMA_REMOTES": {"OLLAMA_REMOTES", Remotes(), "Allowed hosts for remote models (default \"ollama.com\")"},
|
"OLLAMA_REMOTES": {"OLLAMA_REMOTES", Remotes(), "Allowed hosts for remote models (default \"ollama.com\")"},
|
||||||
|
"OLLAMA_USE_MMAP": {"OLLAMA_USE_MMAP", UseMMap(), "Set default value for use_mmap"},
|
||||||
|
|
||||||
// Informational
|
// Informational
|
||||||
"HTTP_PROXY": {"HTTP_PROXY", String("HTTP_PROXY")(), "HTTP proxy"},
|
"HTTP_PROXY": {"HTTP_PROXY", String("HTTP_PROXY")(), "HTTP proxy"},
|
||||||
|
@ -318,7 +336,15 @@ func AsMap() map[string]EnvVar {
|
||||||
func Values() map[string]string {
|
func Values() map[string]string {
|
||||||
vals := make(map[string]string)
|
vals := make(map[string]string)
|
||||||
for k, v := range AsMap() {
|
for k, v := range AsMap() {
|
||||||
vals[k] = fmt.Sprintf("%v", v.Value)
|
value := v.Value
|
||||||
|
if p, ok := value.(*bool); ok {
|
||||||
|
if p == nil {
|
||||||
|
value = ""
|
||||||
|
} else {
|
||||||
|
value = *p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vals[k] = fmt.Sprintf("%v", value)
|
||||||
}
|
}
|
||||||
return vals
|
return vals
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue