NSChatML templates for TabbyAPI and SillyTavern.

#1
by LoafyLemon - opened

Hey, I'm a big fan of your work! I haven't been able to fully test the model and its capabilities but so far it looks promising. I'm sharing the templates so more people can give it a try. Keep up the good work!

Save each template as file with the given name and format:

nschatml.jinja (TabbyAPI chat template or any other compatible endpoint that supports jinja templates)

{% for message in messages %}
    {% if message['role'] == 'system' %}
        {{'<|im_system|>\n' + message['content']}}
    {% endif %}
    {% if message['role'] == 'user' %}
        {{'<|im_user|>\n' + message['content']}}
    {% endif %}
    {% if message['role'] == 'assistant' %}
        {{'<|im_bot|>\n' + message['content']}}
    {% endif %}
    {% if (loop.last and add_generation_prompt) or not loop.last %}
        {{'<|im_end|>\n'}}
    {% endif %}
{% endfor %}
{% if add_generation_prompt and messages[-1]['role'] != 'assistant' %}
    {{ '<|im_bot|>\n' }}
{% endif %}

nschatml_context.json (SillyTavern Context)

{
    "story_string": "<|im_system|>\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}}<|im_end|>",
    "example_separator": "",
    "chat_start": "",
    "use_stop_strings": false,
    "always_force_name2": true,
    "trim_sentences": false,
    "include_newline": false,
    "single_line": false,
    "name": "NSChatML"
}

nschatml_instruct.json (SillyTavern Instruct)

{
    "system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.",
    "input_sequence": "<|im_user|>\n",
    "output_sequence": "<|im_end|>\n",
    "first_output_sequence": "<|im_bot|>\n",
    "last_output_sequence": "",
    "system_sequence_prefix": "",
    "system_sequence_suffix": "",
    "stop_sequence": "",
    "separator_sequence": "<|im_end|>\n",
    "wrap": false,
    "macro": true,
    "names": true,
    "names_force_groups": true,
    "activation_regex": "",
    "name": "NSChatML"
}
Owner

Thank you!

Sign up or log in to comment