Jinja exception

#3
by Linukso1D - opened

Hello, thanks for your work!

Please point me to it. Is it something I'm doing wrong, or something that will be fixed?

Llama.cpp release b9776
Launch command:

/build/bin/llama-server \
          --model /home/user/LLM/models/unsloth/Qwen3.6-35B-A3B-GGUF/Qwen-AgentWorld-35B-A3B-UD-Q8_K_XL.gguf \
          --alias "unsloth/qwen3.6-35B-A3B" \
          --host 127.0.0.1 --port 8001 \
          --temp 0.6 \
          --top-p 0.95 \
          --top-k 20 \
          --min-p 0.00 \
          --kv-unified \
          --cache-type-k q8_0 --cache-type-v q8_0 \
          --flash-attn on --fit on \
          --ctx-size 168000 \
          --jinja \
          --log-colors on \
          --log-prefix \
          --log-timestamps \
          --no-warmup \
          --batch-size 2048 \
          --ubatch-size 2048 \
          --no-mmap \
          --cache-ram 16384 \
          --ctx-checkpoints 16

Jinja exception:

0.06.444.233 I init: chat template, example_format: '<|im_start|>system
You are a helpful assistant<|im_end|>
<|im_start|>user
Hello<|im_end|>
<|im_start|>assistant
Hi there<|im_end|>
<|im_start|>user
How are you?<|im_end|>
<|im_start|>assistant
<think>
'
0.06.450.474 I srv          init: init: chat template, thinking = 1
0.06.450.483 I srv  llama_server: model loaded
0.06.450.488 I srv  llama_server: server is listening on http://127.0.0.1:8001
0.06.450.490 I srv  update_slots: all slots are idle
0.06.853.184 W srv    operator(): got exception: {"error":{"code":400,"message":"Unable to generate parser for this template. Automatic parser generation failed: \n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"invalid_request_error"}}
0.07.412.349 W srv    operator(): got exception: {"error":{"code":400,"message":"Unable to generate parser for this template. Automatic parser generation failed: \n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"invalid_request_error"}}
0.07.413.641 I srv    operator(): Chat format: peg-native
0.07.413.772 I slot get_availabl: id  3 | task -1 | selected slot by LRU, t_last = -1
0.07.413.776 I srv  get_availabl: updating prompt cache
0.07.413.780 I srv          load:  - looking for better prompt, base f_keep = -1.000, sim = 0.000
0.07.413.785 I srv        update:  - cache state: 0 prompts, 0.000 MiB (limits: 16384.000 MiB, 168192 tokens, 17179869184 est)
0.07.413.787 I srv  get_availabl: prompt cache update took 0.01 ms
0.07.413.850 I slot launch_slot_: id  3 | task 0 | processing task, is_child = 0
0.07.413.851 I slot process_sing: id  0 | task -1 | saving idle slot to prompt cache
0.07.413.852 I slot prompt_clear: id  0 | task -1 | clearing prompt with 0 tokens
0.07.413.944 I slot process_sing: id  1 | task -1 | saving idle slot to prompt cache
0.07.413.945 I slot prompt_clear: id  1 | task -1 | clearing prompt with 0 tokens
0.07.414.034 I slot process_sing: id  2 | task -1 | saving idle slot to prompt cache
0.07.414.035 I slot prompt_clear: id  2 | task -1 | clearing prompt with 0 tokens
0.07.750.541 I slot create_check: id  3 | task 0 | created context checkpoint 1 of 16 (pos_min = 337, pos_max = 337, n_tokens = 338, size = 62.813 MiB)
0.11.099.575 I slot print_timing: id  3 | task 0 | n_decoded =    313, tg = 104.11 t/s, tg_3s = 104.11 t/s
0.14.103.404 I slot print_timing: id  3 | task 0 | n_decoded =    633, tg = 105.32 t/s, tg_3s = 106.53 t/s
0.17.108.030 I slot print_timing: id  3 | task 0 | n_decoded =    954, tg = 105.83 t/s, tg_3s = 106.84 t/s
0.20.113.594 I slot print_timing: id  3 | task 0 | n_decoded =   1280, tg = 106.49 t/s, tg_3s = 108.47 t/s
0.23.121.346 I slot print_timing: id  3 | task 0 | n_decoded =   1608, tg = 107.00 t/s, tg_3s = 109.05 t/s
0.26.125.890 I slot print_timing: id  3 | task 0 | n_decoded =   1933, tg = 107.19 t/s, tg_3s = 108.17 t/s
0.29.131.681 I slot print_timing: id  3 | task 0 | n_decoded =   2259, tg = 107.37 t/s, tg_3s = 108.46 t/s
0.32.020.208 I slot print_timing: id  3 | task 0 | prompt eval time =     679.01 ms /  1710 tokens (    0.40 ms per token,  2518.37 tokens per second)
0.32.020.212 I slot print_timing: id  3 | task 0 |        eval time =   23927.05 ms /  2572 tokens (    9.30 ms per token,   107.49 tokens per second)
0.32.020.213 I slot print_timing: id  3 | task 0 |       total time =   24606.06 ms /  4282 tokens
0.32.020.213 I slot print_timing: id  3 | task 0 |    graphs reused =       2560
0.32.020.285 I slot      release: id  3 | task 0 | stop processing: n_tokens = 4281, truncated = 0

Claude:

API Error: 400 Unable to generate parser for this template. Automatic parser generation failed: 
  ------------
  While executing CallExpression at line 90, column 32 in source:
  ...first %}↵            {{- raise_exception('System message must be at the beginnin...
                                             ^
  Error: Jinja Exception: System message must be at the beginning.

Thank you in advance!

Maybe to try without --jinja parameter?

Because this one works for me:

D:\llama-b9761-bin-win-cuda-12.4-x64\llama-server.exe -m D:\models\Qwen-AgentWorld-35B-A3B-UD-IQ4_NL.gguf -c 262144 -np 1 -ngl 99 --seed 3407 --prio 2 --temp 0.6 --repeat-penalty 1.0 --min-p 0.0 --top-k 20 --top-p 0.95 --host 0.0.0.0 --port 5000 --numa distribute -mg 0 -sm none -fa on -ctv q8_0 -ctk q8_0

0.24.797.584 I init: chat template, example_format: '<|im_start|>system
You are a helpful assistant<|im_end|>
<|im_start|>user
Hello<|im_end|>
<|im_start|>assistant
Hi there<|im_end|>
<|im_start|>user
How are you?<|im_end|>
<|im_start|>assistant

'
0.24.814.462 I srv init: init: chat template, thinking = 1
0.24.814.493 I srv llama_server: model loaded
0.24.814.495 I srv llama_server: server is listening on http://0.0.0.0:5000
0.24.814.506 I srv update_slots: all slots are idle
1.28.051.026 I srv operator(): Chat format: peg-native
1.28.051.205 I slot get_availabl: id 0 | task -1 | selected slot by LRU, t_last = -1
1.28.051.207 I srv get_availabl: updating prompt cache
1.28.051.215 I srv load: - looking for better prompt, base f_keep = -1.000, sim = 0.000
1.28.051.217 I srv update: - cache state: 0 prompts, 0.000 MiB (limits: 8192.000 MiB, 262144 tokens, 8589934592 est)
1.28.051.219 I srv get_availabl: prompt cache update took 0.01 ms
1.28.051.246 I reasoning-budget: activated, budget=2147483647 tokens
1.28.051.246 I reasoning-budget: deactivated (natural end)
1.28.051.256 I slot launch_slot_: id 0 | task 0 | processing task, is_child = 0
1.28.711.569 I slot create_check: id 0 | task 0 | created context checkpoint 1 of 32 (pos_min = 12, pos_max = 12, n_tokens = 13, size = 62.813 MiB)
1.28.942.063 I slot print_timing: id 0 | task 0 | prompt eval time = 706.88 ms / 17 tokens ( 41.58 ms per token, 24.05 tokens per second)
1.28.942.069 I slot print_timing: id 0 | task 0 | eval time = 183.90 ms / 20 tokens ( 9.19 ms per token, 108.76 tokens per second)
1.28.942.070 I slot print_timing: id 0 | task 0 | total time = 890.78 ms / 37 tokens
1.28.942.071 I slot print_timing: id 0 | task 0 | graphs reused = 19
1.28.942.088 I slot release: id 0 | task 0 | stop processing: n_tokens = 36, truncated = 0
1.28.942.093 I srv update_slots: all slots are idle
3.08.616.976 I srv operator(): Chat format: peg-native
3.08.617.129 I slot get_availabl: id 0 | task -1 | selected slot by LCP similarity, sim_best = 0.143 (> 0.100 thold), f_keep = 0.083
3.08.617.132 I srv get_availabl: updating prompt cache
3.08.617.349 W srv prompt_save: - saving prompt with length 36, total state size = 63.188 MiB (draft: 0.000 MiB)
3.08.689.687 I srv load: - looking for better prompt, base f_keep = 0.083, sim = 0.143
3.08.689.698 I srv update: - cache state: 1 prompts, 126.001 MiB (limits: 8192.000 MiB, 262144 tokens, 262144 est)
3.08.689.700 I srv update: - prompt 000001B605968D60: 36 tokens, checkpoints: 1, 126.001 MiB
3.08.689.702 I srv get_availabl: prompt cache update took 72.57 ms
3.08.689.760 I reasoning-budget: activated, budget=2147483647 tokens
3.08.689.761 I reasoning-budget: deactivated (natural end)
3.08.690.135 I slot launch_slot_: id 0 | task 22 | processing task, is_child = 0
3.08.690.154 I slot operator(): id 0 | task 22 | Checking checkpoint with [12, 12] against 3...
3.08.690.163 W slot operator(): id 0 | task 22 | forcing full prompt re-processing due to lack of cache data (likely due to SWA or hybrid/recurrent memory, see https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2868343055)
3.08.690.169 W slot operator(): id 0 | task 22 | erased invalidated context checkpoint (pos_min = 12, pos_max = 12, n_tokens = 13, n_swa = 0, pos_next = 0, size = 62.813 MiB)
3.08.907.776 I slot create_check: id 0 | task 22 | created context checkpoint 1 of 32 (pos_min = 16, pos_max = 16, n_tokens = 17, size = 62.813 MiB)
3.11.949.136 I slot print_timing: id 0 | task 22 | n_decoded = 344, tg = 114.41 t/s, tg_3s = 114.41 t/s
3.14.840.875 I slot print_timing: id 0 | task 22 | prompt eval time = 252.32 ms / 21 tokens ( 12.02 ms per token, 83.23 tokens per second)
3.14.840.882 I slot print_timing: id 0 | task 22 | eval time = 5898.41 ms / 682 tokens ( 8.65 ms per token, 115.62 tokens per second)
3.14.840.883 I slot print_timing: id 0 | task 22 | total time = 6150.73 ms / 703 tokens
3.14.840.884 I slot print_timing: id 0 | task 22 | graphs reused = 697
3.14.840.903 I slot release: id 0 | task 22 | stop processing: n_tokens = 702, truncated = 0
3.14.840.921 I srv update_slots: all slots are idle

Same error here, using --jinja in OpenCode

command used:

.\llama-server.exe -m "C:\Users\User\.vllm\Qwen-AgentWorld-35B-A3B-UD\Qwen-AgentWorld-35B-A3B-UD-Q4_K_M.gguf" --host 127.0.0.1 --port 10000 -ngl 99 -c 256000 -b 8192 -ub 2048 --temp 0.6 -np 1 -fa on --top-k 20 --presence-penalty 0.0 --repeat-penalty 1.0 --min-p 0.0 --top-p 0.95 --api-key xxxxx--cont-batching --metrics -ctv turbo4 -ctk turbo4 --jinja -tb 19 -t 19 --poll 100 --cpu-strict 1 --n-cpu-moe 30

srv          init: init: chat template, thinking = 1
main: model loaded
main: server is listening on http://127.0.0.1:10000
main: starting the main loop...
srv  update_slots: all slots are idle
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500
srv   operator (): operator (): cleaning up before exit...

I had to load a qwen3.6 template that apparently fixes it, but I'm not sure if the skills are being loaded; the model isn't showing me that the skill is being loaded correctly.

Why are you using "--jinja"? I think this is not right.

Why are you using "--jinja"? I think this is not right.

Because without --jinja, all open-code models for agents tend to break, or simply do not work

result without jinja:

main: model loaded
main: server is listening on http://127.0.0.1:10000
main: starting the main loop...
srv  update_slots: all slots are idle
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500
srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 90, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
srv  log_server_r: done request: POST /v1/chat/completions 127.0.0.1 500

Hey guys, for now I think it was kind of stupid question, because after the a quick look at the qwen page of this model, an its discussion, model description I came up with the idea that this model is not appropriate for the connection to the Claude/open code, as it was created to simulate output for the incoming commands for terminal for example.
So it doesn't make anything except simulation for the different areas.

I'll wait use cases of usage in the official hf page 📄

Thank you

Hey guys, for now I think it was kind of stupid question, because after the a quick look at the qwen page of this model, an its discussion, model description I came up with the idea that this model is not appropriate for the connection to the Claude/open code, as it was created to simulate output for the incoming commands for terminal for example.
So it doesn't make anything except simulation for the different areas.

I'll wait use cases of usage in the official hf page 📄

Thank you

Oh yes, that's true, but let me tell you something: it's a spectacular model for following instructions. I've been testing models for a long time to do research on more or less medical and health-related topics, and most of them go through the motions and perform the task dynamics, but they deliver a lot of false, invented, and half-baked information. This applies to the modified 9B models that have come out, like Fable, and the standard ones, as well as the original 35B and its modified versions—they all have the same flaw.

This new model achieved 9/10 in my ratings with the same task, while other models frequently obtained 5-6/10 points in the reliability of the information provided by the model.

What is important is to provide the task's SKILL very clearly; sometimes it has trouble loading it, but when it manages to load the SKILL correctly, the model does an excellent job using the MCPs and following the task in the way it is described

I must also mention that the model saves a lot of tokens; it seems like its context window can hold twice as much information. I don't know exactly how much it holds, but with this model, after finishing an exhaustive and long investigation, it consumes about 25% to 40% of the context window, whereas with other models, it would reach 90% of the 250K. This also helped with my low VRAM and maintained a much higher speed than the other models; I think my perception was a speed of approximately 20t/s, which isn't much, but for my 12GB of VRAM, it's quite a lot. I really liked this model, even though it is trained to do other things.

A curious aspect I notice is that it overthinks

I must say that, at least for my research tasks, Qwen-AgentWorld outperformed the model https://huggingface.co/deepreinforce-ai/Ornith-1.0-35B-GGUF in terms of the reliability of the information acquired using search MCPs (I thought this Ornith model would be my ideal model for my research, but that wasn't the case; it looked very promising but failed in terms of information reliability).

By the way, I must say that my experiments were using the llama.cpp FORK from atomic, with Turboquant, quantizing both caches in turbo4

https://huggingface.co/froggeric/Qwen-Fixed-Chat-Templates
Worth to try, @Milor123 ^^, it helped me with the Claude code and Jackrong/Qwopus3.6-27B-Coder-Compat-MTP-GGUF

https://huggingface.co/froggeric/Qwen-Fixed-Chat-Templates
Worth to try, @Milor123 ^^, it helped me with the Claude code and Jackrong/Qwopus3.6-27B-Coder-Compat-MTP-GGUF

Can confirm this worked like a charm for me for Claude code,With this the model has been a beast so far!
I preferred gemma 31b to qwen its offerings for Claude code/Nanoclaw, but this one is something different!

Sign up or log in to comment