Train directories multiple times

My data directory is as follows:

data/
|–folder1/
|–folder2/
|–folder3/

I wanted to train multiple models in which test split contain folder1 and train split contains and folder2 and folder3

second, test contains folder2 and train contains folder1 and folder2 and so on…

A simple way is I can permutate folders and in a for loop use data loader and train and save weights for each model. Is there an efficient way to do this?