Skip to content

[model] support GLM-5 (transformers) - #8066

Merged
Jintao-Huang merged 3 commits into
modelscope:mainfrom
Jintao-Huang:compat_megatron_core_main_123
Feb 24, 2026
Merged

[model] support GLM-5 (transformers)#8066
Jintao-Huang merged 3 commits into
modelscope:mainfrom
Jintao-Huang:compat_megatron_core_main_123

Conversation

@Jintao-Huang

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Jintao-Huang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses compatibility requirements with recent changes in the megatron-core library, specifically targeting version 0.16.0 or its main branch. The primary change involves modifying how a specific optimizer utility function is imported, ensuring that the training framework continues to operate seamlessly with the updated Megatron-Core dependencies. This update prevents potential breaking changes and maintains the stability of the training process.

Highlights

  • Compatibility Update: Adjusted import statements to ensure compatibility with megatron-core version 0.16.0 or its main branch.
  • Import Refactoring: Refactored the import of _update_min_and_max_lr_in_param_groups from a global module import to a local function-level import within the _get_param_groups function.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • swift/megatron/trainers/base.py
    • Removed the global import of _update_min_and_max_lr_in_param_groups from megatron.core.optimizer.
    • Added a local import of _update_min_and_max_lr_in_param_groups within the _get_param_groups function.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@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 aims to add compatibility with megatron-core 0.16.0. The changes involve moving an import to be local to a function. However, this change introduces a bug by removing a necessary variable assignment. I've pointed out the issue and suggested a fix.

Comment thread swift/megatron/trainers/base.py
@Jintao-Huang Jintao-Huang changed the title [megatron] compat megatron-core 0.16.0/main branch [model] support GLM-5 (transformers) Feb 24, 2026
@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 adds support for the GLM-5 model. The changes include defining the new model type, registering its metadata, and updating the documentation in both Chinese and English. Additionally, there are some good refactorings in the Megatron trainer, such as moving initialization logic into the __init__ method and improving code clarity. The changes are well-implemented and consistent. I have reviewed the code and found no issues.

@Jintao-Huang
Jintao-Huang merged commit ae1cd27 into modelscope:main Feb 24, 2026
2 of 3 checks passed
@Jintao-Huang

Copy link
Copy Markdown
Collaborator Author

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