Skip to content

Commit

Permalink
Use epy.lazy_imports in datasets instead of try/except.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 625597756
  • Loading branch information
marcenacp authored and The TensorFlow Datasets Authors committed Apr 17, 2024
1 parent 3a34edd commit b5d261f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tensorflow_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

_TIMESTAMP_IMPORT_STARTS = time.time()
from absl import logging
from etils import epy
import tensorflow_datasets.core.logging as _tfds_logging
from tensorflow_datasets.core.logging import call_metadata as _call_metadata

Expand All @@ -55,7 +56,7 @@
# pytype: disable=import-error
# For builds that don't include all dataset builders, we don't want to fail on
# import errors of dataset builders.
try:
with epy.lazy_imports():
from tensorflow_datasets import audio
from tensorflow_datasets import graphs
from tensorflow_datasets import image
Expand All @@ -79,8 +80,6 @@
from tensorflow_datasets import video
from tensorflow_datasets import vision_language

except ImportError:
pass
# pytype: enable=import-error

_import_time_ms_dataset_builders = int(
Expand Down

0 comments on commit b5d261f

Please sign in to comment.