Skip to content

[bugfix] Fix args template type#8005

Merged
Jintao-Huang merged 2 commits intomodelscope:mainfrom
Jintao-Huang:fix_args_template_type
Feb 7, 2026
Merged

[bugfix] Fix args template type#8005
Jintao-Huang merged 2 commits intomodelscope:mainfrom
Jintao-Huang:fix_args_template_type

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 addresses a bug related to retrieving template information by correcting the attribute accessed. It also includes a dependency update to relax the version constraint for the transformers library and a minor code refactoring to improve import statements in a callback file. These changes enhance compatibility, fix a functional issue, and improve code structure.

Highlights

  • Dependency Update: The upper version constraint for the transformers library has been removed, allowing for greater flexibility with newer versions of the library.
  • Code Refactoring: Utility imports in swift/callbacks/perf_log.py were moved from within a method to the top of the file, improving code organization and adherence to best practices.
  • Bug Fix: Corrected the attribute used to retrieve template information in swift/template/register.py from args.template_type to args.template, resolving an issue with template type retrieval.

🧠 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
  • requirements/framework.txt
    • Removed the upper version bound for the transformers package, changing transformers>=4.33,<4.58 to transformers>=4.33.
  • swift/callbacks/perf_log.py
    • Moved get_current_device, get_device_count, and get_env_args imports from inside the on_init_end method to the top-level imports of the file.
  • swift/template/register.py
    • Changed the return statement in _read_args_json_template_type from args.template_type to args.template to correctly access the template attribute.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 bug by correcting the attribute name from template_type to template for argument parsing, and also refactors some imports for better code organization. A notable change is the removal of the upper version limit for the transformers dependency. While this provides flexibility, it can introduce instability from future breaking changes. I've added a comment suggesting to re-introduce an upper bound to ensure long-term stability.

tiktoken
tqdm
transformers>=4.33,<4.58
transformers>=4.33
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Removing the upper version constraint for transformers can introduce instability if future releases include breaking changes. It's a best practice to pin dependencies with an upper bound to ensure reproducibility and prevent unexpected failures. Please consider adding an upper bound, for instance, <5.0 or based on the latest version you've tested against.

transformers>=4.33,<5.0

@Jintao-Huang Jintao-Huang merged commit 4b09c99 into modelscope:main Feb 7, 2026
1 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