Qwen_local_model

This commit is contained in:
2026-03-30 01:03:20 +08:00
parent 757a29d7ee
commit 47adb86693
5 changed files with 14 additions and 6 deletions
+4 -2
View File
@@ -29,6 +29,7 @@
项目只读取一个配置文件:`config.json`。
- `services.openai.host` / `services.openai.port`:OpenAI 协议服务监听地址与端口(默认 `0.0.0.0:8001`)
- `public_model_name`:对外固定模型名,切换底层模型时可保持调用方参数不变
- `api_key`:OpenAI 接口访问密钥
- `tensor_parallel_size`:张量并行数,双卡建议 `2`
- `dtype`:推理精度,默认 `bfloat16`
@@ -82,14 +83,14 @@ curl http://localhost:<services.openai.port>/v1/models
curl -X POST "http://localhost:8001/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <config.json中的api_key>" \
-d "{\"model\":\"Qwen3.5-35B-A3B-GPTQ-Int4\",\"messages\":[{\"role\":\"user\",\"content\":\"你好,介绍一下你自己\"}],\"temperature\":0.7}"
-d "{\"model\":\"Qwen_local_model\",\"messages\":[{\"role\":\"user\",\"content\":\"你好,介绍一下你自己\"}],\"temperature\":0.7}"
```
## OpenClaw 调用说明
- Base URL 使用 `http://<服务器IP>:8001/v1`
- API Key 使用 `config.json` 中 `api_key`
- 模型名使用 `config.json` 中 `models.profiles.<模型名>.served_model_name`
- 模型名固定使用 `config.json` 中 `public_model_name`(默认 `Qwen_local_model`)
- 若使用工具调用,`config.json` 中应配置 `tool_call_parser` 与 `enable_auto_tool_choice`
- 服务强制离线模式,不会回退到 Hugging Face 远程下载
- 所有路径按 Ubuntu 规范填写,本地模型建议使用 `/opt/model/<模型目录>`
@@ -105,5 +106,6 @@ curl -X POST "http://localhost:8001/v1/chat/completions" \
- 报错 `model type ... Transformers does not recognize this architecture` 时,说明当前模型与镜像内依赖不兼容,建议更换模型或升级镜像版本。
- 报错 `model config (gptq) does not match quantization argument (gptq_marlin)` 时,将该模型配置改为 `dtype=float16` 且 `quantization=gptq`。
- 报错 `RPC call to sample_tokens timed out` 或出现 `GPU core dump` 时,先下调模型配置为更稳参数:`ctx=32768`、`max_num_seqs=4`、`max_tokens=2048`、`gpu_util=0.90`,并开启 `enforce_eager=true`。
- 若模型目录存在但仍加载失败,检查挂载路径是否为 `/opt/model:/opt/model:ro`,并确认容器内可见模型文件。
- 如果看到 `No services to build`,说明未触发重建;需要先执行 `docker compose build --no-cache` 再 `up`。