在昇腾 NPU 上安装#
Xinference 能在昇腾 NPU 上运行,使用如下命令安装。
安装 PyTorch 和昇腾扩展#
安装 PyTorch CPU 版本和相应的昇腾扩展。
以 PyTorch v2.1.0 为例。
pip3 install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cpu
接着安装 昇腾 PyTorch 扩展.
pip3 install 'numpy<2.0' pip3 install decorator pip3 install torch-npu==2.1.0.post3
运行如下命令查看,如果正常运行,会打印昇腾 NPU 的个数。
python -c "import torch; import torch_npu; print(torch.npu.device_count())"
安装 Xinference#
pip3 install xinference
现在你可以参考 文档 来使用 Xinference。Transformers 是开源唯一支持的昇腾 NPU 的引擎。
企业支持#
如果你在昇腾 NPU 遇到任何性能和其他问题,欢迎垂询 Xinference 企业版,在 这里 可以找到我们,亦可以 填写表单 申请企业版试用。