README.md 3.71 KB
Newer Older
zzg_666's avatar
zzg_666 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# EmoCaliber
## 论文
[EmoCaliber: Advancing Reliable Visual Emotion Comprehension via Confidence Verbalization and Calibration](https://arxiv.org/abs/2512.15528)
## 模型简介
EmoCaliber基于Qwen2.5-VL-7B实现,能够以相同的方式进行推理和训练。给定一张图像,EmoCaliber经过训练,能够按照以下流程生成结构化的情感推理:(1) 识别图像中显著的视觉元素;(2) 如果图像中有人物,则提供对人物的详细描述;(3) 描述除人物之外的上下文元素;(4) 探讨这些元素之间的相互作用;以及 (5) 基于前述观察得出情感结论。最终的情感预测整合了这些视觉线索。在输出预测结果后,EmoCaliber还会输出一个包裹在标签中的置信度分数,该分数反映了模型对其答案的自我评估确定性。

<div align=center>
    <img src="./doc/perf.jpg"/>
</div>

## 环境依赖
| 软件 | 版本 |
| :------: | :------: |
| DTK | 26.04 |
| python | 3.10.12 |
| torch | 2.9.0+das.opt1.dtk2604.20260206.g275d08c2 |
| transformers | 5.0.0.dev0 |
| vllm | 0.15.1+das.opt1.alpha.dtk2604.20260220.g2799735a |

推荐使用镜像: harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220

- 挂载地址`-v`根据实际模型情况修改

```bash
docker run -it \
    --shm-size 200g \
    --network=host \
    --name EmoCaliber \
    --privileged \
    --device=/dev/kfd \
    --device=/dev/dri \
    --device=/dev/mkfd \
    --group-add video \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    -u root \
    -v /opt/hyhal/:/opt/hyhal/:ro \
    -v /path/your_code_data/:/path/your_code_data/ \
    harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220 bash
```

更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用,其它包安装:
```
pip install pycountry
```

## 数据集
`暂无`

## 训练
`暂无`

## 推理
### vllm
#### 单机推理
```bash
## serve启动
 vllm serve wudq/EmoCaliber  --trust-remote-code -tp 1   --port 8010  --disable-custom-all-reduce --enforce-eager 

## client访问
curl -X POST "http://localhost:8010/v1/chat/completions" \
        -H "Content-Type: application/json" \
        --data '{
                "model": "wudq/EmoCaliber",
                "messages": [
                        {
                                "role": "user",
                                "content": [
                                        {
                                                "type": "text",
                                                "text": "Describe this image in one sentence."
                                        },
                                        {
                                                "type": "image_url",
                                                "image_url": {
                                                        "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
                                                }
                                        }
                                ]
                        }
                ]
        }'

```

## 效果展示
<div align=center>
    <img src="./doc/result.png"/>
</div>

### 精度
`DCU与GPU精度一致,推理框架:vllm。`

## 预训练权重
| 模型名称  | 权重大小  | DCU型号  | 最低卡数需求 |下载地址|
|:-----:|:----------:|:----------:|:---------------------:|:----------:|
| EmoCaliber | 8B | BW1000 | 1 | [HuggingFace](https://huggingface.co/wudq/EmoCaliber) |


## 源码仓库及问题反馈
- https://developer.sourcefind.cn/codes/modelzoo/emocaliber_vllm

## 参考资料
- https://github.com/wdqqdw/EmoCaliber