Jinja/auto template broken. // temp fix using Llama 3 template.

#9
by DavidAU - opened

Please note getting this error when attempting to "parse" embedded "chat template" / "jinja template":

RekaAI/reka-flash-3

Failed to parse Jinja template: Expected closing parenthesis, got OpenSquareBracket instead

This will render GGUFs unusable until fixed, and quants re-done.

I was able to verify operation (model does run well!) using "Llama 3" template, however there was issues with "reasoning" tags
and "< sep >" tag.

Reka AI org

looking into this

Reka AI org

hi @DavidAU , this should be resolved by this PR: https://huggingface.co/RekaAI/reka-flash-3/discussions/10. root cause is jinja impl in lmstudio doesn't allow index access after split, like a.split('b')[1]. we bypassed this using the pipe operator

DavidAU changed discussion status to closed

@chezhengreka

You might want to bing @bartowski and @mradermacher and/or put a note on the readme, as there are already quants using "GGUF MY REPO" out there... that need requants.
I did put a ticket in at MRADER's repo, and pinged BARTOW via formum discord/Lmstrudio.

Thanks for the ping, updating now

✅ Hi, I fixed the template error rekaai_reka-flash-3 here is the Jinja template to insert manually ✅ {% if messages[0]['role'] == 'system' %}
{% set merged_content = messages[0]['content'] + ' ' + messages[1]['content'] %}
{% set merged_messages = [{'role': messages[1]['role'], 'content': merged_content}] + messages[2:] %}
{% else %}
{% set merged_messages = messages %}
{% endif %}
{% for message in merged_messages %}
{{('human' if message['role'] == 'user' else message['role']) + ': ' + (message['content'].split('')|first + message['content'].split('')|last if message['role'] == 'assistant' and '' in message['content'] else message['content'])}}
{% if (loop.last and add_generation_prompt and merged_messages[-1]['role'] != 'assistant') or not loop.last %}
{{ ' ' }}
{% endif %}
{% endfor %}
{% if add_generation_prompt and merged_messages[-1]['role'] != 'assistant' %}
{{ 'assistant:' }}
{% endif %} ❌The error "Failed to parse Jinja template: Expected closing parenthesis, got Identifier instead" occurs in your Jinja template due to some syntax issues. Here are the main issues and how to fix them:

Incorrect use of "and" instead of "and":
Replace "and" with "and" in the conditions.

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment