惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy International News Feed
H
Help Net Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
月光博客
月光博客
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
C
Cisco Blogs
Microsoft Azure Blog
Microsoft Azure Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
L
LINUX DO - 热门话题
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tor Project blog
M
MIT News - Artificial intelligence
L
LINUX DO - 最新话题
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Security Archives - TechRepublic
Security Archives - TechRepublic
IT之家
IT之家
博客园_首页
F
Full Disclosure
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
阮一峰的网络日志
阮一峰的网络日志
Security Latest
Security Latest
S
Security @ Cisco Blogs
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AI
AI
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
A
Arctic Wolf
C
Check Point Blog
S
Securelist
A
About on SuperTechFans

博客园 - 与f

微软的人机验证 docker运行hermes agent python使用docx库对在word中的表格合并操作 Python 项目创建+依赖管理+版本控制 百度飞桨PaddleOCR-VL识别发票图片输出json格式 大模型微调后导出,部署服务然后后端调用 openclaw的一些聊天配置 docker 部署 openclaw 微信小程序显示ai返回的markdown或html C#多端桌面程序(可跨平台) 主流 MySQL 热备份方案 基于SRS(Simple Realtime Server)+ CDN边缘节点加速3个nginx做文件分发1个nginx做负载均衡 一份基于SRS(Simple Realtime Server)+ CDN边缘节点srs edge加速的万人级直播部署清单 HLS(HTTP Live Streaming)标准的视频及加密和解密播放 HLS(HTTP Live Streaming)标准的视频及加密 使用Dockerfile创建一个hyperf容器做为开发环境 docker的hyperf框架docker-compose一键安装 通过vm虚拟中的docker 环境做开发 ubuntu 安装后ssh 连接到服务器 lvm的概念和操作(linux) PHP Attributes 注解 centos 服务器查找一些字符串 Centos8网络配置小工具 Keepalive实现一个高可用负载均衡场景 Keepalived详解:原理、编译安装与高可用集群配置
llama.cpp编译
与f · 2026-03-24 · via 博客园 - 与f

llama.cpp编译

使用 CMake 构建(新版)

说明:llama.cpp 官方已废弃原来的 Makefile 构建方式,推荐改用 CMake 构建方式 来编译模型工具和推理引擎。

如果本地有安装Visual Studio,使用 Visual Studio + CMake 进行构建(适用于 Windows 用户,兼容性最佳):

git clone https://github.com/ggml-org/llama.cpp

cd path/llama.cpp
mkdir build
cd build

# 使用 Visual Studio 生成项目
cmake .. -G "Visual Studio 17 2022" -A x64 -DLLAMA_CURL=OFF
# 或 使用 w64devkit和mingw 生成项目
cmake .. -G "MinGW Makefiles" -DLLAMA_CURL=OFF
# 或一键默认
cmake -S .. -B build
# 编译 Release 模式 cmake --build . --config Release 

如果一切正常,你会在 build/bin/Release 目录下看到生成的程序。

2. 下载模型验证

# 模型下载地址
https://xxx.com/filipealmeida/open-llama-7b-v2-open-instruct-GGUF/blob/main/ggml-model-Q4_0.gguf

# 验证
./llama-cli.exe -m .\models\7B\ggml-model-Q4_0.gguf -p "Tell me a joke." --n-predict 100
#用的是 Qwen3.5-9B-Chat 对话模型,但你没加对话模板,直接丢了一句英文提示词,模型不知道该怎么正常回答,只会输出分析 / 思考,不会给最终答案

llama-cli.exe -m ./Qwen3.5-9B-Q4_K_M.gguf -p "Tell me a joke." --n-predict 2000 --ctx-size 4096 --temp 0.7

#非流式输出
--no-stream

2. 运行模型开启服务

llama-cli.exe -m ./Qwen3.5-9B-Q4_K_M.gguf --server --host 0.0.0.0 --port 8080

llama-cli.exe -m ./Qwen3.5-9B-Q4_K_M.gguf -p "Tell me a joke." --n-predict 2000 --ctx-size 4096 --temp 0.7 --server --host 0.0.0.0 --port 8080


#启动成功后,在浏览器打开
http://127.0.0.1:8080


#curl 命令
curl http://127.0.0.1:8080/completion \
-H "Content-Type: application/json" \
-d '{
"prompt": "Tell me a joke.",
"temperature": 0.7,
"n_predict": 512,
"top_p": 0.9,
"stop": ["\n\n"]
}'

#常用可传参数
{
"prompt": "你的问题",        // 必须
"temperature": 0.7,          // 随机性
"n_predict": 1024,           // 最大生成token
"top_p": 0.9,
"top_k": 40,
"repeat_penalty": 1.1,       // 重复惩罚
"stop": ["<|endoftext|>"]    // 停止符
}


#Python 调用示例
import requests

url = "http://127.0.0.1:8080/completion"
data = {
"prompt": "Hello, who are you?",
"temperature": 0.7,
"n_predict": 512
}

resp = requests.post(url, json=data)
print(resp.json()["content"])


#
http://127.0.0.1:8080/props

下载模型: https://www.modelscope.cn/models