NoneType object has no attribute origin
Kong Liangqian Lv6

该错误来自于

1
from torch_geometric.data import InMemoryDataset

原因在于pytorch和torch_geometric的版本不正确,下面是正确的版本

1
2
3
4
5
6
7
8
torch                             1.8.2+cu111
torch-cluster 1.5.9
torch-geometric 1.7.2
torch-scatter 2.0.8
torch-sparse 0.6.13
torch-spline-conv 1.2.1
torchaudio 0.8.2
torchvision 0.9.2+cu111

NVIDIA驱动确认

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ nvidia-smi
Wed May 4 23:56:55 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.103.01 Driver Version: 470.103.01 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 On | N/A |
| N/A 45C P8 7W / N/A | 548MiB / 5926MiB | 9% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1193 G /usr/lib/xorg/Xorg 253MiB |
| 0 N/A N/A 1507 G /usr/bin/gnome-shell 125MiB |
| 0 N/A N/A 72007 G ...AAAAAAAAA= --shared-files 22MiB |
| 0 N/A N/A 80325 G ...RendererForSitePerProcess 44MiB |
| 0 N/A N/A 80710 G ...745551279139901666,131072 95MiB |
+-----------------------------------------------------------------------------+

只要有这个存在,就代表已经有了NVIDIA驱动,版本号为Driver Version: 470.103.01

pytorch的cuda版本确定

从这里选择cuda 11.1,注意虽然NVIDIA smi写着CUDA Version: 11.4 ,但是官网https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html 指出,其实只要显卡驱动版本大于450的即可https://pytorch.org/get-started/locally/

从这里可以看见,stable(1.11.0)版本的PyTorch支持到cuda 11.3,LTS版的1.8.2支持到cuda 11.1

这里我下载LTS版的1.8.2

1
pip3 install torch==1.8.2+cu111 torchvision==0.9.2+cu111 torchaudio==0.8.2 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html

cuda下载

https://developer.nvidia.com/cuda-11.1.1-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=2004&target_type=runfilelocal

从这里选择cuda 11.1,注意虽然NVIDIA smi写着CUDA Version: 11.4 ,但是官网https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html 指出,其实只要显卡驱动版本大于450的即可

pytorch-geometric依赖包下载

可以从pytorch-geometric的官网https://data.pyg.org/whl/ 查找对应pytorch+cu111的其他包

 Comments