stackoverflow上的一个说法是pytorch 1.4.0是要求cuda capability 3.5(参考https://developer.nvidia.com/cuda-gpus)以上。https://stackoverflow.com/questions/60814545/pytorch-list-of-supported-gpu-hardware-for-each-release-ubuntu18-04
实测1.2.0版本可以把Tensor放到GPU上,不存在1.3.0版本,所以这是能支持的最新版本了。
在这里下载 https://pytorch.org/get-started/previous-versions/
conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
对应的 pytorch-lightning 版本根据发布时间来看应该是0.8.1,实测可用。不过实际编写代码的时候里边有各种bug,还是不要用lightning了,自己手动编写代码训练和测试吧。
Pillow有兼容性问题,使用旧版本
conda install pillow==6.1
# TODO: update for 0.8.0
#if self.use_amp and not self.use_native_amp: 改成下面这样
if APEX_AVAILABLE and self.use_amp and not self.use_native_amp:
nvidia-smi
Sun Nov 6 21:39:38 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 473.81 Driver Version: 473.81 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... WDDM | 00000000:01:00.0 N/A | N/A |
| 43% 0C P8 N/A / N/A | 482MiB / 2048MiB | N/A Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
conda create -n old-torch181 python=3.7 --yes
if __name__ == '__main__':
import torch
print(torch.cuda.is_available())
print(torch.cuda.device_count())
print(torch.cuda.device(0))
print(torch.cuda.get_device_name(0))
print(torch.__version__)
# 返回True 接着用下列代码进一步测试
print(torch.zeros(1).cuda())
True
1
<torch.cuda.device object at 0x00000177A821B388>
NVIDIA GeForce GT 720
1.2.0
tensor([0.], device='cuda:0')
anyio==3.5.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
attrs==21.4.0
Babel==2.9.1
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==4.1.0
brotlipy==0.7.0
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.0.4
colorama==0.4.5
cryptography==38.0.1
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
fastjsonschema==2.16.2
future==0.18.2
idna==3.4
importlib-metadata==4.11.3
importlib-resources==5.2.0
ipykernel==6.15.2
ipython==7.31.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
jedi==0.18.1
Jinja2==3.1.2
json5==0.9.6
jsonschema==4.16.0
jupyter==1.0.0
jupyter_client==7.3.5
jupyter-console==6.4.3
jupyter_core==4.11.1
jupyter-server==1.18.1
jupyterlab==3.4.4
jupyterlab-pygments==0.1.2
jupyterlab_server==2.15.2
jupyterlab-widgets==1.0.0
Markdown==3.4.1
MarkupSafe==2.1.1
matplotlib-inline==0.1.6
mistune==0.8.4
mkl-fft==1.3.1
mkl-random==1.2.2
mkl-service==2.4.0
nbclassic==0.3.5
nbclient==0.5.13
nbconvert==6.4.4
nbformat==5.5.0
nest-asyncio==1.5.5
notebook==6.4.12
numpy==1.21.5
packaging==21.3
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.2.0
pip==22.2.2
pkgutil_resolve_name==1.3.10
prometheus-client==0.14.1
prompt-toolkit==3.0.20
protobuf==3.20.1
psutil==5.9.0
pycparser==2.21
Pygments==2.11.2
pyOpenSSL==22.0.0
pyparsing==3.0.9
pyrsistent==0.18.0
PySocks==1.7.1
python-dateutil==2.8.2
pytorch-lightning==0.8.5
pytz==2022.1
pywin32==302
pywinpty==2.0.2
PyYAML==6.0
pyzmq==23.2.0
qtconsole==5.3.2
QtPy==2.2.0
requests==2.28.1
Send2Trash==1.8.0
setuptools==65.5.0
sip==4.19.13
six==1.16.0
sniffio==1.2.0
soupsieve==2.3.2.post1
tensorboard==1.14.0
terminado==0.13.1
testpath==0.6.0
torch==1.8.1
torchaudio==0.8.1
torchvision==0.9.1
tornado==6.2
tqdm==4.64.1
traitlets==5.1.1
typing_extensions==4.3.0
urllib3==1.26.12
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==0.58.0
Werkzeug==2.2.2
wheel==0.37.1
widgetsnbextension==3.5.2
win-inet-pton==1.1.0
wincertstore==0.2
zipp==3.8.0