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
相关推荐
卷无止境3 小时前
用 SimPy 做离散事件仿真:时钟不走步,事件自己排队
后端·python
撸码猿4 小时前
数据采集场景的语序点选验证码:90.2% 整词准确率的本地 OCR 实践
python·ocr
用户0332126663674 小时前
使用 Python 在 Excel 中创建折线图和条形图
python·excel
木子欢儿5 小时前
Ubuntu 26.04 LTS 安装Python 3.12
linux·运维·服务器·python·ubuntu
Wellijohn6 小时前
Python 异步并发:我把 5 个坑踩完了,你照着抄模板就行
python
AI创界者6 小时前
Python 进阶实战(六十二章):分布式定时任务、异步工作流与幂等补偿机制实战
人工智能·python·aigc
炸薯条!7 小时前
Python面向对象基础:类与对象、实例方法、魔法方法和属性详解
java·开发语言·python
tryCbest8 小时前
Python 爬虫从入门到实战(二):进阶篇——反爬对抗、并发与动态页面
开发语言·爬虫·python
VIP_CQCRE8 小时前
GPT Image 2.6 动态表情交付别只发预览:GIF 文件校验、哈希清单与下载排错
图像处理·人工智能·python·gif
2601_967987378 小时前
使用 NumPy 和 Python 实现梯度下降
python·机器学习·线性回归·numpy·梯度下降