Skip to content

Commit

Permalink
Fix how we detect the TF package (#24255)
Browse files Browse the repository at this point in the history
* Fix how we detect the TF package

* Add a comment as a talisman warding against future harm

* Actually put the comment in the right place
  • Loading branch information
Rocketknight1 authored and sgugger committed Jun 13, 2023
1 parent 65a1ec0 commit 497d667
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/utils/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ def _is_package_available(pkg_name: str, return_version: bool = False) -> Union[
_tf_available = True
else:
if USE_TF in ENV_VARS_TRUE_AND_AUTO_VALUES and USE_TORCH not in ENV_VARS_TRUE_VALUES:
_tf_available = _is_package_available("tensorflow")
# Note: _is_package_available("tensorflow") fails for tensorflow-cpu. Please test any changes to the line below
# with tensorflow-cpu to make sure it still works!
_tf_available = importlib.util.find_spec("tensorflow") is not None
if _tf_available:
candidates = (
"tensorflow",
Expand Down

0 comments on commit 497d667

Please sign in to comment.