[model] support hy3 model#10630
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds the "Hy3" model group mapping to tencent/Hy3 and updates the hy3 template's thought words to use <think:opensource> and </think:opensource>. However, the changes to format_user and format_assistant introduce a critical issue: moving the <|hy_Assistant|> tag to format_assistant breaks the ReasoningTemplate thought block placement and prevents the assistant start tag from being appended during inference. It is recommended to revert these format changes as suggested.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| format_user=StringFormatter(slots=["<|hy_User|>{{content}}"]), | ||
| format_assistant=StringFormatter(slots=["<|hy_Assistant|>{{content}}<|hy_eos|>"]), |
There was a problem hiding this comment.
Incorrect Chat Template Format for Reasoning Models
Changing format_user to exclude <|hy_Assistant|> and putting it at the start of format_assistant introduces two major issues:
-
Incorrect Thought Block Placement in
ReasoningTemplate:
Becausehy3usesReasoningTemplate, during training/inference, the thought block is prepended to the assistant's response (response_ids) viaself.get_thought_word_ids(tokenizer) + response_ids.
Ifformat_assistantstarts with<|hy_Assistant|>, the thought block (<think:opensource>...</think:opensource>) will be prepended before<|hy_Assistant|>, resulting in:
... <|hy_User|>query <think:opensource>...thinking...</think:opensource> <|hy_Assistant|> response
The correct format for Hunyuan3 is to have the thought block after the assistant start tag:
... <|hy_User|>query <|hy_Assistant|> <think:opensource>...thinking...</think:opensource> response -
Broken Inference / Generation Prompt:
During inference, the prompt fed to the model is constructed from the user's turn. Ifformat_userdoes not end with<|hy_Assistant|>, the prompt will end with the user's content (e.g.,"<|hy_User|>query"), and the model will not receive the assistant start tag<|hy_Assistant|>to begin its generation.
Solution:
Revert format_user and format_assistant to their original definitions where <|hy_Assistant|> is placed at the end of format_user.
| format_user=StringFormatter(slots=["<|hy_User|>{{content}}"]), | |
| format_assistant=StringFormatter(slots=["<|hy_Assistant|>{{content}}<|hy_eos|>"]), | |
| format_user=StringFormatter(slots=["<|hy_User|>{{content}}<|hy_Assistant|>"]), | |
| format_assistant=StringFormatter(slots=["{{content}}<|hy_eos|>"]), |
No description provided.