Fix DeepSeek4 crafted template#25414
Conversation
aldehir
left a comment
There was a problem hiding this comment.
If we want to start testing templates, probably best to move those to a separate test suite as this one is already pretty large.
IMO Python tests are more appropriate for the Jinja templates.
|
Yeah, I'll probably move to refactor Personally, I'm against Python tests because the C++ tests double down as a check on the template rendering / message passing, which Python won't do - I prefer the tests to run inside the same engine as the actual template processing. |
|
As I had explained in the reddit thread, this is not the only issue and I had to opt out of the autoparser in order to properly run DSV4. In particular, parallel tool calling is not working with the autoparser and while running on pi I was getting random stops with tool calls within the reasoning block. Everything done to fix are contained in these two commits sent to fairydreaming's lightining indexer branch: fairydreaming#4 |
|
@tarruda yeah, working on the parser extension next :) |
|
@tarruda can you please include your response from Reddit for visibility purposes. Also because the link appears broken on my end. |
|
This is basically pretty similar to @tarruda 's branch :) a few style differences. @tarruda technically your approach to the template flag isn't in line with the reference: they require reasoning traces not if tools are declared, but if any tool calls are actually present (I know, practically it doesn't really matter too much, but just nitpicking :)) |
Overview
It seems like I've been a bit lazy implementing the DS4 template. I used the standard behavior (retain last reasoning trace). However, the reference behavior is different. DS4 will retain all reasoning traces in one of two cases:
drop_reasoningis set to falseI've patched the template and added a test to verify this.
Additional information
Note that under the current behavior llama.cpp defaults to setting
drop_reasoningto true, so if you want it set to false you'll have to add--preserve-reasoning- not that it matters that much because for all agentic cases, DS4 will still force the retain of traces due to the presence of tool calls.Requirements
<think>and</think>:))