From 1f4e66d63816efe9ed2c917f8c119a5289b8d01d Mon Sep 17 00:00:00 2001 From: Maximilian Kenfenheuer Date: Wed, 29 Jan 2025 10:19:48 +0100 Subject: [PATCH] chore(model gallery): add specific message templates for llama3.2 based models (#4707) * chore(model gallery): add specific message templates for llama3.2 based models Signed-off-by: Maximilian Kenfenheuer * fix: yaml lint in llama3.2-quantized.yaml Signed-off-by: Maximilian Kenfenheuer * fix: yaml lint in llama3.2-quantized.yaml Signed-off-by: Maximilian Kenfenheuer --------- Signed-off-by: Maximilian Kenfenheuer --- gallery/index.yaml | 2 +- gallery/llama3.2-quantized.yaml | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 gallery/llama3.2-quantized.yaml diff --git a/gallery/index.yaml b/gallery/index.yaml index 5e081b98..1716f2b1 100644 --- a/gallery/index.yaml +++ b/gallery/index.yaml @@ -839,7 +839,7 @@ sha256: bac8e8c1d1d9d53cbdb148b8ff9ad378ddb392429207099e85b5aae3a43bff3d uri: huggingface://cstr/salamandra-7b-instruct-GGUF/salamandra-7b-instruct.Q4_K_M-f32.gguf - &llama32 ## llama3.2 - url: "github:mudler/LocalAI/gallery/llama3.1-instruct.yaml@master" + url: "github:mudler/LocalAI/gallery/llama3.2-quantized.yaml@master" icon: https://avatars.githubusercontent.com/u/153379578 license: llama3.2 description: | diff --git a/gallery/llama3.2-quantized.yaml b/gallery/llama3.2-quantized.yaml new file mode 100644 index 00000000..7e1d2630 --- /dev/null +++ b/gallery/llama3.2-quantized.yaml @@ -0,0 +1,55 @@ +--- +name: "llama3.2-quantized" + +config_file: | + mmap: true + function: + disable_no_action: true + grammar: + disable: true + response_regex: + - \[(?P\w+)\((?P.*)\)\] + argument_regex: + - (?P[^ '\(=,]+)[='"]+(?P[^=,"']+)['"]? + template: + chat: | + <|begin_of_text|><|start_header_id|>system<|end_header_id|> + You are a helpful assistant<|eot_id|><|start_header_id|>user<|end_header_id|> + {{.Input }} + <|start_header_id|>assistant<|end_header_id|> + chat_message: | + <|start_header_id|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "tool"}}tool{{else if eq .RoleName "user"}}user{{end}}<|end_header_id|> + {{ if .FunctionCall -}} + {{ else if eq .RoleName "tool" -}} + The Function was executed and the response was: + {{ end -}} + {{ if .Content -}} + {{.Content -}} + {{ else if .FunctionCall -}} + {{ range .FunctionCall }} + [{{.FunctionCall.Name}}({{.FunctionCall.Arguments}})] + {{ end }} + {{ end -}} + <|eot_id|> + completion: | + {{.Input}} + function: | + <|start_header_id|>system<|end_header_id|> + You are an expert in composing functions. You are given a question and a set of possible functions. + Based on the question, you will need to make one or more function/tool calls to achieve the purpose. + If none of the functions can be used, point it out. If the given question lacks the parameters required by the function, also point it out. You should only return the function call in tools call sections. + If you decide to invoke any of the function(s), you MUST put it in the format as follows: + [func_name1(params_name1=params_value1,params_name2=params_value2,...),func_name2(params_name1=params_value1,params_name2=params_value2,...)] + You SHOULD NOT include any other text in the response. + Here is a list of functions in JSON format that you can invoke. + {{toJson .Functions}} + <|eot_id|><|start_header_id|>user<|end_header_id|> + {{.Input}} + <|eot_id|><|start_header_id|>assistant<|end_header_id|> + context_size: 8192 + f16: true + stopwords: + - <|im_end|> + - + - "<|eot_id|>" + - <|end_of_text|>