安装显卡驱动
https://www.nvidia.cn/drivers/details/242443/
安装最新的驱动,不能用windows自动安装的驱动,版本太低了
安装CUDA
https://developer.nvidia.com/cuda-12-6-3-download-archive?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_local
目前相关库支持的最新版本是12.6,不要装最新的。
显卡算力表:
算力与CUDA版本对应表:
下载对应版本的CUDA
安装cuDNN
https://developer.nvidia.com/cudnn-downloads?target_os=Windows&target_arch=x86_64&target_version=Agnostic&cuda_version=12
版本要和CUDA的对应
安装pytorch
https://pytorch.org/get-started/locally/
选择好后,运行最下面的命令
确认pythorch使用的是显卡:
在ipython中运行:
In [1]: import torch
In [2]: print(torch.__version__)
2.6.0+cu126
"cu126"说明使用的是显卡。
如果是“cpu"说明用的是cpu。
安装bitsandbytes
pip install --upgrade bitsandbytes[cuda126]
“126”是cuda一样的版本号。
查看安装是否成功:
python -m bitsandbytes
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++ BUG REPORT INFORMATION ++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++ OTHER +++++++++++++++++++++++++++
CUDA specs: CUDASpecs(highest_compute_capability=(8, 6), cuda_version_string='126', cuda_version_tuple=(12, 6))
PyTorch settings found: CUDA_VERSION=126, Highest Compute Capability: (8, 6).
To manually override the PyTorch CUDA version please see: https://github.com/TimDettmers/bitsandbytes/blob/main/docs/source/nonpytorchcuda.mdx
The directory listed in your path is found to be non-existent: \XGW-AI
The directory listed in your path is found to be non-existent: C:\Users\xgw10\Documents\WindowsPowerShell\Modules
CUDA SETUP: WARNING! CUDA runtime files not found in any environmental path.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++ DEBUG INFO END ++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Checking that the library is importable and CUDA is callable...
SUCCESS!
Installation was successful!