Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to parse chat template: 11:16: error: Expected expression, got: '(' {%- if (not loop.first) or (system_message is not none) %} ---^------- #3362

Open
BeginnerMaria opened this issue Jan 4, 2025 · 2 comments
Labels
bug-unconfirmed chat gpt4all-chat issues

Comments

@BeginnerMaria
Copy link

Bug Report

"As soon as you ask anything, the aforementioned error message appears, and nothing else is possible. When I switch to a language model like GPT-4All Falcon, the queries work but are very slow (not sure if that's relevant)."

Steps to Reproduce

  1. By Settings/Device I changed to CPU

Expected Behavior

Your Environment

  • 16 Ram installiert
  • GPT4All version: v3.6.1
  • Operating System: Windows 10 Pro
  • Chat model used (if applicable): EM German Mistral
@BeginnerMaria BeginnerMaria added bug-unconfirmed chat gpt4all-chat issues labels Jan 4, 2025
@manyoso
Copy link
Collaborator

manyoso commented Jan 6, 2025

Which model are you trying where you get this?

@gnusupport
Copy link

I have got similar error:

Error: Failed to parse chat template: 1:1: error: Unexpected exception occurred during template processing. Exception: std::bad_alloc

and I am using OpenAI compatible endpoint running Qwen2.5-1.5B-Instruct-Q4_K_M.gguf with the default chat template being:

<chat>
{%- set loop_messages = messages %}
{%- for message in loop_messages %}
    {%- if not message['role'] in ['user', 'assistant', 'system'] %}
        {{- raise_exception('Unknown role: ' + message['role']) }}
    {%- endif %}
    {{- '<' + message['role'] + '>' }}
    {%- if message['role'] == 'user' %}
        {%- for source in message.sources %}
            {%- if loop.first %}
                {{- '### Context:\n' }}
            {%- endif %}
            {{- ('Collection: ' + source.collection + '\n'    +
                 'Path: '       + source.path       + '\n'    +
                 'Excerpt: '    + source.text       + '\n\n') | escape }}
        {%- endfor %}
    {%- endif %}
    {%- for attachment in message.prompt_attachments %}
        {{- (attachment.processed_content + '\n\n') | escape }}
    {%- endfor %}
    {{- message.content | escape }}
    {{- '</' + message['role'] + '>' }}
{%- endfor %}
</chat>

and this error comes only when I am using LocalDocs to inquire about documents. Is there any remedy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-unconfirmed chat gpt4all-chat issues
Projects
None yet
Development

No branches or pull requests

3 participants