1.下载指定版本的text-embeding-inference,这里下载v1.7.0版本
Release v1.7.0 · huggingface/text-embeddings-inference · GitHub
2.将压缩包上传至卡机
3.安装rust 准备编译
这里我找了一个rust 国内镜像 RsProxy
3.1 设置 Rustup 镜像, 修改配置 ~/.zshrc or ~/.bashrc
export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
3.2 下载rust 安装包
curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh
一路默认安装,这里不做特殊介绍了。如果是自己服务器,我会设置cargo_home rustup_home 之类的配置,避免把包全搞到跟目录,后续难受
3.3 设置 crates.io 镜像, 修改配置 ~/.cargo/config,已支持git协议和sparse协议,>=1.68 版本建议使用 sparse-index,速度更快。
[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
3.4 前置条件
sudo apt-get install libssl-dev gcc -y
export PATH=$PATH:/usr/local/cuda/bin
3.5 编译
cargo install --path router -F candle-cuda --features static-linking -F http --no-default-features --jobs 5
这里比git 上多加了一个--features static-linking,原因是本地报错,具体可以参考我这篇文章
编译 text-embeddings-inference遇到的问题总结-CSDN博客
--job 5是限制任务数,避免内存和CPU打满
有可能报更新git 的错误。见这篇文章,解决git 访问不了 编译 text-embeddings-inference遇到的问题总结-CSDN博客
fatal: unable to access 'https://github.com/huggingface/candle/': GnuTLS recv error (-54): Error in the pull function.
error: failed to compile `text-embeddings-router v1.7.0 (/data/coding/text-embeddings-inference-1.7.0/router)`, intermediate artifacts can be found at `/data/coding/text-embeddings-inference-1.7.0/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.