Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] DO NOT Use relative import #1703

Open
2 tasks done
jinmingyi1998 opened this issue Nov 20, 2024 · 2 comments
Open
2 tasks done

[Bug] DO NOT Use relative import #1703

jinmingyi1998 opened this issue Nov 20, 2024 · 2 comments
Assignees

Comments

@jinmingyi1998
Copy link

jinmingyi1998 commented Nov 20, 2024

先决条件

问题类型

我正在使用官方支持的任务/模型/数据集进行评估。

环境

https://github.com/open-compass/opencompass/blob/main/opencompass/models/__init__.py

relative import caused wrong package import, you should use absolute import in such a complex project.

重现问题 - 代码/配置示例

from .accessory import LLaMA2AccessoryModel

重现问题 - 命令或脚本

from .accessory import LLaMA2AccessoryModel

重现问题 - 错误信息

relative import a outside module instead of opencompass.models.xxx

you should use absolute import

其他信息

change to

from opencompass.models.accessory import LLaMA2AccessoryModel
@jinmingyi1998
Copy link
Author

https://google.github.io/styleguide/pyguide.html

Do not use relative names in imports. Even if the module is in the same package, use the full package name. This helps prevent unintentionally importing a package twice.

@tonysy
Copy link
Collaborator

tonysy commented Nov 21, 2024

Thanks for the suggestions. We will consider this improvement.

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

No branches or pull requests

3 participants