# CUDA/CPU
pip install "xinference[transformers]"
pip install "xinference[vllm]"
pip install "xinference[sglang]"
# Metal(MPS)
pip install "xinference[mlx]"
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
注:可能是 nvcc 版本等个人环境配置原因,llama-cpp-python 在 CUDA 上无法使用(C/C++ 环境上是正常的),Metal 的 llama-cpp-python 正常。如需安装 flashinfer 等依赖见官方安装文档:https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html
xinference-local --host 0.0.0.0 --port 9997
设置模型缓存路径
和模型来源(Hugging Face/Modelscope)
# CUDA/CPU
XINFERENCE_HOME=/path/.xinference XINFERENCE_MODEL_SRC=modelscope xinference-local --host 0.0.0.0 --port 9997
# Metal(MPS)
XINFERENCE_HOME=/path/.xinference XINFERENCE_MODEL_SRC=modelscope PYTORCH_ENABLE_MPS_FALLBACK=1 xinference-local --host 0.0.0.0 --port 9997
通过 ifconfig
查看当前服务器IP
# 格式
xinference-supervisor -H 当前服务器IP(主服务器IP) --port 9997
# 示例
xinference-supervisor -H 192.168.31.100 --port 9997
# 格式
xinference-worker -e "http://${主服务器IP}:9997" -H 当前服务器IP(子服务器IP)
# 示例
xinference-worker -e "http://192.168.31.100:9997" -H 192.168.31.101
注:按需添加XINFERENCE_HOME
、XINFERENCE_MODEL_SRC
、PYTORCH_ENABLE_MPS_FALLBACK
等环境变量(启动时参数)
访问 http://主服务器IP:9997/docs
查看接口文档,访问 http://主服务器IP:9997
正常使用
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#transformers-backend
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#vllm-backend
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#llama-cpp-backend
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#mlx-backend
https://github.com/xorbitsai/inference
https://github.com/xorbitsai/inference/blob/main/README_zh_CN.md
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#sglang-backend
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#other-platforms
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation_npu.html#installation-npu
参与评论
手机查看
返回顶部