Add Flax dummy objects (#7918)

This commit is contained in:
Sylvain Gugger
2020-10-20 07:45:48 -04:00
committed by GitHub
parent 3e31e7f956
commit 6d4f8bd02a
4 changed files with 102 additions and 5 deletions

View File

@@ -356,6 +356,12 @@ installation page: https://www.tensorflow.org/install and follow the ones that m
"""
FLAX_IMPORT_ERROR = """
{0} requires the FLAX library but it was not found in your enviromnent. Checkout the instructions on the
installation page: https://github.com/google/flax and follow the ones that match your enviromnent.
"""
def requires_datasets(obj):
name = obj.__name__ if hasattr(obj, "__name__") else obj.__class__.__name__
if not is_datasets_available():
@@ -386,6 +392,12 @@ def requires_tf(obj):
raise ImportError(TENSORFLOW_IMPORT_ERROR.format(name))
def requires_flax(obj):
name = obj.__name__ if hasattr(obj, "__name__") else obj.__class__.__name__
if not is_flax_available():
raise ImportError(FLAX_IMPORT_ERROR.format(name))
def requires_tokenizers(obj):
name = obj.__name__ if hasattr(obj, "__name__") else obj.__class__.__name__
if not is_tokenizers_available():