In that case don’t use DataLoader. Batch the data yourself using a for loop and then feed each batch into the model one batch at a time with another loop.
do something like:
sudo code
for i in number of epochs:
    for j in number of subjects:
        index = which(X == j)
   
        #your model training function
        data = x[index]
        target = y[index]
        output = model(x)
        #compute your loss
        #do your back propagation
        #get your training and or validation loss
        #save model at epoch j