File tree Expand file tree Collapse file tree 1 file changed +21
-5
lines changed
tensorflow_datasets/scripts/cli Expand file tree Collapse file tree 1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -475,16 +475,32 @@ def _get_info_for_dirs_to_convert(
475
475
return None
476
476
in_file_format = file_adapters .FileFormat (dataset_info_proto .file_format )
477
477
if out_file_format == in_file_format :
478
- raise ValueError (
479
- f'The file format of the dataset ({ in_file_format } ) is the'
480
- f' same as the specified out file format! ({ out_file_format } )'
481
- )
478
+ if os .fspath (from_dir ) == os .fspath (to_dir ):
479
+ logging .warning (
480
+ 'The file format to convert to (%s) is already the default file'
481
+ ' format of the dataset in %s, and no different output folder is'
482
+ ' specified. Skipping conversion.' ,
483
+ out_file_format .value ,
484
+ os .fspath (from_dir ),
485
+ )
486
+ return None
487
+ else :
488
+ logging .info (
489
+ 'The file format to convert to (%s) is the same as the default file'
490
+ ' format, but the converted output is being written to a different'
491
+ ' folder. The shards will be converted anyway from: %s, to: %s' ,
492
+ out_file_format .value ,
493
+ os .fspath (from_dir ),
494
+ os .fspath (to_dir ),
495
+ )
496
+ return dataset_info_proto
482
497
if out_file_format .file_suffix in dataset_info_proto .alternative_file_formats :
483
498
if overwrite :
484
499
logging .warning (
485
500
'The file format to convert to (%s) is already an alternative file'
486
- ' format. Overwriting the shards!' ,
501
+ ' format for the dataset in %s . Overwriting the shards!' ,
487
502
out_file_format .value ,
503
+ os .fspath (from_dir ),
488
504
)
489
505
elif os .fspath (from_dir ) == os .fspath (to_dir ):
490
506
logging .info (
You can’t perform that action at this time.
0 commit comments