-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Fix check of unecessary packages (issue #37626) #37825
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
Fix check of unecessary packages (issue #37626) #37825
Conversation
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
Hi @HichTala. thanks for the updates. This looks good now, so I'm going to merge! |
|
My pleasure |
|
I think, yesterday one of the test didn't pass, I'm not sure of want changed, can you enlighten me ? 😅 |
|
hi @HichTala, that was probably just a flaky test! I reran the tests and it passed afterwards. We're working on making the CI more robust so that stops happening |
|
Hi @Rocketknight1, ok notted thank you 👍 |
…ce#37825) * Fix check of unecessary packages (issue huggingface#37626) * Reformat using ruff * And a condition to avoind the risk of matching a random object in `import_utils` * Reformat
What does this PR do?
This pull request updates the
get_importsfunction insrc/transformers/dynamic_module_utils.pyto improve how conditional imports are handled. The most important change introduces a check for functions intransformers.utils.import_utilsto ensure imports in specific conditional blocks are ignored.Enhancements to conditional import handling:
src/transformers/dynamic_module_utils.py: Added a reference totransformers.utilsand updated the logic in therecursive_look_for_importsfunction to ignore imports in conditional blocks that use functions fromtransformers.utils.import_utils, in addition to the existing check foris_flash_attnfunctions.Fixes # (issue)
check_importsunnecessarily verifies packages that may not be needed #37626Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@Rocketknight1
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.