mirror of
https://github.com/hpcaitech/Open-Sora.git
synced 2026-04-10 12:49:38 +02:00
[data] added error handling to dataset
This commit is contained in:
parent
7115864314
commit
6a72b8910b
|
|
@ -111,6 +111,9 @@ def prepare_dataloader(
|
|||
|
||||
|
||||
def collate_fn_default(batch):
|
||||
# filter out None
|
||||
batch = [x for x in batch if x is not None]
|
||||
|
||||
# HACK: for loading text features
|
||||
use_mask = False
|
||||
if "mask" in batch[0] and isinstance(batch[0]["mask"], int):
|
||||
|
|
@ -132,6 +135,9 @@ def collate_fn_batch(batch):
|
|||
"""
|
||||
Used only with BatchDistributedSampler
|
||||
"""
|
||||
# filter out None
|
||||
batch = [x for x in batch if x is not None]
|
||||
|
||||
res = torch.utils.data.default_collate(batch)
|
||||
|
||||
# squeeze the first dimension, which is due to torch.stack() in default_collate()
|
||||
|
|
|
|||
|
|
@ -190,7 +190,10 @@ class VariableVideoTextDataset(VideoTextDataset):
|
|||
return ret
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.getitem(index)
|
||||
try:
|
||||
return self.getitem(index)
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
@DATASETS.register_module()
|
||||
|
|
|
|||
Loading…
Reference in a new issue