Chat UI 文档

Llama.cpp

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

Llama.cpp

功能 可用
工具
多模态

Chat UI 直接支持 llama.cpp API 服务器,无需适配器。您可以使用 llamacpp 端点类型来实现这一点。

如果您想使用 llama.cpp 运行 Chat UI,您可以执行以下操作,以 microsoft/Phi-3-mini-4k-instruct-gguf 为例

# install llama.cpp
brew install llama.cpp
# start llama.cpp server
llama-server --hf-repo microsoft/Phi-3-mini-4k-instruct-gguf --hf-file Phi-3-mini-4k-instruct-q4.gguf -c 4096

注意:您可以在 Hub 上用您喜欢的 GGUF 替换 hf-repohf-file。例如:--hf-repo TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF 用于此仓库,--hf-file tinyllama-1.1b-chat-v1.0.Q4_0.gguf 用于此文件。

本地 LLaMA.cpp HTTP 服务器将在 http://localhost:8080 启动(要更改端口或任何其他默认选项,请参阅 LLaMA.cpp HTTP 服务器的 readme 文件)。

将以下内容添加到您的 .env.local 文件中。

MODELS=`[
  {
    "name": "Local microsoft/Phi-3-mini-4k-instruct-gguf",
    "tokenizer": "microsoft/Phi-3-mini-4k-instruct-gguf",
    "preprompt": "",
    "chatPromptTemplate": "<s>{{preprompt}}{{#each messages}}{{#ifUser}}<|user|>\n{{content}}<|end|>\n<|assistant|>\n{{/ifUser}}{{#ifAssistant}}{{content}}<|end|>\n{{/ifAssistant}}{{/each}}",
    "parameters": {
      "stop": ["<|end|>", "<|endoftext|>", "<|assistant|>"],
      "temperature": 0.7,
      "max_new_tokens": 1024,
      "truncate": 3071
    },
    "endpoints": [{
      "type" : "llamacpp",
      "baseURL": "http://localhost:8080"
    }],
  },
]`
< > 在 GitHub 上更新