xorbitsai / inference

Replace OpenAI GPT with another LLM in your app by changing a single line of code. Xinference gives you the freedom to use any LLM you need. With Xinference, you're empowered to run inference with any open-source language models, speech recognition models, and multimodal models, whether in the cloud, on-premises, or even on your laptop.
https://inference.readthedocs.io
Apache License 2.0
5.05k stars 402 forks source link

mlx模型手动注册时找不到Model Format支持,在macOS上推理模型时无法选择mlx方式推理 #2390

Open okwinds opened 1 week ago

okwinds commented 1 week ago

System Info / 系統信息

MAC M2 macOS 14.4.1 python 3.10 mlx 0.18.0 mlx-lm 0.18.2

Running Xinference with Docker? / 是否使用 Docker 运行 Xinfernece?

Version info / 版本信息

xinference 0.15.3

The command used to start Xinference / 用以启动 xinference 的命令

xinference-local -H 0.0.0.0 -p 8000

Reproduction / 复现过程

  1. 启动xinference
  2. 访问http://127.0.0.1:8000
  3. 到 Register Model 1).注册qwen2-7b-mlx或qwen2.5-7b-mlx,找不到mlx的Model Format 2).选择pytorch注册 3).老版本注册过的mlx可以正常启动,并chat。 4).因前面选择了model format = pytorch注册。手动修改json,将qwen2-7b-mlx新版本xinf的json替换为xinf老版本的json内容,可以正常推理。qwen2-7b-mlx在新版json的基础上,修改Model Format为mlx,推理可以拉起,但是chat会报错。只能用老版本的格式来推理mlx 4).qwen2.5-7b-mlx,修改为老版本json,model_family不能是qwen2.5_instruct,得用qwen2_instruct才可以正常推理。 5).以上操作,均没有测试tool call。

btw,传了个3B的qw2.5-4bit的mlx,方便调试用。 https://www.modelscope.cn/models/okwinds/Qwen2.5-3B-Instruct-MLX-4bit

Expected behavior / 期待表现

希望能再review一下对mlx的支持,并修复它。😄 1.手动注册模型的时候,如果是 mlx 量化模型,允许选择 model format 为 MLX 2.在 macOS 上启动 bf16 或 fp16 模型的时候,允许选择 Model Engine 为 transformers 或 MLX 两个类型来推理模型。

qinxuye commented 3 days ago

Thanks, we will see how to address this issue.