Skip to content

Commit b5d261f

Browse files
marcenacpThe TensorFlow Datasets Authors
authored and
The TensorFlow Datasets Authors
committed
Use epy.lazy_imports in datasets instead of try/except.
PiperOrigin-RevId: 625597756
1 parent 3a34edd commit b5d261f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: tensorflow_datasets/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
_TIMESTAMP_IMPORT_STARTS = time.time()
4242
from absl import logging
43+
from etils import epy
4344
import tensorflow_datasets.core.logging as _tfds_logging
4445
from tensorflow_datasets.core.logging import call_metadata as _call_metadata
4546

@@ -55,7 +56,7 @@
5556
# pytype: disable=import-error
5657
# For builds that don't include all dataset builders, we don't want to fail on
5758
# import errors of dataset builders.
58-
try:
59+
with epy.lazy_imports():
5960
from tensorflow_datasets import audio
6061
from tensorflow_datasets import graphs
6162
from tensorflow_datasets import image
@@ -79,8 +80,6 @@
7980
from tensorflow_datasets import video
8081
from tensorflow_datasets import vision_language
8182

82-
except ImportError:
83-
pass
8483
# pytype: enable=import-error
8584

8685
_import_time_ms_dataset_builders = int(

0 commit comments

Comments
 (0)