Sync the chat template with the 16 October encoding.py, make it load in llama.cpp and transformers.js, and add a response template

#79
by Rocketknight1 HF Staff - opened

Updates the chat template to follow the 16 October encoding.py (as #74 does) and to load in llama.cpp and transformers.js, and adds a response template. OpenAI-style reasoning_effort values are now accepted (medium maps to 75 rather than 62). Supersedes #74. The chat template also marks the assistant's output with {% generation %} tags, so return_assistant_tokens_mask (TRL's assistant_only_loss) trains on just that; the tags don't change the rendered text.

Thanks for adding this! One limitation of the current response parsing framework is that DSML uses string="true/false" on each parameter to distinguish strings from JSON values. The xml-inline parser cannot currently use that attribute to select how each value is decoded, and schema-based casting cannot reliably recover the distinction—for example, "2" versus 2 when both types are allowed. Could you consider adding attribute-aware value parsing, or a dedicated DSML parser, to preserve these semantics as defined in encoding.py?

Hugging Face 的标志

搜索模型、数据集、用户……

deepseek-ai
/
DeepSeek-V4.1-闪存

喜欢

4.94k

跟随
深潜

154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8

执照:
密特
模型卡
文件
xet
社区
83

将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前

更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。

参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前

谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,

查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译

Hugging Face 的标志

搜索模型、数据集、用户……

deepseek-ai
/
DeepSeek-V4.1-闪存

喜欢

4.94k

跟随
深潜

154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8

执照:
密特
模型卡
文件
xet
社区
83

将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前

更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。

参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前

谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,

查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译

Screenshot 2026-11-09 223936

Screenshot 2026-11-09 221040
Screenshot 2026-11-09 223936
Screenshot 2026-11-10 031414
Screenshot 2026-11-10 054928
Screenshot 2026-11-11 161011
Screenshot 2026-11-11 161016
Screenshot 2026-11-11 162227

Screenshot 2026-11-09 221040
Screenshot 2026-11-09 223936
Screenshot 2026-11-10 031414
Screenshot 2026-11-10 054928
Screenshot 2026-11-11 161011
Screenshot 2026-11-11 161016
Screenshot 2026-11-11 162227

Screenshot 2026-11-09 221040
Screenshot 2026-11-09 223936
Screenshot 2026-11-10 031414
Screenshot 2026-11-10 054928
Screenshot 2026-11-11 161011
Screenshot 2026-11-11 161016
Screenshot 2026-11-11 162227

Screenshot 2026-11-09 221040
Screenshot 2026-11-09 223936
Screenshot 2026-11-10 031414
Screenshot 2026-11-10 054928
Screenshot 2026-11-11 161011
Screenshot 2026-11-11 161016
Screenshot 2026-11-11 162227

Hugging Face 的标志

搜索模型、数据集、用户……

deepseek-ai
/
DeepSeek-V4.1-闪存

喜欢

4.94k

跟随
深潜

154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8

执照:
密特
模型卡
文件
xet
社区
83

将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前

更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。

参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前

谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,

查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译

Screenshot 2026-11-09 223936

Hugging Face 的标志

搜索模型、数据集、用户……

deepseek-ai
/
DeepSeek-V4.1-闪存

喜欢

4.94k

跟随
深潜

154k
图像文本转文本
变形金刚
安全张紧器
deepseek_v41
文本生成
对话
评估结果
8 位精度
fp8

执照:
密特
模型卡
文件
xet
社区
83

将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板。
#79
经过Rocketknight1 HF员工 - 已开放14天前
基础: refs/heads/main
←
来源: refs/pr/79
讨论
文件已更改
+105
-24
Rocketknight1
14天前
•
编辑于 6 天前

更新聊天模板,使其与 10 月 16 日的版本保持一致encoding.py(与#74相同),并加载 llama.cpp 和 transformers.js 文件,同时添加响应模板。reasoning_effort现在接受 OpenAI 风格的值(medium映射到 75 而不是 62)。此更新取代#74。聊天模板还会为助手输出添加{% generation %}标签,因此return_assistant_tokens_mask(TRL 的assistant_only_loss)仅基于这些标签进行训练;标签不会改变渲染后的文本。

参见译文
将聊天模板与 10 月 16 日的 encoding.py 文件同步,使其在 llama.cpp 和 transformers.js 中加载,并添加回复模板92671424
更新 README.md 590a8a25
更新 chat_template.jinja cdd7d20d
GeeeekExplorer
DeepSeek 组织
1天前

谢谢你加入了这个! 现在的响应解析框架的一个限制是,DSML 在每个参数上使用 string="true/false" 来区分字符串与 JSON 值。 现在,xml-inline选择器不能使用该属性来每个值如何解码,并且基于方案的选择不能可靠地恢复区别,例如,当两种类型都允许时,“2”与2您考虑可以添加属性意识值解析器或专门的DSML解析器,

查看原文 ·由facebook/nllb-200-distilled-600M从英文翻译

Screenshot 2026-11-09 223936

Thanks for adding this! One limitation of the current response parsing framework is that DSML uses string="true/false" on each parameter to distinguish strings from JSON values. The xml-inline parser cannot currently use that attribute to select how each value is decoded, and schema-based casting cannot reliably recover the distinction—for example, "2" versus 2 when both types are allowed. Could you consider adding attribute-aware value parsing, or a dedicated DSML parser, to preserve these semantics as defined in encoding.py?

Thanks for adding this! One limitation of the current response parsing framework is that DSML uses string="thttps://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/discussions/79#6af286dedae82a224a459833rue/false" on each parameter to distinguish strings from JSON values. The xml-inline parser cannot currently use that attribute to select how each value is decoded, and schema-based casting cannot reliably recover the distinction—for example, "2" versus 2 when both types are allowed. Could you consider adding attribute-aware value parsing, or a dedicated DSML parser, to preserve these semantics as defined in encoding.py?

Thanks @GeeeekExplorer , you're right. Today the template keeps every parameter value as text and types it from the request's tool schema. That gives the right result when the schema names a single type, but it ignores string="true|false", so it can't follow the model's choice when the schema allows both a string and a JSON value ("2" vs 2), or when no tools are passed (everything stays a string).

I'll look at adding attribute-aware value decoding to the xml-inline parser in Transformers, so the template can decode each value according to its string attribute as encoding.py does, and I'll update this PR when that's available.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment