Skip to content

Commit 0478cc5

Browse files
committed
ChatON:Add Monarch model template, which uses Begin + Prefix
Inturn Begin/BoS is added only for non 1st user messages in a system+user prompts chain.
1 parent 6f6f697 commit 0478cc5

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

common/chaton.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* These always adds any role specific prefix and suffix around the passed message.
5151
*
5252
* Sample chaton_meta.json includes template info for
53-
* * llama2, llama3, gemma, chatml, zephyr, deepseek
53+
* * llama2, llama3, gemma, chatml, zephyr, deepseek, monarch
5454
*
5555
*/
5656

@@ -197,6 +197,7 @@ inline void _chaton_meta_dump(std::string &tmpl) {
197197
LOGXLN("INFO:%s:%s:%s", __func__, "assistant->prefix", chaton_tmpl_role_kv(tmpl, K_ASSISTANT, K_PREFIX).c_str());
198198
LOGXLN("INFO:%s:%s:%s", __func__, "assistant->suffix", chaton_tmpl_role_kv(tmpl, K_ASSISTANT, K_SUFFIX).c_str());
199199
LOGXLN("INFO:%s:%s:%s", __func__, K_REVERSE_PROMPT, chaton_tmpl_kv(tmpl, K_REVERSE_PROMPT).c_str());
200+
LOGXLN("INFO:%s:%s:%d", __func__, K_SYSTEMUSER_1ST_USER_HAS_BEGIN, chaton_tmpl_kv_bool(tmpl, K_SYSTEMUSER_1ST_USER_HAS_BEGIN));
200201
LOGXLN("INFO:%s:%s:%d", __func__, K_SYSTEMUSER_1ST_USER_HAS_PREFIX, chaton_tmpl_kv_bool(tmpl, K_SYSTEMUSER_1ST_USER_HAS_PREFIX));
201202
}
202203
}

examples/chaton_meta.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,28 @@
153153
"reverse-prompt": "<|end▁of▁sentence|>",
154154
"systemuser-1st-user-has-begin": true,
155155
"systemuser-1st-user-has-prefix": true
156+
},
157+
"monarch": {
158+
"global": {
159+
"begin": "",
160+
"end": ""
161+
},
162+
"system": {
163+
"prefix": "<s>system\n",
164+
"suffix": "</s>\n"
165+
},
166+
"user": {
167+
"begin": "<s>",
168+
"prefix": "user\n",
169+
"suffix": "</s>\n"
170+
},
171+
"assistant": {
172+
"prefix": "<s>assistant\n",
173+
"suffix": " </s>\n"
174+
},
175+
"reverse-prompt": "</s>",
176+
"systemuser-1st-user-has-begin": false,
177+
"systemuser-1st-user-has-prefix": true
156178
}
157179
}
158180

0 commit comments

Comments
 (0)