Text Generation Inference 文件
從原始碼安裝
入門指南
Text Generation Inference快速導覽支援的模型在 Nvidia GPU 上使用 TGI在 AMD GPU 上使用 TGI在 Intel Gaudi 上使用 TGI在 AWS Trainium 與 Inferentia 上使用 TGI在 Google TPU 上使用 TGI在 Intel GPU 上使用 TGI從原始碼安裝多後端支援內部架構使用統計
教學課程
取用 TGI為推論服務準備模型提供私有與受限(Gated)模型服務使用 TGI CLI部署於 AWS (EC2 與 SageMaker)非核心模型推論服務安全性使用 Guidance、JSON 與工具視覺語言模型 (VLMs)使用 Prometheus 與 Grafana 監控 TGI訓練 Medusa
後端
參考
概念指南
加入 Hugging Face 社群
並獲得增強的文件體驗
開始使用
從原始碼安裝
不建議使用從原始碼安裝 TGI。我們強烈建議透過 Docker 使用 TGI,請查閱快速導覽、Nvidia GPU 安裝說明以及AMD GPU 安裝說明以了解如何使用 Docker 執行 TGI。
安裝 CLI
您可以使用 TGI 命令列介面 (CLI) 來下載權重、提供模型服務、量化模型,或是獲取有關服務參數的資訊。
要安裝 CLI,您需要先複製 (clone) TGI 儲存庫,然後執行 make。
git clone https://github.com/huggingface/text-generation-inference.git && cd text-generation-inference
make install如果您希望使用自訂核心 (custom kernels) 來提供模型服務,請執行
BUILD_EXTENSIONS=True make install
本機從原始碼安裝
在開始之前,您需要設定環境並安裝 Text Generation Inference。Text Generation Inference 已在 Python 3.9+ 上進行測試。
Text Generation Inference 可透過 pypi、conda 和 GitHub 取得。
若要進行本機安裝並啟動,請先安裝 Rust,並使用至少 Python 3.9 的版本建立 Python 虛擬環境(例如使用 conda)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
conda create -n text-generation-inference python=3.9
conda activate text-generation-inference您可能還需要安裝 Protoc。
在 Linux 上
PROTOC_ZIP=protoc-21.12-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP在 MacOS 上,使用 Homebrew
brew install protobuf
然後執行以安裝 Text Generation Inference
git clone https://github.com/huggingface/text-generation-inference.git && cd text-generation-inference
BUILD_EXTENSIONS=True make install在某些機器上,您可能還需要 OpenSSL 函式庫和 gcc。在 Linux 機器上,請執行
sudo apt-get install libssl-dev gcc -y
安裝完成後,只需執行
make run-falcon-7b-instruct
這將在 8080 連接埠上提供 Falcon 7B Instruct 模型服務,我們可以對其進行查詢。
在 GitHub 上更新