Skip to content

Commit 8122974

Browse files
author
The TensorFlow Datasets Authors
committed
Return builder.info when the out_file_format requested is not already an alternative file format.
PiperOrigin-RevId: 687205140
1 parent 6b4b728 commit 8122974

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tensorflow_datasets/scripts/cli/convert_format_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,14 @@ def _get_info_for_dirs_to_convert(
320320
os.fspath(to_dir),
321321
)
322322
return builder.info
323+
else:
324+
logging.info(
325+
'The file format to convert to (%s) is not an alternative file format'
326+
' of the dataset in %s. Converting the dataset.',
327+
out_file_format.value,
328+
os.fspath(from_dir),
329+
)
330+
return builder.info
323331

324332

325333
def _convert_dataset_dirs(
@@ -343,7 +351,6 @@ def _convert_dataset_dirs(
343351
desired.
344352
"""
345353
logging.info('Converting %d datasets.', len(from_to_dirs))
346-
347354
found_dataset_versions: dict[epath.Path, dataset_info.DatasetInfo] = {}
348355

349356
if num_workers > 1:
@@ -378,7 +385,6 @@ def _process_get_infos(from_to_dir):
378385
)
379386
if info is not None:
380387
found_dataset_versions[from_dir] = info
381-
382388
convert_dataset_fn = functools.partial(
383389
_convert_dataset,
384390
out_file_format=out_file_format,

0 commit comments

Comments
 (0)