Is it possible to permanently move a complete dataset to GPU memory before training? #20554
Unanswered
NiklasKappel
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a very small dataset on disk. I do not need to do any data augmentation. I would like to load the dataset into CPU memory, then move it to GPU memory, then proceed with training as usual. Is this possible and supported by lightning? What would be the best way to go about it?
In my mind, if I have only one GPU, the whole dataset should be in that GPU's memory. If I have multiple GPUs, one copy of the dataset should be in each GPU's memory.
In the single GPU case, I think I can move the dataset to GPU by calling
.to("cuda")
once on each tensor in the dataset. Then I would like to pass the dataset into a regular PyTorchdataloader
and pass that dataloader to the lightning trainer's.fit
method. Would that be correct?Beta Was this translation helpful? Give feedback.
All reactions