I’m glad it’s working.
However, I would like to make sure to understand the issue properly.
Usually you would lazily load the data onto the CPU in your Dataset using a DataLoader.
Then in the training loop you would push the data and target to the GPU.
Using this approach you will use minimal amount of your (limited) GPU memory to store the data.
Otherwise if you load all data onto the GPU you are wasting GPU memory, which might limit your model size etc.
This approach might still be alright, if your model is quite small, but I would generally not recommend it.