win11编译llama_cpp_python cuda128 RTX30/40/50版本

Geforce 50xx系显卡最低支持cuda128,llama_cpp_python官方源只有cpu版本,没有cuda版本,所以自己基于0.3.5版本源码编译一个RTX 30xx/40xx/50xx版本。

1. 前置条件

  1. 访问https://developer.download.nvidia.cn/compute/cuda/12.8.0/local_installers/cuda_12.8.0_571.96_windows.exe安装cuda12.8 toolkit, 安装完成后在命令行输入"nvcc -V"确认如下信息:
bash 复制代码
Cuda compilation tools, release 12.8, V12.8.61
  1. 使用visual studio installer 安装visual studio 2022,工作负荷选择【使用c++的桌面开发】,安装完成后将"VC\Tools\MSVC\<版本号>\bin\Hostx64\x64 "对1应的路径加入环境变量

  2. 访问https://github.com/abetlen/llama-cpp-python/archive/refs/tags/v0.3.5-metal.tar.gz下载源码(国内镜像),下载后解压; 访问 https://github.com/ggml-org/llama.cpp/archive/refs/tags/b4831.tar.gz下载源码(国内镜像),下载后解压到 "llama_cpp_python\vendor\llama.cpp"

  3. 访问https://github.com/conda-forge/miniforge/releases/download/24.11.3-0/Miniforge3-Windows-x86_64.exe安装miniforge;

2. 编译

bash 复制代码
conda create llama_build
conda activate llama_build
conda install ccahce
pip install build wheel

set CMAKE_ARGS=-DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86;89;120

cd C:\llama_cpp_python
python -m build --wheel
相关推荐
二闹7 分钟前
Python打印值的两种写法,到底有啥不同?
python
站大爷IP16 分钟前
Python构建MCP服务器:从工具封装到AI集成的全流程实践
python
深盾安全2 小时前
Python 装饰器详解
python
前端小趴菜052 小时前
python - 数据类型转换
python
跟橙姐学代码3 小时前
学Python必须迈过的一道坎:类和对象到底是什么鬼?
前端·python
卡洛斯(编程版3 小时前
(1) 哈希表全思路-20天刷完Leetcode Hot 100计划
python·算法·leetcode
FreakStudio4 小时前
一文速通 Python 并行计算:教程总结
python·pycharm·嵌入式·面向对象·并行计算
群联云防护小杜4 小时前
从一次 DDoS 的“死亡回放”看现代攻击链的进化
开发语言·python·linq
Ice__Cai4 小时前
Flask 入门详解:从零开始构建 Web 应用
后端·python·flask·数据类型
霸敛4 小时前
好家园房产中介网后台管理完整(python+flask+mysql)
开发语言·python·flask