安装显卡驱动

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

cuDNN(CUDA Deep Neural Network library)是专为深度学习优化的GPU加速库,基于NVIDIA的CUDA平台构建,依赖CUDA提供的底层并行计算能力,专注于高效实现神经网络操作(如卷积、池化),两者关系类似于“操作系统与应用软件”或“工作台与专用工具”。‌

版本要和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!

Logo

火山引擎开发者社区是火山引擎打造的AI技术生态平台,聚焦Agent与大模型开发,提供豆包系列模型(图像/视频/视觉)、智能分析与会话工具,并配套评测集、动手实验室及行业案例库。社区通过技术沙龙、挑战赛等活动促进开发者成长,新用户可领50万Tokens权益,助力构建智能应用。

更多推荐