File tree Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Expand file tree Collapse file tree 2 files changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -476,10 +476,11 @@ def _file_instructions_for_split(
476
476
) -> List [shard_utils .FileInstruction ]:
477
477
"""Returns the file instructions from the given instruction applied to the given split info."""
478
478
if not split_info .num_examples :
479
- raise ValueError (
480
- "Shard empty. This might means that dataset hasn't been generated "
481
- 'yet and info not restored from GCS, or that legacy dataset is used.'
479
+ logging . warning (
480
+ 'Split %s has no examples. Skipping file instructions.' ,
481
+ split_info . name ,
482
482
)
483
+ return []
483
484
to = split_info .num_examples if instruction .to is None else instruction .to
484
485
return shard_utils .get_file_instructions (
485
486
from_ = instruction .from_ or 0 ,
Original file line number Diff line number Diff line change @@ -627,20 +627,18 @@ def test_touching_boundaries(self):
627
627
self .assertEqual (files , [])
628
628
629
629
def test_missing_shard_lengths (self ):
630
- with self .assertRaisesWithPredicateMatch (ValueError , 'Shard empty.' ):
631
- filename_template = _filename_template (
632
- split = 'train' , dataset_name = 'mnist'
633
- )
634
- split_infos = [
635
- splits .SplitInfo (
636
- name = 'train' ,
637
- shard_lengths = [],
638
- num_bytes = 0 ,
639
- filename_template = filename_template ,
640
- ),
641
- ]
642
- splits_dict = splits .SplitDict (split_infos = split_infos )
643
- _ = splits_dict ['train' ].file_instructions
630
+ filename_template = _filename_template (split = 'train' , dataset_name = 'mnist' )
631
+ split_infos = [
632
+ splits .SplitInfo (
633
+ name = 'train' ,
634
+ shard_lengths = [],
635
+ num_bytes = 0 ,
636
+ filename_template = filename_template ,
637
+ ),
638
+ ]
639
+ splits_dict = splits .SplitDict (split_infos = split_infos )
640
+ files = splits_dict ['train' ].file_instructions
641
+ self .assertEqual (files , [])
644
642
645
643
646
644
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments