From f36d86ba6db1507814ae11c169a073d1a84d3b4f Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sun, 7 Apr 2024 18:23:47 +0200 Subject: [PATCH] fix(hermes-2-pro-mistral): correct dashes in template to suppress newlines (#1966) Signed-off-by: Ettore Di Giacinto --- aio/cpu/text-to-text.yaml | 21 ++++++++++++--------- aio/gpu-8g/text-to-text.yaml | 21 ++++++++++++--------- aio/intel/text-to-text.yaml | 21 ++++++++++++--------- embedded/models/hermes-2-pro-mistral.yaml | 21 ++++++++++++--------- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/aio/cpu/text-to-text.yaml b/aio/cpu/text-to-text.yaml index 8a20109d..6c4ec9e6 100644 --- a/aio/cpu/text-to-text.yaml +++ b/aio/cpu/text-to-text.yaml @@ -6,12 +6,14 @@ parameters: template: chat_message: | <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} - {{if .Content}}{{.Content}}{{end}} - {{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} + {{- if .FunctionCall }}{{end}} + {{- if eq .RoleName "tool" }}{{end }} + {{- if .Content}} + {{.Content}} + {{- end }} + {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }} + {{- if .FunctionCall }}{{end }} + {{- if eq .RoleName "tool" }}{{end }} <|im_end|> # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling function: | @@ -27,12 +29,13 @@ template: For each function call return a json object with function name and arguments within XML tags as follows: {'arguments': , 'name': } - <|im_end|> - {{.Input}} + + <|im_end|> + {{.Input -}} <|im_start|>assistant chat: | - {{.Input}} + {{.Input -}} <|im_start|>assistant completion: | {{.Input}} diff --git a/aio/gpu-8g/text-to-text.yaml b/aio/gpu-8g/text-to-text.yaml index 9502cdfe..8d5c84f7 100644 --- a/aio/gpu-8g/text-to-text.yaml +++ b/aio/gpu-8g/text-to-text.yaml @@ -6,12 +6,14 @@ parameters: template: chat_message: | <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} - {{if .Content}}{{.Content}}{{end}} - {{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} + {{- if .FunctionCall }}{{end}} + {{- if eq .RoleName "tool" }}{{end }} + {{- if .Content}} + {{.Content}} + {{- end }} + {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }} + {{- if .FunctionCall }}{{end }} + {{- if eq .RoleName "tool" }}{{end }} <|im_end|> # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling function: | @@ -27,12 +29,13 @@ template: For each function call return a json object with function name and arguments within XML tags as follows: {'arguments': , 'name': } - <|im_end|> - {{.Input}} + + <|im_end|> + {{.Input -}} <|im_start|>assistant chat: | - {{.Input}} + {{.Input -}} <|im_start|>assistant completion: | {{.Input}} diff --git a/aio/intel/text-to-text.yaml b/aio/intel/text-to-text.yaml index d2316745..a7cb5b4d 100644 --- a/aio/intel/text-to-text.yaml +++ b/aio/intel/text-to-text.yaml @@ -7,12 +7,14 @@ parameters: template: chat_message: | <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} - {{if .Content}}{{.Content}}{{end}} - {{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} + {{- if .FunctionCall }}{{end}} + {{- if eq .RoleName "tool" }}{{end }} + {{- if .Content}} + {{.Content}} + {{- end }} + {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }} + {{- if .FunctionCall }}{{end }} + {{- if eq .RoleName "tool" }}{{end }} <|im_end|> # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling function: | @@ -28,12 +30,13 @@ template: For each function call return a json object with function name and arguments within XML tags as follows: {'arguments': , 'name': } - <|im_end|> - {{.Input}} + + <|im_end|> + {{.Input -}} <|im_start|>assistant chat: | - {{.Input}} + {{.Input -}} <|im_start|>assistant completion: | {{.Input}} diff --git a/embedded/models/hermes-2-pro-mistral.yaml b/embedded/models/hermes-2-pro-mistral.yaml index eb75b97c..7bfa9418 100644 --- a/embedded/models/hermes-2-pro-mistral.yaml +++ b/embedded/models/hermes-2-pro-mistral.yaml @@ -6,12 +6,14 @@ parameters: template: chat_message: | <|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} - {{if .Content}}{{.Content}}{{end}} - {{if .FunctionCall}}{{toJson .FunctionCall}}{{end}} - {{ if .FunctionCall }}{{end}} - {{ if eq .RoleName "tool" }}{{end}} + {{- if .FunctionCall }}{{end}} + {{- if eq .RoleName "tool" }}{{end }} + {{- if .Content}} + {{.Content}} + {{- end }} + {{- if .FunctionCall}}{{toJson .FunctionCall}}{{end }} + {{- if .FunctionCall }}{{end }} + {{- if eq .RoleName "tool" }}{{end }} <|im_end|> # https://huggingface.co/NousResearch/Hermes-2-Pro-Mistral-7B-GGUF#prompt-format-for-function-calling function: | @@ -27,12 +29,13 @@ template: For each function call return a json object with function name and arguments within XML tags as follows: {'arguments': , 'name': } - <|im_end|> - {{.Input}} + + <|im_end|> + {{.Input -}} <|im_start|>assistant chat: | - {{.Input}} + {{.Input -}} <|im_start|>assistant completion: | {{.Input}}