Skip to content

[template] update template decode_generate_ids#9523

Merged
Jintao-Huang merged 2 commits into
modelscope:mainfrom
Jintao-Huang:update_template_decode_generate_ids
Jun 9, 2026
Merged

[template] update template decode_generate_ids#9523
Jintao-Huang merged 2 commits into
modelscope:mainfrom
Jintao-Huang:update_template_decode_generate_ids

Conversation

@Jintao-Huang

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces calls to self.template.decode with self.template.decode_generate_ids across multiple inference engines (GRPO vLLM, LMDeploy, SGLang, Transformers, vLLM, and utility functions). However, a critical issue was identified: the decode_generate_ids method is not defined in the base Template class, which will cause an AttributeError at runtime. It appears that the corresponding changes to swift/template/base.py were accidentally omitted from this pull request.

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.

Comment thread swift/infer_engine/utils.py
@Jintao-Huang

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request renames the decode method to decode_generate_ids across various inference engines and template implementations to clarify its purpose. The reviewer points out that this is a breaking change for external users who have subclassed Template and overridden decode. To maintain backward compatibility, the reviewer suggests keeping decode as a deprecated alias and routing calls gracefully, providing a detailed code implementation to achieve this.

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.

Comment thread swift/template/base.py
@Jintao-Huang Jintao-Huang merged commit 139a3d7 into modelscope:main Jun 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants