2026.1月llama.cpp的最新进展:在AIStudio推理Llama-3-8B-Instruct-Coder.Q6_K.gguf模型

先上结论,在AIStudio上cpu推理非常慢,怎么说呢,速度回到了一年前,真不适应这么慢。所以没法在AIStudio上用。

官网:ggml-org/llama.cpp: LLM inference in C/C++

下载llama.cpp源代码

复制代码
git clone https://gitcode.com/GitHub_Trending/ll/llama.cpp

编译llama.cpp

复制代码
cd llama.cpp


cmake -B build
cmake --build build --config Release

加入路径

复制代码
export PATH=/home/aistudio/llama.cpp/build/bin:$PATH

看看版本

llama-cli --version

version: 7815 (091a46cb8)

built with GNU 9.4.0 for Linux x86_64

aistudio@jupyter-141218-5919289:~/llama.cpp$

在魔搭选模型:

Qwen3-Coder-30B-A3B-Instruct-GGUF · 模型库

刚开始选了这个,但是下载太慢了,而且占用空间太大(忘记只下载一个了),导致空间超出而报错。

后来选了这个:Llama-3-8B,并且只下一个模型文件。

下载模型Llama-3-8B

复制代码
pip install modelscope
modelscope download --model QuantFactory/Llama-3-8B-Instruct-Coder-GGUF Llama-3-8B-Instruct-Coder.Q6_K.gguf --local_dir ./work

启动聊天

复制代码
llama-cli -m model.gguf
llama-cli -m ~/work/Llama-3-8B-Instruct-Coder.Q6_K.gguf

但是速度非常慢。

复制代码
> 你好

你好!😊

[ Prompt: 0.4 t/s | Generation: 0.1 t/s ]

> /exit

后面准备换LFM2.5-1.2B模型

启动服务

llama-server

一款轻量级、兼容 OpenAI API 的 HTTP 服务器,用于部署大型语言模型(LLMs)。
  • 使用默认配置在 8080 端口启动本地 HTTP 服务器

    复制代码
    llama-server -m model.gguf --port 8080# 可通过浏览器访问基础 Web UI:http://localhost:8080
    # 聊天补全接口:http://localhost:8080/v1/chat/completions
  • 支持多用户和并行解码

  • 启用推测解码

  • 部署嵌入模型

  • 部署重排序模型

  • 使用语法约束所有输出

llama-perplexity

用于测量模型在给定文本上的困惑度 1(及其他质量指标)的工具。
  • 测量文本文件的困惑度

    复制代码
    llama-perplexity -m model.gguf -f file.txt
    
    # [1]15.2701,[2]5.4007,[3]5.3073,[4]6.2965,[5]5.8940,[6]5.6096,[7]5.7942,[8]4.9297, ...
    # 最终估计:PPL = 5.4007 +/- 0.67339
  • 测量 KL 散度

llama-bench

llama-simple
使用 llama.cpp 实现应用程序的极简示例。对开发者很有用。
  • 基本文本补全

    复制代码
    llama-simple -m model.gguf
    
    # 你好,我叫凯特琳,是一个16岁的女孩。我是一名高中生,目前正在上一门叫做"艺术
相关推荐
(轻舟已过万重山)1 天前
第16章 主流开源模型选型:Qwen/LLaMA/GLM/Mistral 怎么选
人工智能·开源·llama
染指11101 天前
72.高级RAG-sql检索器
python·sql·mysql·llama·llamaindex·高级rag
孪生质数-3 天前
AI 应用实践篇——让大模型真正开始工作
linux·运维·服务器·人工智能·深度学习·语言模型·llama
刹那芳华19923 天前
基于 Docker 的 LLaMA-Factory 全流程部署指南
docker·容器·llama
grey_csdn8 天前
1928_llama.cpp部署Qwen 3.6-35B-A3B扩充识图功能
llama
码云骑士8 天前
78-LLaMA-Factory微调实战-零代码训练-LoRA参数配置-训练曲线解读
python·llama
寒水馨9 天前
Linux下载、安装llama.cpp-b10068(附安装包llama-b10068-bin-ubuntu-vulkan-x64.tar.gz)
linux·ubuntu·llm·llama·本地部署·llama.cpp·推理引擎
千天夜10 天前
让大模型“先想再答”:Chain-of-Thought Prompting 论文精读——CoT 为什么能激发多步推理?
人工智能·深度学习·llm·gpt-3·llama
网络工程小王10 天前
【HCIE-AI】10.pytorch模型迁移分析
人工智能·学习·华为·llama
寒水馨12 天前
Windows下载、安装ollama-v0.32.1(附安装包OllamaSetup.exe)
windows·llm·大语言模型·llama·本地部署·ollama·模型运行