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

Better check for packages availability #23163

Merged
merged 11 commits into from
May 11, 2023
Merged

Conversation

apbard
Copy link
Contributor

@apbard apbard commented May 5, 2023

Following up huggingface/accelerate#1356
Refactor checks to avoid boilerplate and to ensure we are not picking up a folder that happens to be called as the package.

I assume all _*_available are for caching purposes. But is that really needed?

@apbard apbard marked this pull request as draft May 5, 2023 10:54
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 5, 2023

The documentation is not available anymore as the PR was closed or merged.

@apbard apbard marked this pull request as ready for review May 5, 2023 12:14
Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the refactor, this is super nice!

There are a couple of packages that do not properly implement metadata (I kno for sure opencv does not since we are adding it in another PR), could you quickly check that all the packages for which you did this PR do implement the metadata? if they don't we need to rely on the old way, which is fine as it should be an exceptional case.

src/transformers/utils/import_utils.py Outdated Show resolved Hide resolved
@apbard
Copy link
Contributor Author

apbard commented May 5, 2023

Thanks a lot for the refactor, this is super nice!

There are a couple of packages that do not properly implement metadata (I kno for sure opencv does not since we are adding it in another PR), could you quickly check that all the packages for which you did this PR do implement the metadata? if they don't we need to rely on the old way, which is fine as it should be an exceptional case.

I have checked the packages and found issues only on sklearn (the import is sklearn and package scikit-learn) and decord.

Could you please double check: smdistributed, tensorflow_text, torchdistx?

@sgugger
Copy link
Collaborator

sgugger commented May 5, 2023

I have validated that tensorflow_text works. Installing torchdistx seems to painful for the time I have right now, but looking at the GitHub, everything should be fine.

Checking internally for smdistributed since it only exists in SageMaker envirnoments.

@sgugger
Copy link
Collaborator

sgugger commented May 10, 2023

Not hearing anything back on smdistributed, so let's just merge this PR and see if anyone complains 😅

Can you just fix the conflict?

src/transformers/utils/import_utils.py Outdated Show resolved Hide resolved
src/transformers/utils/import_utils.py Outdated Show resolved Hide resolved
@apbard
Copy link
Contributor Author

apbard commented May 11, 2023

don't think failures are due to this PR. Also main is failing

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks!

@sgugger sgugger merged commit 83eda64 into huggingface:main May 11, 2023
sheonhan pushed a commit to sheonhan/transformers that referenced this pull request May 15, 2023
* Better check for packages availability

* amend _optimumneuron_available

* amend torch_version

* amend PIL detection and lint

* lint

* amend _faiss_available

* remove overloaded signatures of _is_package_available

* fix sklearn and decord detection

* remove unused checks

* revert
ydshieh added a commit that referenced this pull request May 15, 2023
* fix

* fix

---------

Co-authored-by: ydshieh <[email protected]>
sheonhan pushed a commit to sheonhan/transformers that referenced this pull request Jun 1, 2023
gojiteji pushed a commit to gojiteji/transformers that referenced this pull request Jun 5, 2023
* Better check for packages availability

* amend _optimumneuron_available

* amend torch_version

* amend PIL detection and lint

* lint

* amend _faiss_available

* remove overloaded signatures of _is_package_available

* fix sklearn and decord detection

* remove unused checks

* revert
gojiteji pushed a commit to gojiteji/transformers that referenced this pull request Jun 5, 2023
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
* Better check for packages availability

* amend _optimumneuron_available

* amend torch_version

* amend PIL detection and lint

* lint

* amend _faiss_available

* remove overloaded signatures of _is_package_available

* fix sklearn and decord detection

* remove unused checks

* revert
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
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.

3 participants