Chat UI 文件

文字生成推理 (TGI)

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

文字生成推理 (TGI)

特性 可用
工具 是*
多模態 是*

* 僅當使用 Cohere Command R+ 模型和 Xenova 分詞器時才支援工具。請參閱工具部分。

* 多模態僅支援 IDEFICS 模型。請參閱多模態部分。

預設情況下,如果 endpoints 未指定,Chat UI 將使用模型名稱和您的 HF_TOKEN 在託管的 Hugging Face 推理 API 上查詢模型。有關模型配置的更多資訊,請參閱概述

MODELS=`[
  {
    "name": "mistralai/Mistral-7B-Instruct-v0.2",
    "displayName": "mistralai/Mistral-7B-Instruct-v0.2",
    "description": "Mistral 7B is a new Apache 2.0 model, released by Mistral AI that outperforms Llama2 13B in benchmarks.",
    "websiteUrl": "https://mistral.ai/news/announcing-mistral-7b/",
    "preprompt": "",
    "chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{

{/if}

}{

{/if}

}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
    "parameters": {
      "temperature": 0.3,
      "top_p": 0.95,
      "repetition_penalty": 1.2,
      "top_k": 50,
      "truncate": 3072,
      "max_new_tokens": 1024,
      "stop": ["</s>"]
    },
    "promptExamples": [
      {
        "title": "Write an email",
        "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
      }, {
        "title": "Code a game",
        "prompt": "Code a basic snake game in python, give explanations for each step."
      }, {
        "title": "Recipe help",
        "prompt": "How do I make a delicious lemon cheesecake?"
      }
    ]
  }
]`

使用自定義端點執行您自己的模型

如果您願意,可以本地執行自己的模型,而不是訪問 Hugging Face 推理 API 上的模型。

一個不錯的選擇是連線 text-generation-inference 端點。例如,官方的 Chat UI Spaces Docker 模板就是這麼做的:該應用和 text-generation-inference 伺服器都在同一個容器內執行。

為此,您可以透過在 MODELS 中為每個模型新增一個 "endpoints" 鍵,將您自己的端點新增到 .env.localMODELS 變數中。

MODELS=`[{
  "name": "your-model-name",
  "displayName": "Your Model Name",
  ... other model config
  "endpoints": [{
    "type" : "tgi",
    "url": "https://HOST:PORT",
  }]
}]`
< > 在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.