Small fixup to template loading

This commit is contained in:
mudler 2023-04-08 11:59:40 +02:00
parent b710147b95
commit 4a932483e1

View File

@ -62,6 +62,7 @@ func (ml *ModelLoader) LoadModel(modelName string, opts ...llama.ModelOption) (*
if _, err := os.Stat(modelBin); os.IsNotExist(err) { if _, err := os.Stat(modelBin); os.IsNotExist(err) {
return nil, err return nil, err
} else { } else {
modelName = fmt.Sprintf("%s.bin", modelName)
modelFile = modelBin modelFile = modelBin
} }
} }
@ -87,7 +88,7 @@ func (ml *ModelLoader) LoadModel(modelName string, opts ...llama.ModelOption) (*
if err != nil { if err != nil {
return nil, err return nil, err
} }
ml.promptsTemplates[modelFile] = tmpl ml.promptsTemplates[modelName] = tmpl
} }
ml.models[modelFile] = model ml.models[modelFile] = model