From f95077ac9f7e43921c25edeecbdf8aef96170fa2 Mon Sep 17 00:00:00 2001 From: invisietch Date: Sun, 13 Apr 2025 14:04:52 +0100 Subject: [PATCH 1/5] chore: add llama 4 chat templates --- .../presets/context/Llama 4 Instruct.json | 11 ++++++++++ .../presets/instruct/Llama 4 Instruct.json | 22 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 default/content/presets/context/Llama 4 Instruct.json create mode 100644 default/content/presets/instruct/Llama 4 Instruct.json diff --git a/default/content/presets/context/Llama 4 Instruct.json b/default/content/presets/context/Llama 4 Instruct.json new file mode 100644 index 000000000..463852e7a --- /dev/null +++ b/default/content/presets/context/Llama 4 Instruct.json @@ -0,0 +1,11 @@ +{ + "story_string": "<|start_header_id|>system<|end_header_id|>\n\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}<|eot|>", + "example_separator": "", + "chat_start": "", + "use_stop_strings": false, + "allow_jailbreak": false, + "always_force_name2": true, + "trim_sentences": false, + "single_line": false, + "name": "Llama 4 Instruct" +} diff --git a/default/content/presets/instruct/Llama 4 Instruct.json b/default/content/presets/instruct/Llama 4 Instruct.json new file mode 100644 index 000000000..55f0b9ee8 --- /dev/null +++ b/default/content/presets/instruct/Llama 4 Instruct.json @@ -0,0 +1,22 @@ +{ + "input_sequence": "<|start_header_id|>user<|end_header_id|>\n\n", + "output_sequence": "<|start_header_id|>assistant<|end_header_id|>\n\n", + "last_output_sequence": "", + "system_sequence": "<|start_header_id|>system<|end_header_id|>\n\n", + "stop_sequence": "<|eot|>", + "wrap": false, + "macro": true, + "names_behavior": "always", + "activation_regex": "", + "system_sequence_prefix": "", + "system_sequence_suffix": "", + "first_output_sequence": "", + "skip_examples": false, + "output_suffix": "<|eot|>", + "input_suffix": "<|eot|>", + "system_suffix": "<|eot|>", + "user_alignment_message": "", + "system_same_as_user": true, + "last_system_sequence": "", + "name": "Llama 4 Instruct" +} From 61ca7775d26eee965d2f5475c9086f702b56a2ea Mon Sep 17 00:00:00 2001 From: invisietch Date: Sun, 13 Apr 2025 14:09:54 +0100 Subject: [PATCH 2/5] fix: start/end header tags --- default/content/presets/context/Llama 4 Instruct.json | 2 +- default/content/presets/instruct/Llama 4 Instruct.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/default/content/presets/context/Llama 4 Instruct.json b/default/content/presets/context/Llama 4 Instruct.json index 463852e7a..b082aed22 100644 --- a/default/content/presets/context/Llama 4 Instruct.json +++ b/default/content/presets/context/Llama 4 Instruct.json @@ -1,5 +1,5 @@ { - "story_string": "<|start_header_id|>system<|end_header_id|>\n\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}<|eot|>", + "story_string": "<|header_start|>system<|header_end|>\n\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}<|eot|>", "example_separator": "", "chat_start": "", "use_stop_strings": false, diff --git a/default/content/presets/instruct/Llama 4 Instruct.json b/default/content/presets/instruct/Llama 4 Instruct.json index 55f0b9ee8..543fa8550 100644 --- a/default/content/presets/instruct/Llama 4 Instruct.json +++ b/default/content/presets/instruct/Llama 4 Instruct.json @@ -1,8 +1,8 @@ { - "input_sequence": "<|start_header_id|>user<|end_header_id|>\n\n", - "output_sequence": "<|start_header_id|>assistant<|end_header_id|>\n\n", + "input_sequence": "<|header_start|>user<|header_end|>\n\n", + "output_sequence": "<|header_start|>assistant<|header_end|>\n\n", "last_output_sequence": "", - "system_sequence": "<|start_header_id|>system<|end_header_id|>\n\n", + "system_sequence": "<|header_start|>system<|header_end|>\n\n", "stop_sequence": "<|eot|>", "wrap": false, "macro": true, From fc9b2173c0488523f30977fb1021afa4fc3255be Mon Sep 17 00:00:00 2001 From: invisietch Date: Sun, 13 Apr 2025 14:14:43 +0100 Subject: [PATCH 3/5] fix: add <|begin_of_text|> to story string --- default/content/presets/context/Llama 4 Instruct.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default/content/presets/context/Llama 4 Instruct.json b/default/content/presets/context/Llama 4 Instruct.json index b082aed22..e1be872e7 100644 --- a/default/content/presets/context/Llama 4 Instruct.json +++ b/default/content/presets/context/Llama 4 Instruct.json @@ -1,5 +1,5 @@ { - "story_string": "<|header_start|>system<|header_end|>\n\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}<|eot|>", + "story_string": "<|begin_of_text|><|header_start|>system<|header_end|>\n\n{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}<|eot|>", "example_separator": "", "chat_start": "", "use_stop_strings": false, From 6f05c087b9ac674108a9800ed6bc2f993c53b42d Mon Sep 17 00:00:00 2001 From: invisietch Date: Sun, 13 Apr 2025 14:26:20 +0100 Subject: [PATCH 4/5] chore: update index --- default/content/index.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/default/content/index.json b/default/content/index.json index 49e2dd12c..ac88da3e3 100644 --- a/default/content/index.json +++ b/default/content/index.json @@ -563,6 +563,10 @@ "filename": "presets/context/Llama 3 Instruct.json", "type": "context" }, + { + "filename": "presets/context/Llama 4 Instruct.json", + "type": "context" + }, { "filename": "presets/context/Phi.json", "type": "context" @@ -663,6 +667,10 @@ "filename": "presets/instruct/Llama 3 Instruct.json", "type": "instruct" }, + { + "filename": "presets/instruct/Llama 4 Instruct.json", + "type": "instruct" + }, { "filename": "presets/instruct/Phi.json", "type": "instruct" From 897632b583bc31195fe69754edbddec3802a69de Mon Sep 17 00:00:00 2001 From: invisietch Date: Sun, 13 Apr 2025 15:12:09 +0100 Subject: [PATCH 5/5] fix: system prompt not the same as user prompt for L3/4 --- default/content/presets/instruct/Llama 3 Instruct.json | 2 +- default/content/presets/instruct/Llama 4 Instruct.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/default/content/presets/instruct/Llama 3 Instruct.json b/default/content/presets/instruct/Llama 3 Instruct.json index d283820f4..317a4c698 100644 --- a/default/content/presets/instruct/Llama 3 Instruct.json +++ b/default/content/presets/instruct/Llama 3 Instruct.json @@ -16,7 +16,7 @@ "input_suffix": "<|eot_id|>", "system_suffix": "<|eot_id|>", "user_alignment_message": "", - "system_same_as_user": true, + "system_same_as_user": false, "last_system_sequence": "", "name": "Llama 3 Instruct" } diff --git a/default/content/presets/instruct/Llama 4 Instruct.json b/default/content/presets/instruct/Llama 4 Instruct.json index 543fa8550..28115c6ce 100644 --- a/default/content/presets/instruct/Llama 4 Instruct.json +++ b/default/content/presets/instruct/Llama 4 Instruct.json @@ -16,7 +16,7 @@ "input_suffix": "<|eot|>", "system_suffix": "<|eot|>", "user_alignment_message": "", - "system_same_as_user": true, + "system_same_as_user": false, "last_system_sequence": "", "name": "Llama 4 Instruct" }