Skip to content
New issue

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

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

Already on GitHub? # to your account

Test that TensorFlow is not imported on startup #904

Merged
merged 6 commits into from
Jul 7, 2022

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Jun 13, 2022

TF takes some time to be imported, and also uses some GPU memory.

I just added a test to make sure that in the future it's never imported by default when

import huggingface_hub

is called

@adrinjalali
Copy link
Contributor

Since we do lazy loading now in huggingface_hub, [almost] nothing should be imported on import huggingface_hub anyway. But I like the test.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 13, 2022

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

@lhoestq
Copy link
Member Author

lhoestq commented Jun 13, 2022

Yup I noticed that :) Looking forward to have a new release with lazy loading !

This test is just to make sure that in the future we don't do it without noticing, as it happened in #679 some time ago

@lhoestq lhoestq marked this pull request as ready for review June 13, 2022 12:16
@lhoestq lhoestq requested a review from osanseviero July 4, 2022 14:46
Copy link
Contributor

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the test!

@lhoestq
Copy link
Member Author

lhoestq commented Jul 7, 2022

I ended up adding pytest ./tests/test_tf*.

This is because running the keras tests at the same time would import TF, so the test would always fail.

Let me know if it's good for you

@osanseviero
Copy link
Contributor

Yes, this works for me!

@lhoestq lhoestq merged commit 06fdf94 into main Jul 7, 2022
@lhoestq lhoestq deleted the test-tf-not-imported-on-startup branch July 7, 2022 12:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants