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

Allow users to force TF availability #18650

Merged
merged 2 commits into from
Aug 18, 2022
Merged

Conversation

Rocketknight1
Copy link
Member

We have a user report that with custom Tensorflow builds and package names that _tf_available can return False even if import tensorflow succeeds, because the user's package name isn't in the allowed list.

This is quite niche, so I don't want to do anything that could affect other users and workflows, but I added a FORCE_TF_AVAILABLE envvar that will skip version checks and just make sure TF is treated as available. @sgugger WDYT, or is there a better solution?

Fixed #18642

@Rocketknight1 Rocketknight1 requested a review from sgugger August 16, 2022 12:28
@Rocketknight1 Rocketknight1 marked this pull request as ready for review August 16, 2022 12:28
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 16, 2022

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

@@ -42,6 +42,8 @@
USE_TORCH = os.environ.get("USE_TORCH", "AUTO").upper()
USE_JAX = os.environ.get("USE_FLAX", "AUTO").upper()

FORCE_TF_AVAILABLE = os.environ.get("USE_TF", "AUTO").upper()
Copy link
Contributor

Choose a reason for hiding this comment

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

should be FORCE_TF_AVAILABLE

Copy link
Member

Choose a reason for hiding this comment

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

Agreed with @kevint324, I'd put this is a FORCE_TF_AVAILABLE env var :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agh, typo, I'm sorry! That's definitely more than a nit!

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Looks good! Only left a nit

@@ -42,6 +42,8 @@
USE_TORCH = os.environ.get("USE_TORCH", "AUTO").upper()
USE_JAX = os.environ.get("USE_FLAX", "AUTO").upper()

FORCE_TF_AVAILABLE = os.environ.get("USE_TF", "AUTO").upper()
Copy link
Member

Choose a reason for hiding this comment

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

Agreed with @kevint324, I'd put this is a FORCE_TF_AVAILABLE env var :)

@LysandreJik
Copy link
Member

Ah, additional nit: I'd document this somewhere.

@Rocketknight1 Rocketknight1 force-pushed the allow_force_tf_availability branch from 62f5bfb to 6adab4b Compare August 17, 2022 12:55
@Rocketknight1
Copy link
Member Author

@LysandreJik I think a lot of these envvars aren't documented anywhere - I can't see any documentation for USE_TF or USE_TORCH! Maybe we should make a separate docs PR with a list of envvars that transformers uses?

@LysandreJik
Copy link
Member

That would be fantastic :)

Thanks for your contribution, merging!

@LysandreJik LysandreJik merged commit 582c537 into main Aug 18, 2022
@LysandreJik LysandreJik deleted the allow_force_tf_availability branch August 18, 2022 07:09
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
* Allow users to force TF availability

* Correctly name the envvar!
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.

_tf_available for customized built tensorflow
4 participants