You could set it up so the dataloader itself works through the files in that manner? i.e. rather than break the files up in an external loop, create a custom dataset that breaks the files up into timestep chunks for you.