Chat UI 文档

Llama.cpp

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

Llama.cpp

特性 可用
工具
多模态

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

如果您想使用 llama.cpp 运行聊天界面,可以按照以下步骤操作,以 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

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

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

将以下内容添加到您的 .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": "https://:8080"
    }],
  },
]`
< > 在 GitHub 上更新