Skip to content

Conversation

@ease-zh
Copy link
Contributor

@ease-zh ease-zh commented Jan 6, 2026

从funasr导入AutoModel时,其会自动导入注册的模块,但是此时fun_asr_nano 在模块级别又导入了AutoModel,形成循环导入,导致FunASRNano 模型注册失败,不能直接使用AutoModel加载。

从funasr导入AutoModel时,其会自动导入注册的模块,但是此时fun_asr_nano 在模块级别又导入了AutoModel,形成循环导入,导致FunASRNano 模型注册失败,不能直接使用AutoModel加载。
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ease-zh, 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!

此拉取请求旨在解决一个关键的循环导入问题,该问题导致 FunASRNano 模型无法正确注册和加载。通过将 AutoModel 的导入延迟到运行时按需进行,我们确保了模块的正确初始化和功能性,从而提高了系统的稳定性和可用性。

Highlights

  • 修复循环导入: 解决了由于 fun_asr_nano 模块级别导入 AutoModel 导致的循环导入问题。
  • 模型注册失败: 修复了循环导入导致 FunASRNano 模型无法自动注册,从而不能直接使用 AutoModel 加载的问题。
  • 优化导入策略: 将 AutoModel 的导入从全局模块级别移动到 FunASRNano 类的 __init__ 方法内部,并仅在 hub == "ms" 条件下进行,有效避免了模块加载时的依赖冲突。

🧠 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

本次PR通过将funasr.models.fun_asr_nano.model中对AutoModel的导入从模块级别移动到FunASRNano类的__init__方法内部,解决了循环导入导致FunASRNano模型无法自动注册的问题。这是一个正确且常见的解决Python循环导入问题的方法。将导入语句放在仅在需要时(hub == 'ms')才执行的if块内,也是一个很好的实践,可以避免不必要的导入。改动很清晰,直接解决了描述中的问题,做得很好。

@LauraGPT LauraGPT merged commit b25472b into modelscope:main Jan 7, 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.

2 participants