Relative Content

Tag Archive for pytorch

CUDA not available in PyTorch after having the toolkit installed

This problem started a while ago when I uninstalled my CUDA version 12.4 and installed 11.2 since pytorch had some issues with 12.4 . But even after having the new version installed when I check , it shows my CUDA to be unavailable even after I checked the availability in the cmd .

CUDA not available in PyTorch after having the toolkit installed

This problem started a while ago when I uninstalled my CUDA version 12.4 and installed 11.2 since pytorch had some issues with 12.4 . But even after having the new version installed when I check , it shows my CUDA to be unavailable even after I checked the availability in the cmd .

torch.cuda.OutOfMemoryError when training model on GPU, but not for larger batch sizes on CPU

I am working on training a MultiModal model in PyTorch. I have a training loop which runs just fine (albeit slowly) on my CPU (I tested up to batch size = 32). However, when I try to run it on a GPU (Tesla P40), it only works up to batch size = 2. With larger batch sizes it throws a torch.cuda.OutOfMemoryError. I am working with pre embedded video and audio, and pre tokenized text. Is it possible that the GPU can really not handle batch sizes larger than 2 or could there be something wrong in my code? Do you have any advice on how I might go about troubleshooting? I apologize for this simple question, it is my first time working with a GPU cluster. I am running this code on my university’s GPU cluster and have double checked that the GPU I am using is not being used by anyone else.

Correct way to swap PyTorch tensors without copying

I have two PyTorch tensors x, y with the same dimensions. I would like to swap the data behind the two tensors, ideally without having to copy. The purpose of this is to have code elsewhere that holds onto the tensor x to now read & write the data y and vice-versa.