ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

Xinference (Xorbits Inference): sirve LLMs, modelos de voz y multimodales con un solo comando

Xinference (Xorbits Inference): sirve LLMs, modelos de voz y multimodales con un solo comando Xinference (Xorbits Inference): sirve LLMs, modelos de voz y multimodales con un solo comando【免费下载链接】inferenceSwap GPT for any LLM by changing a single line of code. Xinference lets you run open-source, speech, and multimodal models on cloud, on-prem, or your laptop — all through one unified, production-ready inference API.项目地址: https://gitcode.com/GitHub_Trending/in/inferenceXorbits Inference简称 Xinference是一个开源的分布式推理框架专为让模型服务变得简单而设计无论是大语言模型LLM、语音识别与语音合成、OCR、图像生成、向量嵌入还是多模态与世界模型都可以通过一条命令完成部署并以统一的、兼容 OpenAI 的生产级推理 API 对外提供服务。读完本文你将掌握 Xinference 的核心能力模型、四种使用方式Web UI / cURL / CLI / Python 客户端、Docker 与 Kubernetes 部署方案、模型生命周期管理以及本地与多节点集群两种运行模式。¿Qué es Xinference?Xinference 是 Xorbits Inference 的开源实现定位为性能强大且功能全面的分布式推理框架。它把大语言模型、语音识别模型、多模态模型等的部署流程大幅简化一个命令即可完成模型的部署工作研究者、开发者与数据科学家都可以借助它与前沿开源模型对接而无需关心底层引擎的差异。从仓库结构可以直接看到框架对模型类型的覆盖范围xinference/model模型类型仓库目录典型能力大语言模型LLMxinference/model/llmchat / generate / 函数调用语音ASR / TTS / 音乐xinference/model/audio语音识别、语音合成、音乐生成嵌入Embeddingxinference/model/embedding文本向量化重排Rerankxinference/model/rerank检索结果重排序图像文生图 / 图像编辑 / OCRxinference/model/image文生图、图像编辑、OCR视频xinference/model/video视频生成世界模型xinference/model/world交互式世界模拟Funcionalidades principalesServir modelos con facilidad简化 LLM、语音识别与多模态模型的部署测试与生产环境的模型都可以用一条命令配置并启动。Modelos de vanguardia accesibles内置大量前沿开源模型一条命令即可体验内置模型列表持续更新。Aprovechamiento de hardware heterogéneo通过 ggml 等方案同时利用 GPU 与 CPU 进行推理降低延迟、提高吞吐。APIs y interfaces flexibles提供 OpenAI 兼容的 RESTful API含 Function Calling、RPC、命令行CLI、Web UI 等多种使用接口。Despliegue distribuido支持跨设备、跨机器的分布式推理内置资源调度器可将不同规模的模型按需调度到不同机器充分利用集群资源。Integraciones de terceros与 LangChain、LlamaIndex、Dify、Chatbox、RAGFlow、MaxKB 等流行生态无缝对接。¿Por qué elegir Xinference?项目官方文档给出了如下与同类方案FastChat、OpenLLM、RayLLM的能力对比表便于快速定位 Xinference 的差异化能力FunciónXinferenceFastChatOpenLLMRayLLMAPI RESTful compatible con OpenAI✅✅✅✅Integración vLLM✅✅✅✅Diversos motores de inferencia (GGML, TensorRT)✅❌✅✅Diversas plataformas (CPU, Metal)✅✅❌❌Despliegue en clúster multi-nodo✅❌❌✅Modelos de imagen (Texto→Imagen)✅✅❌❌Modelos de embedding de texto✅❌❌❌Modelos multimodales✅❌❌❌Modelos de voz✅❌❌❌Funcionalidad OpenAI (Function Calling)✅❌❌❌从源码结构看上述能力都有对应的实现支撑OpenAI 兼容的 API 路由集中在 xinference/api/routersllm、embeddings、rerank、images、audio、videos、worlds 等vLLM 引擎适配位于 xinference/model/llm/vllm 与 xinference/model/image/vllmGGML/llama.cpp 引擎适配位于 xinference/model/llm/llama_cpp。Novedades destacadas del frameworkMejoras del frameworkXinference 3.0.0已发布包含迁移说明与不兼容变更破坏性变更说明。Agente nativoXagent与 Xagent 深度集成支持动态规划、工具调用与多步自主推理突破传统静态流程的限制。Batching automático多个并发请求会被自动合批处理大幅提升吞吐量。相关参数XINFERENCE_BATCH_SIZE、XINFERENCE_BATCH_INTERVAL与合批调度实现可分别在 xinference/constants.py 与 xinference/model/scheduler/batch.py 中找到。Xllamacpp由 Xinference 团队维护的 llama.cpp Python binding支持持续并行continuous batching更面向生产环境。Inferencia distribuida支持在多个 worker 上运行大尺寸模型。Mejoras en vLLM支持跨副本共享 KV-Cache。Nuevos modelos integrados按类型归纳模型名称以项目文档为准LLMMiniCPM5-2B、Kimi-K3、GLM-5.2、Ornith 1.535B-A3B / 397B、Qwen3.827B / 2.4T-A95B、DeepSeek-V4-Flash-0731、SenseNova-U1.5-8B-MoT、jina-reranker-m0重排。语音 / 音乐Fish Audio 系列S1-mini、S2-Pro、Breeze-TTS-2、FireRedTTS3、MiniMax-Music3、MiniMax-H3 Lightning LoRA。OCRMonkeyOCR、dots.ocr、NaviDC-OCR。图像JoyAI 图像编辑系列Edit、Edit Plus、GLM-Image、HiDream-O1 系列Image、Image-Dev、Image-Dev-2604、Ideogram4、Krea 2 系列Raw、Turbo、ACE-Step 1.5。嵌入EmbeddingWeMM-Embedding 系列2B、4B、9B。世界模型Matrix-Game-3.0-5B、HY-WorldPlay-5B、Astra。以上能力在仓库中均有对应实现文件可查证例如 xinference/model/audio/fish_speech.pyFish Audio、xinference/model/image/hidream_o1.pyHiDream-O1、xinference/model/world/hy_worldplay_runner.py世界模型内置模型清单可查看 xinference/model/llm/llm_family.json。Integraciones con ecosistemasXagent企业级 Agent 平台提供规划、记忆与工具调用能力。DifyLLMOps 平台用于快速构建带可视化控制的应用。FastGPT基于 LLM 的知识库平台支持数据处理与模型调用。RAGFlow基于深度文档理解的开源 RAG 引擎。MaxKB基于大语言模型与 RAG 的开源知识库问答系统。Instalación y arranque local (Quickstart)安装 Xinference 最简单的方式是使用 pippip install xinference[all][all]会安装支持全部模型类型所需的依赖。若只想安装部分后端官方安装文档doc/source/getting_started/installation.rst给出了更细的拆分# 仅 transformers 后端PyTorch支持 pytorch/gptq/awq/bnb/fp4 格式 pip install xinference[transformers] # AWQ/GPTQ 量化格式需要特殊依赖 pip install xinference[transformers_quantization] --no-build-isolation # 单独使用 sglang 引擎 pip install xinference[sglang]启动一个本地实例只需一条命令$ xinference-local该命令在 xinference/deploy/cmdline.py 中定义。常用启动参数如下参数简写默认值说明--host-H127.0.0.1服务监听地址本地模式默认仅本机可访问--port-p9997服务端口Web UI / API 共用--log-level—INFO日志级别DEBUG INFO WARNING ERROR CRITICAL--metrics-exporter-host/-MH—同--host指标导出服务监听地址--metrics-exporter-port/-mp——指标导出服务端口默认监听地址与端口在 xinference/constants.py 中定义为XINFERENCE_DEFAULT_LOCAL_HOST 127.0.0.1与XINFERENCE_DEFAULT_ENDPOINT_PORT 9997。框架的默认数据目录为~/.xinference可通过环境变量XINFERENCE_HOME覆盖模型、缓存、日志、虚拟环境等数据都会集中存放于此见 xinference/constants.py。服务启动后可以通过 Web UI、cURL、CLI 或 Python 客户端四种方式使用Despliegue con DockerNVIDIA GPU 用户可以直接使用官方 Docker 镜像确保已安装 Docker 与 CUDAdocker run --name xinference -d -p 9997:9997 -e XINFERENCE_HOME/data -v /on/your/host:/data --gpus all xprobe/xinference:latest xinference-local -H 0.0.0.0仓库中的 xinference/deploy/docker/docker-compose.yml 提供了更完整的编排示例值得关注的配置项包括--gpus all/ GPU 保留deploy.resources.reservations.devices声明capabilities: [gpu]、driver: nvidia、count: all以启用全部 GPU。共享内存shm_size默认8gb多 GPU 推理需要更大的共享内存段。端口映射默认9997:9997可用环境变量XINFERENCE_PORT覆盖。数据持久化XINFERENCE_HOME_DIR默认卷xinference_home映射到容器内/root/.xinference、XINFERENCE_HF_CACHE_DIRHugging Face 缓存、XINFERENCE_MODELSCOPE_CACHE_DIRModelScope 缓存。模型下载源XINFERENCE_MODEL_SRC默认auto自动探测 Hugging Face 可达性并回退到 ModelScope也可显式设为huggingface或modelscope。健康检查通过python3 -c ...urllib.request.urlopen(http://localhost:9997/status)每 30 秒探测一次。离线部署docker compose --profile offline up -d会额外启动内置私有 PyPI 服务xinference-pypiserver配合offline.env实现无外网安装。# CPU-only 主机 docker compose -f docker-compose.yml -f docker-compose.cpu.yml up -d # 在线默认启动 docker compose up -dDespliegue en Kubernetes con Helm在 Kubernetes 集群启用 GPU 支持后可通过 Helm 安装# 新增 xinference 仓库 helm repo add xinference https://xorbitsai.github.io/xinference-helm-charts # 更新仓库查询可安装的版本 helm repo update xinference helm search repo xinference/xinference --devel --versions # 在 K8s 中安装 xinference helm install xinference xinference/xinference -n xinference --version 0.0.1-vxinference_release_version更多定制化安装方式可参考文档 doc/source/getting_started/using_kubernetes.rst。Lanzamiento de modelosDesde la línea de comandos以内置模型qwen2.5-instruct为例通过 CLI 启动示例来自 doc/source/getting_started/using_xinference.rstxinference launch --model-engine inference_engine -n qwen2.5-instruct -s 0_5 -f pytorchlaunch命令的完整参数定义位于 xinference/deploy/cmdline.py常用参数包括参数简写默认值说明--model-name-n必填模型名称--model-type-tLLM模型类型LLM / embedding / rerank / image / audio / video / world / flexible--model-engine-en—推理引擎transformers / vllm / llama.cpp / sglang 等LLM 必填--model-uid-u模型名模型唯一标识缺省时与模型名一致--size-in-billions-s—模型参数量如0_5、7--model-format-f—模型格式pytorch / ggufv2 / gptq / awq 等--quantization-q—量化配置--replica-r1模型副本数--n-worker—1使用的 worker 数量--n-gpu—autoGPU 数量n-worker1时表示每个 worker 的 GPU 数--worker-ip-w—分布式环境下指定模型运行的 worker IP--gpu-idx——指定 worker 上可用的 GPU 编号逗号分隔--endpoint-ehttp://127.0.0.1:9997服务端点可用环境变量XINFERENCE_ENDPOINT覆盖部分引擎需要额外参数可以直接在命令行追加并透传给引擎例如 vLLM 的显存利用率xinference launch --model-engine vllm -n qwen2.5-instruct -s 0_5 -f pytorch --gpu_memory_utilization 0.9也可以按需下载模型源如 ModelScopeXINFERENCE_MODEL_SRCmodelscope xinference-local --host 0.0.0.0 --port 9997Desde cURL y el cliente Python用 cURL 启动同一模型curl -X POST \ http://127.0.0.1:9997/v1/models \ -H accept: application/json \ -H Content-Type: application/json \ -d { model_engine: inference_engine, model_name: qwen2.5-instruct, model_format: pytorch, size_in_billions: 0_5 }用 Python 客户端from xinference.client import RESTfulClient client RESTfulClient(http://127.0.0.1:9997) model_uid client.launch_model( model_engineinference_engine, model_nameqwen2.5-instruct, model_formatpytorch, size_in_billions0_5, ) print(Model uid: model_uid)API compatible con OpenAI y Anthropic模型运行后即可通过 OpenAI 兼容接口调用Xinference 可作为 OpenAI API 的本地替代品仅需修改base_urlfrom openai import OpenAI client OpenAI(base_urlhttp://127.0.0.1:9997/v1, api_keynot used actually) response client.chat.completions.create( modelqwen2.5-instruct, messages[ {role: system, content: You are a helpful assistant.}, {role: user, content: What is the largest animal?} ] ) print(response)支持以下 OpenAI API 子集Chat Completions、Completions、Embeddings。此外还支持 Anthropic 协议base URL 为http://127.0.0.1:9997/anthropic因此可以直接接入 Claude Code 等工具。通过 cURL 调用对话接口curl -X POST \ http://127.0.0.1:9997/v1/chat/completions \ -H accept: application/json \ -H Content-Type: application/json \ -d { model: qwen2.5-instruct, messages: [ {role: system, content: You are a helpful assistant.}, {role: user, content: What is the largest animal?} ] }Gestión del ciclo de vida de los modelosXinference 提供 CLI / cURL / Python 三种方式管理模型的完整生命周期列出可启动的某类型模型注册表xinference registrations -t LLM curl http://127.0.0.1:9997/v1/model_registrations/LLMclient.list_model_registrations(model_typeLLM)查看当前运行中的模型xinference list curl http://127.0.0.1:9997/v1/modelsclient.list_models()终止不再需要的模型以释放资源xinference terminate --model-uid qwen2.5-instruct curl -X DELETE http://127.0.0.1:9997/v1/models/qwen2.5-instructclient.terminate_model(model_uidqwen2.5-instruct)此外CLI 还提供register/unregister/cached/remove-cache等命令见 xinference/deploy/cmdline.py用于注册自定义模型、注销模型以及管理模型缓存文件。Despliegue distribuido en clúster要将 Xinference 部署到集群需要在服务器上启动一个 supervisor在其他服务器上启动 worker命令定义见 xinference/deploy/cmdline.py 与 xinference/deploy/cmdline.py启动 Supervisorxinference-supervisor -H ${supervisor_host}Supervisor 的 Web UI 地址为http://${supervisor_host}:9997/uiOpenAPI 文档地址为http://${supervisor_host}:9997/docs。分布式模式下默认监听地址为0.0.0.0见 xinference/constants.py 中的XINFERENCE_DEFAULT_DISTRIBUTED_HOST。启动 Worker每台 worker 服务器执行xinference-worker -e http://${supervisor_host}:9997 -H ${worker_host}# 集群模式下远程启动模型 xinference launch -n qwen2.5-instruct -s 0_5 -f pytorch -e http://${supervisor_host}:9997框架内置资源调度器可将不同大小的模型按需调度到不同机器可通过--worker-ip、--gpu-idx指定目标节点与 GPU或用--n-worker将单个大模型切分到多个 worker 上运行从而充分利用集群资源关于分布式推理的架构细节可进一步阅读 doc/source/user_guide/distributed_inference.rst。Referencias para profundizar官方使用指南doc/source/getting_started/using_xinference.rst启动、调用、管理、集群部署安装文档doc/source/getting_started/installation.rst后端拆装与量化依赖命令行实现xinference/deploy/cmdline.py全部 CLI 命令与参数Docker 编排xinference/deploy/docker/docker-compose.yml客户端 APIxinference/client/restful/restful_client.py 与 xinference/client/restful/async_restful_client.pyCómo citar el proyecto若此项目对你的工作有帮助官方建议以下列格式引用出自 READMES/README_es.mdinproceedings{lu2024xinference, title Xinference: Making Large Model Serving Easy, author Lu, Weizheng and Xiong, Lingfeng and Zhang, Feng and Qin, Xuye and Chen, Yueguo, booktitle Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, month nov, year 2024, pages 291--300, }【免费下载链接】inferenceSwap GPT for any LLM by changing a single line of code. Xinference lets you run open-source, speech, and multimodal models on cloud, on-prem, or your laptop — all through one unified, production-ready inference API.项目地址: https://gitcode.com/GitHub_Trending/in/inference创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表