This note is for things with PyTorch. Personal notes only.

Installation

Errors when installing

Problem with CUDA version

For example, need to install corresponding versions: torch==1.2.0 <- torchvision==0.4.0 <- Pillow<7.0.0

pip3 install -U torch==1.2.0
pip3 install -U torchvision==0.4.0
pip3 install -U "pillow<7"

Another option (worked on XPS 15 7950): torch==1.5.1, torchvision==0.6.1, pillow==7.2.0 (with nvcc --version is 11.1).

NVIDIA too old

Problem The NVIDIA driver on your system is too old (found version 10010).

From this website, problem is solved by

  1. Switching from nvidia-driver-435 to nvidia-driver-440.
  2. Restart the computer.

It works on Dell XPS 7950 whose GPU is NVIDIA GTX 1650.

Other errors

🔅 RuntimeError: cuda runtime error (804) : forward compatibility was attempted on non supported HW at /pytorch/aten/src/THC/THCGeneral.cpp:47 (after update system including nvdia-cli, maybe): check this note.

Import

import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim