File size: 3,694 Bytes
7d29314
79c6440
 
 
 
 
 
 
 
 
 
7d29314
79c6440
7d29314
79c6440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language:
- zh
- en
tags:
- affective-computing
- emotion-analysis
- system-one
- pad-model
- onnx
- pytorch
license: mit
pipeline_tag: text-classification
---

# Vibrato: A Complete System One Model for Emotion

<p align="center">
  <a href="https://github.com/corolin/vibrato"><img src="https://img.shields.io/badge/GitHub-corolin/vibrato-blue?logo=github"></a>
  <a href="https://vibrato.syrkos.com"><img src="https://img.shields.io/badge/🌐_Website-Global-blue.svg"></a>
  <a href="https://vibrato.syrkos.cn"><img src="https://img.shields.io/badge/🇨🇳_Website-China-red.svg"></a>
  <a href="https://modelscope.cn/models/corolin/vibrato"><img src="https://img.shields.io/badge/ModelScope-魔搭-624aff.svg"></a>
  <img src="https://img.shields.io/badge/License-MIT-green.svg">
  <img src="https://img.shields.io/badge/ONNX-Ready-orange.svg">
</p>

**Vibrato** is a standalone, general-purpose **System One (Jev-class) model** that performs emotion reading as typed decisions. In a single forward pass over a sequence of dialog messages, Vibrato emits **calibrated probability distributions**:
- **3 × 9-bin Likert PAD distributions** (Pleasure, Arousal, Dominance)
- **OCC-22 ranked emotion categories**
- **Pragmatic behavioral flags (Nouls)**: `suppressed` (irony/repression) & `directed_at_me` (attribution target)
- **Confidence score** for automatic escalation to heavy LLMs

> *“In a string instrument, vibrato is how emotion travels through the note.”*

---

## ⚡ Performance Matrix

| Deployment | Hardware | Latency | Memory / Disk | Use Case |
|---|---|---|---|---|
| **Vibrato v6 int8 (Fast Head)** | CPU (1 thread) | **2.97 ~ 4.39 ms** | 2.2 MB | High-throughput streaming, zero external backbone |
| **Vibrato + GPU Head** | GPU | **1.92 ms** | 7.4 MB | Real-time chat servers |
| **e5s Bundle (All-in-one)** | CPU (1 thread) | **~15 ms** | 85 MB | Full offline affective computing, desktop AI |
| **Full BGE-M3 Backbone** | GPU | **~16 ms** | 569 MB | Maximum subtlety on affective nuance |

---

## 📦 Model Artifacts in this Repository

- `models/vibrato_v6_int8.onnx`: 1.86M judgment head quantized to INT8 (2.2 MB).
- `models/vibrato_v6_fp32.onnx`: Full precision judgment head (7.4 MB, bitwise-identical to PyTorch).
- `models/vibrato_e5s_int8.onnx`: Adapted judgment head for e5-small (2.1 MB).
- `models/e5s_int8.onnx`: Multilingual e5-small embedding backbone quantized to INT8 (118 MB).
- `checkpoints/vibrato_v6.pt` & `checkpoints/vibrato_e5s.pt`: Original PyTorch model weights.
- `vocab.json` & `tokenizer/`: Char-level mapping and subword tokenizer.

---

## 🚀 Quickstart

### 1. Installation

```bash
pip install onnxruntime tokenizers numpy
```

### 2. Run Inference

Clone or download this repo, then execute:

```bash
python run_inference.py
```

Or inside Python:

```python
from run_inference import load_e5s, score_messages

vocab, tok, head, backbone = load_e5s()

messages = [
    {"role": "user", "message": "今天累死啦,快抱抱"}
]

pad, family, nouls, conf = score_messages(messages, vocab, head, backbone=backbone, tok=tok)

print("PAD:", pad)          # [Pleasure, Arousal, Dominance] in [-1.0, +1.0]
print("Family:", family)    # e.g., 'affectionate'
print("Nouls:", nouls)      # {'suppressed': bool, 'directed_at_me': bool}
print("Confidence:", conf)  # [0.0, 1.0]
```

---

## 🔗 Links

- **GitHub Repository**: [corolin/vibrato](https://github.com/corolin/vibrato)
- **ModelScope**: [corolin/vibrato](https://modelscope.cn/models/corolin/vibrato)
- **Global Landing Page**: [https://vibrato.syrkos.com](https://vibrato.syrkos.com)
- **China Landing Page**: [https://vibrato.syrkos.cn](https://vibrato.syrkos.cn)