How to slice Kinetics400 training dataset?

I am trying to run the official script for video classification.
I want to tweak some functions and running through all examples would cost me too much time.
I wonder how can I slice the training kinetics dataset based on that script.
This is the code I added before
train_sampler = RandomClipSampler(dataset.video_clips, args.clips_per_video)
in the script: (let’s say I just want to run 100 examples.)

tr_split_len = 100
dataset =, [tr_split_len, len(dataset)-tr_split_len])[0]

Then when hitting train_sampler = RandomClipSampler(dataset.video_clips, args.clips_per_video)
, it pops out the error:

AttributeError: 'Subset' object has no attribute 'video_clips'

Yeah, so the type of dataset converts from torchvision.datasets.kinetics.Kinetics400 to
I understand. So how can I do it? (hopefully not the way using break in the dataloader loop).

Based on your code snippet it seems dataset is supposed to contain an attribute called video_clips.
Since you are passing this dataset to random_split, I assume each clip would be returned in the __getitem__ or would it return a sample for one clip?
In the latter case, I assume the usage of random_split is wrong, as it would remove clips, which the RandomClipSampler is for.