The invalid indices are just used to avoid situations like:
1_1,
1_2, # ok, because sequential

2_3,
2_4, # ok, because sequential

3_6,
4_1, # not ok, because from different sequence (3 vs. 4)

If that’s alright, you could skip the invalid indices, but as I said, the DataLoader will return “sequential” samples from different sequences.