mirror of
https://github.com/ollama/ollama.git
synced 2025-05-11 02:16:36 +02:00
Fix use_mmap parsing for modelfiles
Add the new tristate parsing logic for the code path for modelfiles, as well as a unit test.
This commit is contained in:
parent
c7c2f3bc22
commit
7e7749224c
2 changed files with 76 additions and 0 deletions
13
api/types.go
13
api/types.go
|
@ -608,6 +608,19 @@ func FormatParams(params map[string][]string) (map[string]interface{}, error) {
|
|||
} else {
|
||||
field := valueOpts.FieldByName(opt.Name)
|
||||
if field.IsValid() && field.CanSet() {
|
||||
if reflect.PointerTo(field.Type()) == reflect.TypeOf((*TriState)(nil)) {
|
||||
boolVal, err := strconv.ParseBool(vals[0])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid bool value %s", vals)
|
||||
}
|
||||
if boolVal {
|
||||
out[key] = TriStateTrue
|
||||
} else {
|
||||
out[key] = TriStateFalse
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
switch field.Kind() {
|
||||
case reflect.Float32:
|
||||
floatVal, err := strconv.ParseFloat(vals[0], 32)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue