mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-02 16:53:17 +00:00
feat(guesser): add gemma2 (#3118)
* feat(guesser): add gemma2 Signed-off-by: Sertac Ozercan <sozercan@gmail.com> * update Signed-off-by: Sertac Ozercan <sozercan@gmail.com> --------- Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
This commit is contained in:
parent
8f0bf9810a
commit
d1a123954b
@ -26,15 +26,17 @@ const (
|
|||||||
type settingsConfig struct {
|
type settingsConfig struct {
|
||||||
StopWords []string
|
StopWords []string
|
||||||
TemplateConfig TemplateConfig
|
TemplateConfig TemplateConfig
|
||||||
|
RepeatPenalty float64
|
||||||
}
|
}
|
||||||
|
|
||||||
// default settings to adopt with a given model family
|
// default settings to adopt with a given model family
|
||||||
var defaultsSettings map[familyType]settingsConfig = map[familyType]settingsConfig{
|
var defaultsSettings map[familyType]settingsConfig = map[familyType]settingsConfig{
|
||||||
Gemma: {
|
Gemma: {
|
||||||
|
RepeatPenalty: 1.0,
|
||||||
StopWords: []string{"<|im_end|>", "<end_of_turn>", "<start_of_turn>"},
|
StopWords: []string{"<|im_end|>", "<end_of_turn>", "<start_of_turn>"},
|
||||||
TemplateConfig: TemplateConfig{
|
TemplateConfig: TemplateConfig{
|
||||||
Chat: "{{.Input }}\n<|start_of_turn|>model\n",
|
Chat: "{{.Input }}\n<start_of_turn>model\n",
|
||||||
ChatMessage: "<|start_of_turn|>{{if eq .RoleName \"assistant\" }}model{{else}}{{ .RoleName }}{{end}}\n{{ if .Content -}}\n{{.Content -}}\n{{ end -}}<|end_of_turn|>",
|
ChatMessage: "<start_of_turn>{{if eq .RoleName \"assistant\" }}model{{else}}{{ .RoleName }}{{end}}\n{{ if .Content -}}\n{{.Content -}}\n{{ end -}}<end_of_turn>",
|
||||||
Completion: "{{.Input}}",
|
Completion: "{{.Input}}",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -192,6 +194,9 @@ func guessDefaultsFromFile(cfg *BackendConfig, modelPath string) {
|
|||||||
if len(cfg.StopWords) == 0 {
|
if len(cfg.StopWords) == 0 {
|
||||||
cfg.StopWords = settings.StopWords
|
cfg.StopWords = settings.StopWords
|
||||||
}
|
}
|
||||||
|
if cfg.RepeatPenalty == 0.0 {
|
||||||
|
cfg.RepeatPenalty = settings.RepeatPenalty
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Debug().Any("family", family).Msgf("guessDefaultsFromFile: no template found for family")
|
log.Debug().Any("family", family).Msgf("guessDefaultsFromFile: no template found for family")
|
||||||
}
|
}
|
||||||
@ -219,7 +224,7 @@ func identifyFamily(f *gguf.GGUFFile) familyType {
|
|||||||
commandR := arch == "command-r" && eosTokenID == 255001
|
commandR := arch == "command-r" && eosTokenID == 255001
|
||||||
qwen2 := arch == "qwen2"
|
qwen2 := arch == "qwen2"
|
||||||
phi3 := arch == "phi-3"
|
phi3 := arch == "phi-3"
|
||||||
gemma := strings.HasPrefix(f.Model().Name, "gemma")
|
gemma := strings.HasPrefix(arch, "gemma") || strings.Contains(strings.ToLower(f.Model().Name), "gemma")
|
||||||
deepseek2 := arch == "deepseek2"
|
deepseek2 := arch == "deepseek2"
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user