x
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
- `api_key`:接口访问密钥(同时用于 8000 与 8001)
|
||||
- `tensor_parallel_size`:张量并行数,双卡建议 `2`
|
||||
- `dtype`:推理精度,默认 `bfloat16`
|
||||
- `model_root`:本地模型根目录,建议 `/opt/model`
|
||||
- `offline_mode`:保留字段,当前实现固定只走离线本地模型
|
||||
- `models.selected`:当前生效模型,留空时回退到 `models.default`
|
||||
|
||||
## config.json 说明
|
||||
@@ -70,7 +72,7 @@
|
||||
- `models.default`:默认模型名
|
||||
- `models.selected`:当前生效模型名
|
||||
- `models.profiles`:模型配置集合
|
||||
- 每个模型至少建议包含:`hf_model_id`、`ctx`、`max_num_seqs`、`max_tokens`、`gpu_util`、`valid_tp`
|
||||
- 每个模型必须包含:`local_path`、`ctx`、`max_num_seqs`、`max_tokens`、`gpu_util`、`valid_tp`
|
||||
|
||||
启动时会按以下优先级选模型:
|
||||
|
||||
@@ -79,7 +81,7 @@
|
||||
|
||||
模型被选中后,会自动覆盖运行参数,包括:
|
||||
|
||||
- `model_name` ← `hf_model_id`
|
||||
- `model_name` ← `local_path`(相对路径会自动拼接 `model_root`)
|
||||
- `max_model_len` ← `ctx`
|
||||
- `max_num_seqs` ← `max_num_seqs`
|
||||
- `max_tokens` ← `max_tokens`
|
||||
@@ -100,19 +102,19 @@ docker compose up -d --build
|
||||
3. 验证自定义推理服务:
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/health
|
||||
curl http://localhost:<services.api.port>/health
|
||||
```
|
||||
|
||||
4. 验证 OpenAI 协议服务:
|
||||
|
||||
```bash
|
||||
curl http://localhost:8001/v1/models
|
||||
curl http://localhost:<services.openai.port>/v1/models
|
||||
```
|
||||
|
||||
## 推理请求示例
|
||||
|
||||
```bash
|
||||
curl -X POST "http://localhost:8000/v1/generate" \
|
||||
curl -X POST "http://localhost:<services.api.port>/v1/generate" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"prompt\":\"请用三句话介绍大模型推理优化\",\"max_tokens\":128,\"temperature\":0.7}"
|
||||
```
|
||||
@@ -132,6 +134,7 @@ curl -X POST "http://localhost:8001/v1/chat/completions" \
|
||||
- API Key 使用 `config.json` 中 `api_key`
|
||||
- 模型名使用 `config.json` 中 `models.profiles.<模型名>.served_model_name`
|
||||
- 若使用工具调用,`config.json` 中应配置 `tool_call_parser` 与 `enable_auto_tool_choice`
|
||||
- 服务强制离线模式,不会回退到 Hugging Face 远程下载
|
||||
- 所有路径按 Ubuntu 规范填写,本地模型建议使用 `/opt/model/<模型目录>`
|
||||
|
||||
## 双 AMD R9700 调优建议
|
||||
|
||||
Reference in New Issue
Block a user