I could say torch.utils.data.Subset 1, but I will say: Split your CSV or mark the split there through a column.
“Information leaks” from the training set into the validation / test sets is an extremely easy way to invalidate your results. It happens to often enough to be extra-safe.
Best regards
Thomas