当前位置: 首页 > news >正文

llama.cpp部署 DeepSeek-R1 模型

一、llama.cpp 介绍

使用纯 C/C++推理 Meta 的LLaMA模型(及其他模型)。主要目标llama.cpp是在各种硬件(本地和云端)上以最少的设置和最先进的性能实现 LLM 推理。纯 C/C++ 实现,无任何依赖项Apple 芯片是一流的——通过 ARM NEON、Accelerate 和 Metal 框架进行了优化AVX、AVX2、AVX512 和 AMX 支持 x86 架构1.5 位、2 位、3 位、4 位、5 位、6 位和 8 位整数量化,可加快推理速度并减少内存使用用于在 NVIDIA GPU 上运行 LLM 的自定义 CUDA 内核(通过 HIP 支持 AMD GPU,通过 MUSA 支持 Moore Threads MTT GPU)Vulkan 和 SYCL 后端支持CPU+GPU 混合推理,部分加速大于 VRAM 总容量的模型。

Github 地址:https://github.com/ggerganov/llama.cpp
下载地址:https://github.com/ggerganov/llama.cpp/releases

二、 llama.cpp安装

llama.cpp:基于C++重写了 LLaMa 的推理代码,是一种推理框架。支持动态批处理,支持混合推理。
llama.cpp:只支持 gguf 格式的模型,可以自己生成或从 huggingface 等平台下载 gguf 格式的模型;
在这里插入图片描述

2.1、llama.cpp:纯 CPU 运行,并且支持 avx512 指令集,

地址:https://github.com/ggerganov/llama.cpp/releases/download/b4658/llama-b4658-bin-win-avx512-x64.zip,
#运行参数配置:https://github.com/ggerganov/llama.cpp/tree/master/examples/server
#下载完成后,解压到 D:\llama-b4658-bin-win-avx512-x64 目录

linux

##llama.cpp
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp/
make

##下载模型并转换
conda create -n llamacpp python=3.12
conda activate llamacpp
pip install -r requirements.txt

###下载模型到 models/ 目录下
cd models
sudo apt-get install git-lfs
# or
git lfs install
git clone https://www.modelscope.cn/qwen/Qwen2-0.5B-Instruct.git
./llama-cli -m models/Qwen2-0.5B-Instruct/Qwen2-0.5B-Instruct-F
16.gguf -p hello -n 256
$推理测试

2.2、DeepSeek-R1 模型

下载地址:https://hf-mirror.com/lmstudio-community/DeepSeek-R1-Distill-Qwen-1.5B-GGUF/tree/main,本文以#“DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_L.gguf”为例。

在这里插入图片描述

2.3llama.cpp 部署 DeepSeek-R1 模型

在 DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_L.gguf 文件目录下面执行如下命令:
chcp 65001

set PATH=D:\llama-b4658-bin-win-avx512-x64;%PATH%

llama-server -m DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_L.gguf --port 8080

在这里插入图片描述

使用浏览器打开 http://127.0.0.1:8080/ 地址进行测试,

curl --request POST \
    --url http://localhost:8080/completion \
    --header "Content-Type: application/json" \
    --data '{"prompt": "

Building a website can be done in 10 simple steps:",“n_predict”: 128}’

相关文章:

  • 滚珠花键润滑脂的作用!
  • 为AI聊天工具添加一个知识系统 之102 详细设计之43 自性三藏 之3 祖传代码
  • 机器学习:多项式回归
  • Linux之【网络I/O】前世今生(二)
  • Spring生态体系深度解析:现代Java开发的核心架构
  • IoTDB 导入数据时提示内存不足如何处理
  • 【深度强化学习】策略梯度算法:REINFORCE
  • 【ISO 14229-1:2023 UDS诊断全量测试用例清单系列:第二十节】
  • Deepseek与GPT都还是人机环境系统智能的初级产品
  • 3D可视化定制:开启个性化消费新时代
  • npm包管理工具
  • Linux中退出vi编辑器的命令
  • 全面理解-c++11中的智能指针
  • C语言初阶牛客网刷题——JZ65 不用加减乘除做加法】【难度:简单】
  • SAIL-RK3576单板运行7b的deepseek对话模型
  • uvm错误记录4
  • wps接入DeepSeek教程
  • 本地安装了mysql导致phpstudy无法启动
  • 解锁OCP认证:通往数据库精英之路
  • 微软AutoGen高级功能——Memory
  • 网站制作需要什么/嘉兴网站建设方案优化
  • 网络营销的特点有几个/免费seo课程
  • 找个美工做淘宝网站需要多少钱/seo优化报价公司
  • 建设机械员证书查询网站/2022年最新热点素材
  • 湖南建设信息网站/微信小程序官网
  • 网页设计网站制作收获/龙泉驿网站seo