文本嵌入推理文档
在本地使用 TEI 和 GPU
加入 Hugging Face 社区
并获得增强的文档体验
开始使用
在本地使用 TEI 和 GPU
您可以在本地安装 `text-embeddings-inference` 并在您自己的机器上使用 GPU 运行它。要确保您的硬件受支持,请查看支持的模型和硬件页面。
第 1 步:CUDA 和 NVIDIA 驱动程序
确保您已安装 CUDA 和 NVIDIA 驱动程序 - 您设备上的 NVIDIA 驱动程序需要与 CUDA 12.2 或更高版本兼容。
将 NVIDIA 二进制文件添加到您的路径
export PATH=$PATH:/usr/local/cuda/bin
第 2 步:安装 Rust
在您的机器上安装 Rust,在您的终端中运行以下命令,然后按照说明操作
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
第 3 步:安装必要的软件包
此步骤可能需要一段时间,因为我们需要编译许多 CUDA 内核。
适用于 Turing GPU(T4、RTX 2000 系列…)
cargo install --path router -F candle-cuda-turing -F http --no-default-features
适用于 Ampere 和 Hopper
cargo install --path router -F candle-cuda -F http --no-default-features
第 4 步:启动文本嵌入推理
现在您可以使用以下命令在 GPU 上启动文本嵌入推理:
model=Qwen/Qwen3-Embedding-0.6B text-embeddings-router --model-id $model --dtype float16 --port 8080