Fixing Mistral Templates (#2883)

* Update Mistral.json

* Rename Mistral.json to Mistral V1.json

* Create Mistral V2 & V3.json

* Create Mistral V3-Tekken.json

* Update and rename Mistral.json to Mistral V1.json

* Update Mistral V1.json

* Update Mistral V2 & V3.json

* Update Mistral V2 & V3.json

* Update Mistral V3-Tekken.json

* Update Mistral V1.json

* Create Mistral V2 & V3.json

* Create Mistral V3-Tekken.json

* Update Mistral V1.json

* Update Mistral V2 & V3.json

* Update Mistral V3-Tekken.json

* Update Mistral V1.json

* Update Mistral V2 & V3.json

* Update Mistral V3-Tekken.json

* Update Mistral V1.json

* Update Mistral V2 & V3.json

* Update Mistral V1.json

* Update Mistral V3-Tekken.json

* Update Mistral V1.json

* Update Mistral V2 & V3.json

* Update Mistral V3-Tekken.json

* Add to content index

* Remove example separators

* Simplify context fillers

* Add a hack for proper V1 format with names

* Readability

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
pandora
2024-09-21 00:56:02 +02:00
committed by GitHub
parent 8c3a895ff4
commit 125498cfd5
8 changed files with 116 additions and 17 deletions

View File

@ -511,10 +511,6 @@
"filename": "presets/context/Minimalist.json",
"type": "context"
},
{
"filename": "presets/context/Mistral.json",
"type": "context"
},
{
"filename": "presets/context/NovelAI.json",
"type": "context"
@ -599,10 +595,6 @@
"filename": "presets/instruct/Metharme.json",
"type": "instruct"
},
{
"filename": "presets/instruct/Mistral.json",
"type": "instruct"
},
{
"filename": "presets/instruct/OpenOrca-OpenChat.json",
"type": "instruct"
@ -686,5 +678,29 @@
{
"filename": "presets/instruct/Gemma 2.json",
"type": "instruct"
},
{
"filename": "presets/instruct/Mistral V1.json",
"type": "instruct"
},
{
"filename": "presets/context/Mistral V1.json",
"type": "context"
},
{
"filename": "presets/instruct/Mistral V2 & V3.json",
"type": "instruct"
},
{
"filename": "presets/context/Mistral V2 & V3.json",
"type": "context"
},
{
"filename": "presets/instruct/Mistral V3-Tekken.json",
"type": "instruct"
},
{
"filename": "presets/context/Mistral V3-Tekken.json",
"type": "context"
}
]

View File

@ -0,0 +1,12 @@
{
"story_string": " [INST] {{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}} [/INST] Understood.</s>",
"example_separator": "",
"chat_start": "",
"use_stop_strings": false,
"allow_jailbreak": false,
"always_force_name2": true,
"trim_sentences": false,
"include_newline": false,
"single_line": false,
"name": "Mistral V1"
}

View File

@ -1,6 +1,6 @@
{
"story_string": "[INST] {{#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}} [/INST]",
"example_separator": "Examples:",
"story_string": "[INST] {{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}[/INST] Understood.</s>",
"example_separator": "",
"chat_start": "",
"use_stop_strings": false,
"allow_jailbreak": false,
@ -8,5 +8,5 @@
"trim_sentences": false,
"include_newline": false,
"single_line": false,
"name": "Mistral"
"name": "Mistral V2 & V3"
}

View File

@ -0,0 +1,12 @@
{
"story_string": "[INST]{{#if system}}{{system}}\n{{/if}}{{#if wiBefore}}{{wiBefore}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{personality}}\n{{/if}}{{#if scenario}}{{scenario}}\n{{/if}}{{#if wiAfter}}{{wiAfter}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{trim}}[/INST]Understood.</s>",
"example_separator": "",
"chat_start": "",
"use_stop_strings": false,
"allow_jailbreak": false,
"always_force_name2": true,
"trim_sentences": false,
"include_newline": false,
"single_line": false,
"name": "Mistral V3-Tekken"
}

View File

@ -0,0 +1,23 @@
{
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
"input_sequence": " [INST] ",
"output_sequence": " [/INST] ",
"last_output_sequence": " [/INST]",
"system_sequence": "",
"stop_sequence": "",
"wrap": false,
"macro": true,
"names_behavior": "always",
"activation_regex": "",
"system_sequence_prefix": "",
"system_sequence_suffix": "",
"first_output_sequence": "",
"skip_examples": false,
"output_suffix": "</s>",
"input_suffix": "",
"system_suffix": "",
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
"system_same_as_user": true,
"last_system_sequence": "",
"name": "Mistral V1"
}

View File

@ -0,0 +1,23 @@
{
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
"input_sequence": "[INST] ",
"output_sequence": "[/INST] ",
"last_output_sequence": "[/INST]",
"system_sequence": "",
"stop_sequence": "",
"wrap": false,
"macro": true,
"names_behavior": "always",
"activation_regex": "",
"system_sequence_prefix": "",
"system_sequence_suffix": "",
"first_output_sequence": "",
"skip_examples": false,
"output_suffix": "</s>",
"input_suffix": "",
"system_suffix": "",
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
"system_same_as_user": true,
"last_system_sequence": "",
"name": "Mistral V2 & V3"
}

View File

@ -1,7 +1,7 @@
{
"system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.",
"input_sequence": "[INST] ",
"output_sequence": "",
"input_sequence": "[INST]",
"output_sequence": "[/INST]",
"last_output_sequence": "",
"system_sequence": "",
"stop_sequence": "",
@ -13,11 +13,11 @@
"system_sequence_suffix": "",
"first_output_sequence": "",
"skip_examples": false,
"output_suffix": "\n",
"input_suffix": " [/INST]\n",
"output_suffix": "</s>",
"input_suffix": "",
"system_suffix": "",
"user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.",
"system_same_as_user": true,
"last_system_sequence": "",
"name": "Mistral"
"name": "Mistral V3-Tekken"
}

View File

@ -532,6 +532,19 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
}
let sequence = getSequence() || '';
let nameFiller = '';
// A hack for Mistral's formatting that has a normal output sequence ending with a space
if (
includeNames &&
power_user.instruct.last_output_sequence &&
power_user.instruct.output_sequence &&
sequence === power_user.instruct.last_output_sequence &&
/\s$/.test(power_user.instruct.output_sequence) &&
!/\s$/.test(power_user.instruct.last_output_sequence)
) {
nameFiller = power_user.instruct.output_sequence.slice(-1);
}
if (power_user.instruct.macro) {
sequence = substituteParams(sequence, name1, name2);
@ -539,7 +552,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1,
}
const separator = power_user.instruct.wrap ? '\n' : '';
let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence);
let text = includeNames ? (separator + sequence + separator + nameFiller + `${name}:`) : (separator + sequence);
// Quiet prompt already has a newline at the end
if (isQuiet && separator) {