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>
Signed| @@ -512,10 +512,6 @@ | ||
| 512 | 512 | "type": "context" |
| 513 | 513 | }, |
| 514 | 514 | { |
| 515 | - "filename": "presets/context/Mistral.json", | |
| 516 | - "type": "context" | |
| 517 | - }, | |
| 518 | - { | |
| 519 | 515 | "filename": "presets/context/NovelAI.json", |
| 520 | 516 | "type": "context" |
| 521 | 517 | }, |
| @@ -600,10 +596,6 @@ | ||
| 600 | 596 | "type": "instruct" |
| 601 | 597 | }, |
| 602 | 598 | { |
| 603 | - "filename": "presets/instruct/Mistral.json", | |
| 604 | - "type": "instruct" | |
| 605 | - }, | |
| 606 | - { | |
| 607 | 599 | "filename": "presets/instruct/OpenOrca-OpenChat.json", |
| 608 | 600 | "type": "instruct" |
| 609 | 601 | }, |
| @@ -686,5 +678,29 @@ | ||
| 686 | 678 | { |
| 687 | 679 | "filename": "presets/instruct/Gemma 2.json", |
| 688 | 680 | "type": "instruct" |
| 681 | + }, | |
| 682 | + { | |
| 683 | + "filename": "presets/instruct/Mistral V1.json", | |
| 684 | + "type": "instruct" | |
| 685 | + }, | |
| 686 | + { | |
| 687 | + "filename": "presets/context/Mistral V1.json", | |
| 688 | + "type": "context" | |
| 689 | + }, | |
| 690 | + { | |
| 691 | + "filename": "presets/instruct/Mistral V2 & V3.json", | |
| 692 | + "type": "instruct" | |
| 693 | + }, | |
| 694 | + { | |
| 695 | + "filename": "presets/context/Mistral V2 & V3.json", | |
| 696 | + "type": "context" | |
| 697 | + }, | |
| 698 | + { | |
| 699 | + "filename": "presets/instruct/Mistral V3-Tekken.json", | |
| 700 | + "type": "instruct" | |
| 701 | + }, | |
| 702 | + { | |
| 703 | + "filename": "presets/context/Mistral V3-Tekken.json", | |
| 704 | + "type": "context" | |
| 689 | 705 | } |
| 690 | 706 | ] |
| @@ -0,0 +1,12 @@ | ||
| 1 | +{ | |
| 2 | + "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>", | |
| 3 | + "example_separator": "", | |
| 4 | + "chat_start": "", | |
| 5 | + "use_stop_strings": false, | |
| 6 | + "allow_jailbreak": false, | |
| 7 | + "always_force_name2": true, | |
| 8 | + "trim_sentences": false, | |
| 9 | + "include_newline": false, | |
| 10 | + "single_line": false, | |
| 11 | + "name": "Mistral V1" | |
| 12 | +} | |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "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] Understood.</s>", |
| 3 | 3 | "example_separator": "Examples:", |
| 4 | 4 | "chat_start": "", |
| 5 | 5 | "use_stop_strings": false, |
| 6 | 6 | "allow_jailbreak": false, |
| @@ -8,5 +8,5 @@ | ||
| 8 | 8 | "trim_sentences": false, |
| 9 | 9 | "include_newline": false, |
| 10 | 10 | "single_line": false, |
| 11 | 11 | "name": "Mistral V2 & V3" |
| 12 | 12 | } |
| @@ -0,0 +1,12 @@ | ||
| 1 | +{ | |
| 2 | + "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>", | |
| 3 | + "example_separator": "", | |
| 4 | + "chat_start": "", | |
| 5 | + "use_stop_strings": false, | |
| 6 | + "allow_jailbreak": false, | |
| 7 | + "always_force_name2": true, | |
| 8 | + "trim_sentences": false, | |
| 9 | + "include_newline": false, | |
| 10 | + "single_line": false, | |
| 11 | + "name": "Mistral V3-Tekken" | |
| 12 | +} | |
| @@ -0,0 +1,23 @@ | ||
| 1 | +{ | |
| 2 | + "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.", | |
| 3 | + "input_sequence": " [INST] ", | |
| 4 | + "output_sequence": " [/INST] ", | |
| 5 | + "last_output_sequence": " [/INST]", | |
| 6 | + "system_sequence": "", | |
| 7 | + "stop_sequence": "", | |
| 8 | + "wrap": false, | |
| 9 | + "macro": true, | |
| 10 | + "names_behavior": "always", | |
| 11 | + "activation_regex": "", | |
| 12 | + "system_sequence_prefix": "", | |
| 13 | + "system_sequence_suffix": "", | |
| 14 | + "first_output_sequence": "", | |
| 15 | + "skip_examples": false, | |
| 16 | + "output_suffix": "</s>", | |
| 17 | + "input_suffix": "", | |
| 18 | + "system_suffix": "", | |
| 19 | + "user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.", | |
| 20 | + "system_same_as_user": true, | |
| 21 | + "last_system_sequence": "", | |
| 22 | + "name": "Mistral V1" | |
| 23 | +} | |
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.", |
| 3 | 3 | "input_sequence": "[INST] ", |
| 4 | 4 | "output_sequence": "[/INST] ", |
| 5 | 5 | "last_output_sequence": "[/INST]", |
| 6 | 6 | "system_sequence": "", |
| 7 | 7 | "stop_sequence": "", |
| 8 | 8 | "wrap": false, |
| @@ -13,11 +13,11 @@ | ||
| 13 | 13 | "system_sequence_suffix": "", |
| 14 | 14 | "first_output_sequence": "", |
| 15 | 15 | "skip_examples": false, |
| 16 | 16 | "output_suffix": "\n</s>", |
| 17 | 17 | "input_suffix": " [/INST]\n", |
| 18 | 18 | "system_suffix": "", |
| 19 | 19 | "user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.", |
| 20 | 20 | "system_same_as_user": true, |
| 21 | 21 | "last_system_sequence": "", |
| 22 | 22 | "name": "Mistral V2 & V3" |
| 23 | 23 | } |
| @@ -0,0 +1,23 @@ | ||
| 1 | +{ | |
| 2 | + "system_prompt": "Write {{char}}'s next reply in this fictional roleplay with {{user}}.", | |
| 3 | + "input_sequence": "[INST]", | |
| 4 | + "output_sequence": "[/INST]", | |
| 5 | + "last_output_sequence": "", | |
| 6 | + "system_sequence": "", | |
| 7 | + "stop_sequence": "", | |
| 8 | + "wrap": false, | |
| 9 | + "macro": true, | |
| 10 | + "names_behavior": "always", | |
| 11 | + "activation_regex": "", | |
| 12 | + "system_sequence_prefix": "", | |
| 13 | + "system_sequence_suffix": "", | |
| 14 | + "first_output_sequence": "", | |
| 15 | + "skip_examples": false, | |
| 16 | + "output_suffix": "</s>", | |
| 17 | + "input_suffix": "", | |
| 18 | + "system_suffix": "", | |
| 19 | + "user_alignment_message": "Let's get started. Please respond based on the information and instructions provided above.", | |
| 20 | + "system_same_as_user": true, | |
| 21 | + "last_system_sequence": "", | |
| 22 | + "name": "Mistral V3-Tekken" | |
| 23 | +} | |
| @@ -532,6 +532,19 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, | ||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | let sequence = getSequence() || ''; |
| 535 | + let nameFiller = ''; | |
| 536 | + | |
| 537 | + // A hack for Mistral's formatting that has a normal output sequence ending with a space | |
| 538 | + if ( | |
| 539 | + includeNames && | |
| 540 | + power_user.instruct.last_output_sequence && | |
| 541 | + power_user.instruct.output_sequence && | |
| 542 | + sequence === power_user.instruct.last_output_sequence && | |
| 543 | + /\s$/.test(power_user.instruct.output_sequence) && | |
| 544 | + !/\s$/.test(power_user.instruct.last_output_sequence) | |
| 545 | + ) { | |
| 546 | + nameFiller = power_user.instruct.output_sequence.slice(-1); | |
| 547 | + } | |
| 535 | 548 | |
| 536 | 549 | if (power_user.instruct.macro) { |
| 537 | 550 | sequence = substituteParams(sequence, name1, name2); |
| @@ -539,7 +552,7 @@ export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, | ||
| 539 | 552 | } |
| 540 | 553 | |
| 541 | 554 | const separator = power_user.instruct.wrap ? '\n' : ''; |
| 542 | 555 | let text = includeNames ? (separator + sequence + separator + nameFiller + `${name}:`) : (separator + sequence); |
| 543 | 556 | |
| 544 | 557 | // Quiet prompt already has a newline at the end |
| 545 | 558 | if (isQuiet && separator) { |