feature: polish

This commit is contained in:
2025-09-18 19:09:00 +08:00
parent 6f59808504
commit 2caf8751d2
3 changed files with 62 additions and 4 deletions

View File

@@ -8,6 +8,53 @@
* MiniCPMV2.6 是 MiniCPMV 系列中最新且最强大的 8B 参数模型,具备更优的单图、多图与视频理解能力、卓越 OCR 效果、低 hallucination 率,并支持端侧设备(如 iPad实时视频理解 * MiniCPMV2.6 是 MiniCPMV 系列中最新且最强大的 8B 参数模型,具备更优的单图、多图与视频理解能力、卓越 OCR 效果、低 hallucination 率,并支持端侧设备(如 iPad实时视频理解
## Quick Start
1. 首先从modelscope上下载vlm`gemma-3-4b-it`
```bash
modelscope download --model LLM-Research/gemma-3-4b-it --local_dir /mnt/contest_ceph/wenyunqing/models/gemma-3-4b-it
```
2. 构建镜像
```bash
cd ./docker-images
docker build -t combricon-mlu370x8_test_wyq:1.0.0 -f mlu370-x8.dockerfile .
```
3. 启动docker
```bash
docker run -it --rm \
-p 10086:8000 \
--name test_wyq1 \
-v /mnt/contest_ceph/wenyunqing/models/gemma-3-4b-it:/model:rw \
--privileged combricon-mlu370x8_test_wyq:1.0.0
```
注意需要在本地使用寒武纪mlu370 芯片
4. 测试服务
4.1 加载模型
```bash
curl -X POST http://localhost:10086/load_model \
-H "Content-Type: application/json" \
-d '{"model_path":"/model","dtype":"auto"}'
```
4.2 模型推理
```bash
base64 -w 0 demo.jpeg | \
jq -Rs --arg mp "/model" --arg prompt "Describe the picture" \
'{model_path: $mp, prompt: $prompt, images: ["data:image/jpeg;base64," + .], generation: {max_new_tokens: 50, temperature: 0.7}}' | \
curl -X POST "http://localhost:10086/infer" \
-H "Content-Type: application/json" \
-d @-
```
如果本地没有安装`jq`命令,可以使用`test.json`:
```bash
curl -X POST "http://localhost:10086/infer" \
-H "Content-Type: application/json" \
-d @test.json
```
## 模型测试服务原理 ## 模型测试服务原理
尽管对于视觉多模态理解没有一个业界统一的API协议标准但我们也可以基于目前比较流行的Transfomer框架**适配**各类视觉理解多模态模型。 尽管对于视觉多模态理解没有一个业界统一的API协议标准但我们也可以基于目前比较流行的Transfomer框架**适配**各类视觉理解多模态模型。
为了让我们的测试框架更通用一些我们基于Transfomer框架对于不同类型的模型系列adpat了一层方便对外提供http服务。 为了让我们的测试框架更通用一些我们基于Transfomer框架对于不同类型的模型系列adpat了一层方便对外提供http服务。
@@ -39,9 +86,9 @@ curl -X POST "http://localhost:10086/infer" \
## 如何使用视觉理解多模态测试框架 ## 如何使用视觉理解多模态测试框架
由于VLM相关的模型一般需要较大的存储空间为了更好的测试效率需要提前下载好模型相关文件k8s集群可以mount的持久化介质比如cephFS之后提交测试时指定模型存放的地址。 由于VLM相关的模型一般需要较大的存储空间为了更好的测试效率需要提前下载好模型相关文件k8s集群可以mount的持久化介质比如cephFS之后提交测试时指定模型存放的地址。
`docker-images/server.py`代码实现了一个接收图片和问题并返回回答文本和统计延迟信息的VLM HTTP 服务。测试框架集成了现成的可用的镜像`harbor.4pd.io/mic-llm-x/combricon-mlu370x8_test_wyq:1.0.0``server.py`作为入口可以用于本地端如有GPU卡测试。 `docker-images/server.py`代码实现了一个接收图片和问题并返回回答文本和统计延迟信息的VLM HTTP 服务。
作为测试对比我们也提供a100相对应的镜像 `harbor.4pd.io/hardcore-tech/a100-3.2.1-x86-ubuntu20.04-py3.10-poc-vlm-infer:0.0.1` 作为测试对比我们也提供a100相对应的镜像 `git.modelhub.org.cn:9443/enginex-iluvatar/a100-3.2.1-x86-ubuntu20.04-py3.10-poc-vlm-infer:0.0.1`
## 寒武纪mlu370-X8上视觉理解多模态模型运行测试结果 ## 寒武纪mlu370-X8上视觉理解多模态模型运行测试结果
在mlu370-X8上对部分视觉理解多模态模型进行适配测试方式为在 Nvidia A100 和 mlu370-X8 加速卡上对10个图片相关问题回答获取运行时间 在mlu370-X8上对部分视觉理解多模态模型进行适配测试方式为在 Nvidia A100 和 mlu370-X8 加速卡上对10个图片相关问题回答获取运行时间

View File

@@ -1,5 +1,5 @@
# generate harbor.4pd.io/hardcore-tech/mr100-3.2.1-x86-ubuntu20.04-py3.10-poc-vlm-infer:0.0.1 # 注意:以下基础镜像需要从寒武纪厂商获取(联系寒武纪技术支持)
FROM harbor.4pd.io/mic-llm-x/combricon-mlu370x4-base:v0.2.0-tgiv1.4.3-btv0.6.0-pt2.1-x86_64-ubuntu22.04-py310 FROM <combricon_docker_image>/mic-llm-x/combricon-mlu370x4-base:v0.2.0-tgiv1.4.3-btv0.6.0-pt2.1-x86_64-ubuntu22.04-py310
ENV HF_ENDPOINT=https://hf-mirror.com ENV HF_ENDPOINT=https://hf-mirror.com
RUN pip install transformers==4.50.0 uvicorn\[standard\] fastapi RUN pip install transformers==4.50.0 uvicorn\[standard\] fastapi
WORKDIR /app WORKDIR /app

11
test.json Normal file

File diff suppressed because one or more lines are too long