IndexError: list index out of range using datasets.UCF101

Traceback (most recent call last):

File “/home/Andy/code/UCF101 with Pytorch.py”, line 33, in

train_loader = torch.utils.data.DataLoader(train_dataset, batch_size=batch_size, shuffle=True,

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/home/Andy /miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py”, line 351, in init

sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type]

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/home/Andy/miniconda3/lib/python3.12/site-packages/torch/utils/data/sampler.py”, line 143, in init

if not isinstance(self.num_samples, int) or self.num_samples <= 0:

                 ^^^^^^^^^^^^^^^^

File “/home/Andy/miniconda3/lib/python3.12/site-packages/torch/utils/data/sampler.py”, line 150, in num_samples

return len(self.data_source)

      ^^^^^^^^^^^^^^^^^^^^^

File “/home/Andy/miniconda3/lib/python3.12/site-packages/torchvision/datasets/ucf101.py”, line 122, in len

return self.video_clips.num_clips()

      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File “/home/Andy/miniconda3/lib/python3.12/site-packages/torchvision/datasets/video_utils.py”, line 263, in num_clips

return self.cumulative_sizes[-1]

      ~~~~~~~~~~~~~~~~~~~~~^^^^

IndexError: list index out of range

OS:Ubuntu22.04LTS
torch version:2.4.1