Skip to content

Conversation

@Jintao-Huang
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
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 primarily focuses on enhancing documentation clarity and integrating a new parameter related to sequence packing. It clarifies how data parallelism is calculated, introduces a packing_length parameter for better control over sequence packing, and refines the guidance for precision testing, especially for multimodal models, ensuring more accurate interpretation of conversion results.

Highlights

  • Documentation Clarity for Global Batch Size: Added a detailed explanation for calculating Data Parallelism size (DP) within the global_batch_size parameter documentation, available in both Chinese and English.
  • New packing_length Parameter: Introduced and documented the packing_length parameter, which allows specifying the length for sequence packing, defaulting to max_length if not set.
  • Integration of packing_length in SFT Training: The packing_length parameter is now passed to the dataset processing function in the SFT training script, enabling its use in sequence packing.
  • Refined Precision Testing Guidance: Updated documentation and code comments to guide users to focus on mean_diff (with loss) when performing precision conversion tests, particularly for multimodal models where image tokens might skew mean_diff.
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.

Copy link
Contributor

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

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 introduces a fix for packing_length by correctly passing it to the PackingDataset. It also includes several documentation updates, such as adding the packing_length parameter, clarifying the data parallelism formula, and providing guidance on precision testing for multimodal models. The changes are logical and improve the codebase. I have one suggestion to enhance the clarity of the new packing_length documentation.

- 🔥packing: Whether to use sequence packing to improve computational efficiency (achieving better load balancing across nodes and processes, and higher GPU utilization), at the cost of additional preprocessing time, while also stabilizing GPU memory usage. Defaults to `False`. Currently supported for CPT, SFT, DPO, KTO and RM.
- Note: **Sequences within the same batch remain mutually invisible**, except for Qwen3-Next.
- Note: **Packing reduces the number of samples in the dataset; please adjust the gradient accumulation steps and learning rate accordingly**.
- packing_length: the length to use for packing. Defaults to None, in which case it is set to max_length.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The description for packing_length is a bit brief. For better clarity, consider expanding it to explain what the 'length' refers to in the context of packing. Also, it might be helpful to add the 🔥 emoji to highlight it as an important parameter, similar to packing.

Suggested change
- packing_length: the length to use for packing. Defaults to None, in which case it is set to max_length.
- 🔥packing_length: Specifies the target sequence length for packing. When packing is enabled, multiple short sequences are concatenated into a single sequence of this length to improve efficiency. Defaults to `None`, in which case it is set to `max_length`.

@Jintao-Huang Jintao-Huang merged commit e5bc355 into modelscope:main Nov 13, 2025
1 of 2 checks passed
Jintao-Huang added a commit that referenced this pull request Nov 16, 2025
vx120 pushed a commit to vx120/ms-swift that referenced this pull request Nov 19, 2025
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