Moving forward, one needs to be mindful of the cuda and pytorch compatibility matrix during the installation process. import torch.nn.utils.prune as prune device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = C3D(num_classes=2).to(device=device) prune.random_unstructured(module, name="weight", amount=0.3) parameters_to_prune = ( (model.conv2, 'weight'), (model.conv3a, 'weight'), (model.conv3b, 'weight'), (model.conv4a, ⦠python main.py --batch_size 2 --resume https://dl.fbaipublicfiles.com/detr/detr-r50-e632da11.pth --jrdb_path datasets/jrdb (jrdb_path is path to my dataset) I get the following error. Typical use includes initializing the parameters of a model (see also torch.nn.init ). I tried to reinstall the pytorch and update to the newest version (1.4.0), still exists error. ææ¯æ ç¾ï¼ python ç¬è®° pycharmæ¥éè§£å³æ¹æ¡ pycharm pytorch AttributeError: module 'torch' has no attribute 'is_cuda' Hi, Thank you for posting your questions. AttributeError: module âtorch.cudaâ has no attribute âampâ µä¸module 'torch' has no attribute 'form_numpy'é®é¢çè§£å³. AttributeError: module 'torch' has no attribute 'is_cuda' As per #7123, I added another line when setting up the environment and changed to cuda111 (since pytroch stable does not yet support cu112 ): pip install torch==1.9.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html pip install spacy [transformers, cuda111] spacy download en_core_web_trf.