1.1 Proceso de Instalación
# Para CUDA/CPU
pip install "xinference[transformers]"
pip install "xinference[vllm]"
pip install "xinference[sglang]"
# Para Metal(MPS)
pip install "xinference[mlx]"
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
Nota: Debido a posibles problemas de configuración del entorno local (como la versión de nvcc),
llama-cpp-python puede no funcionar correctamente con CUDA (aunque funciona en entornos C/C++).
La versión para Metal de llama-cpp-python opera sin problemas.
Para instalar otras dependencias como flashinfer, consulte la documentación oficial:
https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html
1.2 Iniciando el Servidor
1.2.1 Ejecución Local
Comando Básico
xinference-local --host 0.0.0.0 --port 9997
Configuración Avanzada
Configuración de la ruta de caché de modelos y fuente de modelos (Hugging Face/Modelscope): ```
Para CUDA/CPU
XINFERENCE_HOME=/ruta/.xinference XINFERENCE_MODEL_SRC=modelscope xinference-local --host 0.0.0.0 --port 9997
Para Metal(MPS)
XINFERENCE_HOME=/ruta/.xinference XINFERENCE_MODEL_SRC=modelscope PYTORCH_ENABLE_MPS_FALLBACK=1 xinference-local --host 0.0.0.0 --port 9997
##### 1.2.2 Configuración en Cluster
Utilice `ifconfig` para identificar la dirección IP del servidor principal. ###### 1.2.2.1 Inicio del Nodo Supervisor
Formato general
xinference-supervisor -H IP_servidor_principal --puerto 9997
Ejemplo concreto
xinference-supervisor -H 192.168.31.100 --port 9997
###### 1.2.2.2 Inicio de Nodos Trabajadores
Formato general
xinference-worker -e "http://${IP_servidor_principal}:9997" -H IP_servidor_secundario
Ejemplo concreto
xinference-worker -e "http://192.168.31.100:9997" -H 192.168.31.101
Nota: Agregue variables de entorno como `XINFERENCE_HOME`, `XINFERENCE_MODEL_SRC`, `PYTORCH_ENABLE_MPS_FALLBACK` según sea necesario durante el inicio. #### 1.3 Utilización
Para acceder a la documentación de la API, visite `http://IP_servidor_principal:9997/docs`. Para el uso normal, diríjase a `http://IP_servidor_principal:9997`. ### 2. Recursos de Referencia
#### 2.1 Documentación de Xinference
##### 2.1.1 Guías de Implementación
- [Ejecución Local de Xinference](https://inference.readthedocs.io/zh-cn/latest/getting_started/using_xinference.html#run-xinference-local)
- [Implementación en Cluster](https://inference.readthedocs.io/zh-cn/latest/getting_started/using_xinference.html#deploy-xinference-in-a-cluster)
##### 2.1.2 Documentación de Instalación
- [Página Oficial](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html)
- [Motor Transformers](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#transformers-backend)
- [Motor vLLM](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#vllm-backend)
- [Motor Llama.cpp](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#llama-cpp-backend)
- [Motor MLX](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#mlx-backend)
#### 2.2 Recursos Adicionales
##### 2.2.1 GitHub
- [Repositorio Principal](https://github.com/xorbitsai/inference)
- [Documentación en Chino](https://github.com/xorbitsai/inference/blob/main/README_zh_CN.md)
##### 2.2.2 Instalación en Plataformas Específicas
- [Motor SGLang](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#sglang-backend)
- [Otras Plataformas](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation.html#other-platforms)
- [Instalación en NPU de Ascend](https://inference.readthedocs.io/zh-cn/latest/getting_started/installation_npu.html#installation-npu)
</div></div>