Skip to content

Commit 64c483b

Browse files
tomvdwThe TensorFlow Datasets Authors
authored andcommitted
Only write updated dataset_info.json when adding a new format
PiperOrigin-RevId: 684334542
1 parent d2ae526 commit 64c483b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tensorflow_datasets/core/dataset_info.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,10 @@ def write_to_directory(
668668
self.redistribution_info.license
669669
)
670670

671+
self.write_dataset_info_json(dataset_info_dir)
672+
673+
def write_dataset_info_json(self, dataset_info_dir: epath.PathLike) -> None:
674+
"""Writes only the dataset_info.json file to the given directory."""
671675
dataset_info_path(dataset_info_dir).write_text(self.as_json)
672676

673677
def read_from_directory(self, dataset_info_dir: epath.PathLike) -> None:

tensorflow_datasets/scripts/cli/convert_format_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def convert_metadata(
178178
# Add the file format to `alternative_file_formats` field.
179179
if out_file_format not in info.alternative_file_formats:
180180
info.add_alternative_file_format(out_file_format.value)
181-
info.write_to_directory(out_path)
181+
info.write_dataset_info_json(out_path)
182182
else:
183183
logging.info(
184184
'File format %s is already an alternative file format of the dataset'

0 commit comments

Comments
 (0)