Open-Sora: Democratizing Efficient Video Production for All
Python
[fix] exception handling for dataset
zhengzangw11faae8db6cf
diff --git a/opensora/datasets/datasets.py b/opensora/datasets/datasets.pyindex ddb28bb..fbb691f 100644--- a/opensora/datasets/datasets.py+++ b/opensora/datasets/datasets.py@@ -174,3 +174,14 @@ class VariableVideoTextDataset(VideoTextDataset):if self.get_text:ret["text"] = sample["text"]return ret++ def __getitem__(self, index):+ for _ in range(10):+ try:+ return self.getitem(index)+ except Exception as e:+ index, num_frames, height, width = [int(val) for val in index.split("-")]+ path = self.data.iloc[index]["path"]+ print(f"data {path}: {e}")+ index = np.random.randint(len(self))+ raise RuntimeError("Too many bad data.")