Skip to content

Commit 1b317d2

Browse files
fineguyThe TensorFlow Datasets Authors
authored andcommitted
Fix dataset_info.py
PiperOrigin-RevId: 685692259
1 parent d5af645 commit 1b317d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tensorflow_datasets/core/dataset_info.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,12 +734,12 @@ def read_from_directory(self, dataset_info_dir: epath.PathLike) -> None:
734734
dataset_info_dir
735735
)
736736

737-
# If the dataset was loaded from file, self.metadata will be `None`, so
738-
# we create a MetadataDict first.
739-
if not self._metadata:
740-
self._metadata = MetadataDict()
741737
# Restore the MetaDataDict from metadata.json if there is any
742738
if _metadata_filepath(dataset_info_dir).exists():
739+
# If the dataset was loaded from file, self.metadata will be `None`, so
740+
# we create a MetadataDict first.
741+
if self._metadata is None:
742+
self._metadata = MetadataDict()
743743
self._metadata.load_metadata(dataset_info_dir)
744744

745745
# Update fields which are not defined in the code. This means that

0 commit comments

Comments
 (0)