Skip to content

[bugfix] Fix dacite deserialization error for objects field in RolloutInferRequest#7189

Merged
hjh0119 merged 1 commit intomodelscope:mainfrom
hjh0119:fix-bugs
Dec 24, 2025
Merged

[bugfix] Fix dacite deserialization error for objects field in RolloutInferRequest#7189
hjh0119 merged 1 commit intomodelscope:mainfrom
hjh0119:fix-bugs

Conversation

@hjh0119
Copy link
Collaborator

@hjh0119 hjh0119 commented Dec 24, 2025

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hjh0119, 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 addresses a deserialization error within the RolloutInferRequest and related data structures by adjusting the type definition of the objects field to be more accommodating. This ensures that dacite can correctly process diverse multimodal object data. Additionally, a minor improvement was made to the CPOTrainer to enhance the robustness of its initialization process by safely handling the alpha parameter.

Highlights

  • Type Hint Correction for objects field: The type hint for the objects field in MultiModalRequestMixin, InferRequest, RolloutInferRequest, and StdTemplateInputs has been broadened from Dict[str, List[Any]] to Dict[str, Any]. This change resolves a dacite deserialization error by allowing more flexible data types for the values within the objects dictionary.
  • Improved alpha attribute assignment: The alpha attribute in CPOTrainer now uses getattr with a default value of 0.0 during initialization. This makes the assignment more robust by preventing potential AttributeError if args.alpha is not explicitly provided.

🧠 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.

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 addresses a dacite deserialization error by relaxing the type hint for the objects field from Dict[str, List[Any]] to Dict[str, Any]. This change is consistently applied across MultiModalRequestMixin, InferRequest, RolloutInferRequest, and StdTemplateInputs, which is a correct and direct fix for the described issue.

Additionally, the pull request includes a separate bugfix in cpo_trainer.py. The code is modified to use getattr(args, 'alpha', 0.0) instead of args.alpha. This is a good defensive change that prevents a potential AttributeError since the alpha attribute is not guaranteed to exist on the args object, thus improving the robustness of CPOTrainer initialization.

Both changes are beneficial to the codebase. For future contributions, it would be ideal to submit unrelated changes in separate pull requests to maintain a clear and focused review process. I have no further comments as the changes are correct.

@hjh0119 hjh0119 linked an issue Dec 24, 2025 that may be closed by this pull request
@hjh0119 hjh0119 merged commit e8262ac into modelscope:main Dec 24, 2025
2 of 3 checks passed
@hjh0119 hjh0119 deleted the fix-bugs branch December 24, 2025 06:50
Jintao-Huang pushed a commit that referenced this pull request Dec 24, 2025
meichangsu1 pushed a commit to tpx818/ms-swift that referenced this pull request Jan 22, 2026
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.

moe模型跑simpo报错:'CPOConfig' object has no attribute 'alpha'

2 participants