Skip to content

Commit 95fed4e

Browse files
committed
fixes
1 parent 918de1d commit 95fed4e

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

common/parsers/harmony.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ void harmony_msg_parser::parse() {
99
//builder.try_parse_reasoning("<|channel|>analysis<|message|>", "<|start|>assistant<|channel|>final<|message|>");
1010
//builder.add_content(builder.consume_rest());
1111
channel();
12+
builder.add_content(builder.consume_rest());
1213
}
1314

1415
void harmony_msg_parser::channel() {

src/llama-vocab.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) {
23422342

23432343
// @ngxson : quick hack for gpt-oss, always render these tokens
23442344
for (const auto & t : token_to_id) {
2345-
if (t.first == "<|channel|>" || t.first == "<|message|>" || t.first == "<|start|>") {
2345+
if (t.first == "<|channel|>" || t.first == "<|message|>" || t.first == "<|start|>" || t.first == "<|constrain|>") {
23462346
id_to_token[t.second].attr = LLAMA_TOKEN_ATTR_USER_DEFINED;
23472347
}
23482348
}
@@ -2389,6 +2389,7 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) {
23892389

23902390
if (has_return && has_call && has_end) {
23912391
special_eog_ids.erase(end_id);
2392+
id_to_token[end_id].attr = LLAMA_TOKEN_ATTR_USER_DEFINED;
23922393
LLAMA_LOG_WARN("%s: special_eog_ids contains both '<|return|>' and '<|call|>' tokens, removing '<|end|>' token from EOG list\n", __func__);
23932394
}
23942395
}

tests/test-chat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ static void test_template_output_parsers() {
15201520
assert_msg_equals(simple_assist_msg("", "I'm\nthinking"),
15211521
common_chat_parse(
15221522
"<|channel|>analysis<|message|>I'm\nthinking<|end|>"
1523-
"<|start|>assistant<|channel|><|final|>",
1523+
"<|start|>assistant<|channel|>final",
15241524
/* is_partial= */ true,
15251525
{
15261526
/* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
@@ -1529,7 +1529,7 @@ static void test_template_output_parsers() {
15291529
assert_msg_equals(simple_assist_msg("", "I'm\nthinking"),
15301530
common_chat_parse(
15311531
"<|channel|>analysis<|message|>I'm\nthinking<|end|>"
1532-
"<|start|>assistant<|channel|><|final|><|message|>",
1532+
"<|start|>assistant<|channel|>final<|message|>",
15331533
/* is_partial= */ true,
15341534
{
15351535
/* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,
@@ -1601,7 +1601,7 @@ static void test_template_output_parsers() {
16011601
assert_msg_equals(simple_assist_msg("", "I'm\nthinking"),
16021602
common_chat_parse(
16031603
"<|channel|>analysis<|message|>I'm\nthinking<|end|>"
1604-
"<|start|>assistant<|channel|>commentary ",
1604+
"<|start|>assistant<|channel|>commentary",
16051605
/* is_partial= */ true,
16061606
{
16071607
/* .format = */ COMMON_CHAT_FORMAT_GPT_OSS,

0 commit comments

Comments
 (0)