Feature Extraction
Transformers
Safetensors
score_predictor
deberta-v3
regression
text-evaluation
multilingual
trust-remote-code
custom_code
Instructions to use QCRI/OmniScore-deberta-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QCRI/OmniScore-deberta-v3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="QCRI/OmniScore-deberta-v3", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QCRI/OmniScore-deberta-v3", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update model card with clearer usage and eval details
Browse files
README.md
CHANGED
|
@@ -31,20 +31,33 @@ The model is built on top of `microsoft/deberta-v3-base` and published with cust
|
|
| 31 |
- Backbone hidden size: 768
|
| 32 |
- Saved dtype: `float32`
|
| 33 |
|
| 34 |
-
##
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
```text
|
| 41 |
-
Task:
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
Candidate:
|
| 45 |
```
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
```text
|
| 50 |
System: ...
|
|
@@ -52,7 +65,7 @@ User: ...
|
|
| 52 |
Assistant: ...
|
| 53 |
```
|
| 54 |
|
| 55 |
-
##
|
| 56 |
|
| 57 |
Install dependencies:
|
| 58 |
|
|
@@ -60,7 +73,7 @@ Install dependencies:
|
|
| 60 |
pip install -U torch transformers sentencepiece
|
| 61 |
```
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
```python
|
| 66 |
import torch
|
|
@@ -69,20 +82,13 @@ from transformers import AutoTokenizer, AutoModel
|
|
| 69 |
repo_id = "QCRI/OmniScore-deberta-v3"
|
| 70 |
|
| 71 |
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
| 72 |
-
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True)
|
| 73 |
-
model.eval()
|
| 74 |
|
| 75 |
text = """Task: headline_evaluation
|
| 76 |
-
|
| 77 |
-
Context: Full article text goes here.
|
| 78 |
Candidate: Microsoft releases detailed model documentation."""
|
| 79 |
|
| 80 |
-
inputs = tokenizer(
|
| 81 |
-
text,
|
| 82 |
-
return_tensors="pt",
|
| 83 |
-
truncation=True,
|
| 84 |
-
max_length=512,
|
| 85 |
-
)
|
| 86 |
|
| 87 |
with torch.no_grad():
|
| 88 |
outputs = model(**inputs)
|
|
@@ -91,12 +97,10 @@ scores = {
|
|
| 91 |
name: float(outputs.predictions[0, i])
|
| 92 |
for i, name in enumerate(model.config.score_names)
|
| 93 |
}
|
| 94 |
-
|
| 95 |
print(scores)
|
| 96 |
-
# {'informativeness': ..., 'clarity': ..., 'plausibility': ..., 'faithfulness': ...}
|
| 97 |
```
|
| 98 |
|
| 99 |
-
### Batch
|
| 100 |
|
| 101 |
```python
|
| 102 |
import torch
|
|
@@ -109,31 +113,48 @@ tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
|
| 109 |
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True).to(device).eval()
|
| 110 |
|
| 111 |
texts = [
|
| 112 |
-
"Task: summarization\
|
| 113 |
-
"Task: translation_evaluation\\
|
| 114 |
]
|
| 115 |
|
| 116 |
-
batch = tokenizer(
|
| 117 |
-
|
| 118 |
-
return_tensors="pt",
|
| 119 |
-
truncation=True,
|
| 120 |
-
padding=True,
|
| 121 |
-
max_length=512,
|
| 122 |
-
).to(device)
|
| 123 |
|
| 124 |
with torch.no_grad():
|
| 125 |
pred = model(**batch).predictions
|
| 126 |
|
| 127 |
results = []
|
| 128 |
for row in pred.cpu():
|
| 129 |
-
results.append({
|
| 130 |
-
name: float(row[i])
|
| 131 |
-
for i, name in enumerate(model.config.score_names)
|
| 132 |
-
})
|
| 133 |
|
| 134 |
print(results)
|
| 135 |
```
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
### Programmatic Download (Optional)
|
| 138 |
|
| 139 |
```python
|
|
@@ -145,7 +166,7 @@ print(local_dir)
|
|
| 145 |
|
| 146 |
## Evaluation Summary
|
| 147 |
|
| 148 |
-
Metrics below are from `metrics_final.json` on a held-out test set (`num_samples =
|
| 149 |
|
| 150 |
| Dimension | RMSE | MAE | Pearson r | Spearman rho | Acc@0.5 | Acc@1.0 |
|
| 151 |
|---|---:|---:|---:|---:|---:|---:|
|
|
@@ -155,15 +176,16 @@ Metrics below are from `metrics_final.json` on a held-out test set (`num_samples
|
|
| 155 |
| plausibility | 1.0431 | 0.7889 | 0.1183 | 0.0289 | 0.3750 | 0.8298 |
|
| 156 |
| faithfulness | 0.9120 | 0.7326 | 0.1803 | 0.1327 | 0.3856 | 0.7766 |
|
| 157 |
|
| 158 |
-
Additional
|
| 159 |
|
| 160 |
- Label range: `[1.0, 5.0]`
|
| 161 |
- Prediction range: `[1.2022, 4.9631]`
|
| 162 |
-
- Exact match
|
|
|
|
| 163 |
|
| 164 |
## Data and Task Coverage
|
| 165 |
|
| 166 |
-
This checkpoint is for multi-task text quality scoring and is evaluated on a mixed test set
|
| 167 |
|
| 168 |
- Chat evaluation
|
| 169 |
- Headline evaluation
|
|
@@ -174,6 +196,17 @@ This checkpoint is for multi-task text quality scoring and is evaluated on a mix
|
|
| 174 |
|
| 175 |
The underlying project data is multilingual and multi-domain.
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
## Limitations
|
| 178 |
|
| 179 |
- Scores are continuous estimates and should not be treated as absolute truth.
|
|
|
|
| 31 |
- Backbone hidden size: 768
|
| 32 |
- Saved dtype: `float32`
|
| 33 |
|
| 34 |
+
## Quick Access
|
| 35 |
|
| 36 |
+
Model page: <https://huggingface.co/QCRI/OmniScore-deberta-v3>
|
| 37 |
|
| 38 |
+
```python
|
| 39 |
+
from transformers import AutoTokenizer, AutoModel
|
| 40 |
+
|
| 41 |
+
repo_id = "QCRI/OmniScore-deberta-v3"
|
| 42 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
| 43 |
+
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## What Input To Provide
|
| 47 |
+
|
| 48 |
+
The model takes a single text string and returns four quality scores.
|
| 49 |
+
For best results, keep a consistent prompt/input format during inference.
|
| 50 |
+
|
| 51 |
+
Recommended flat format:
|
| 52 |
|
| 53 |
```text
|
| 54 |
+
Task: <task_name>
|
| 55 |
+
Source: <source text, if available>
|
| 56 |
+
Reference: <reference text, if available>
|
| 57 |
+
Candidate: <model output being evaluated>
|
| 58 |
```
|
| 59 |
|
| 60 |
+
Chat-style input can be flattened as:
|
| 61 |
|
| 62 |
```text
|
| 63 |
System: ...
|
|
|
|
| 65 |
Assistant: ...
|
| 66 |
```
|
| 67 |
|
| 68 |
+
## Usage Examples
|
| 69 |
|
| 70 |
Install dependencies:
|
| 71 |
|
|
|
|
| 73 |
pip install -U torch transformers sentencepiece
|
| 74 |
```
|
| 75 |
|
| 76 |
+
### 1) Single Text Example
|
| 77 |
|
| 78 |
```python
|
| 79 |
import torch
|
|
|
|
| 82 |
repo_id = "QCRI/OmniScore-deberta-v3"
|
| 83 |
|
| 84 |
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
| 85 |
+
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True).eval()
|
|
|
|
| 86 |
|
| 87 |
text = """Task: headline_evaluation
|
| 88 |
+
Source: Full article text goes here.
|
|
|
|
| 89 |
Candidate: Microsoft releases detailed model documentation."""
|
| 90 |
|
| 91 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
with torch.no_grad():
|
| 94 |
outputs = model(**inputs)
|
|
|
|
| 97 |
name: float(outputs.predictions[0, i])
|
| 98 |
for i, name in enumerate(model.config.score_names)
|
| 99 |
}
|
|
|
|
| 100 |
print(scores)
|
|
|
|
| 101 |
```
|
| 102 |
|
| 103 |
+
### 2) Batch Example (GPU/CPU)
|
| 104 |
|
| 105 |
```python
|
| 106 |
import torch
|
|
|
|
| 113 |
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True).to(device).eval()
|
| 114 |
|
| 115 |
texts = [
|
| 116 |
+
"Task: summarization\nSource: ...\nCandidate: ...",
|
| 117 |
+
"Task: translation_evaluation\nSource: ...\nReference: ...\nCandidate: ...",
|
| 118 |
]
|
| 119 |
|
| 120 |
+
batch = tokenizer(texts, return_tensors="pt", truncation=True, padding=True, max_length=512)
|
| 121 |
+
batch = {k: v.to(device) for k, v in batch.items()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
with torch.no_grad():
|
| 124 |
pred = model(**batch).predictions
|
| 125 |
|
| 126 |
results = []
|
| 127 |
for row in pred.cpu():
|
| 128 |
+
results.append({name: float(row[i]) for i, name in enumerate(model.config.score_names)})
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
print(results)
|
| 131 |
```
|
| 132 |
|
| 133 |
+
### 3) Chat Messages Helper
|
| 134 |
+
|
| 135 |
+
```python
|
| 136 |
+
from transformers import AutoTokenizer, AutoModel
|
| 137 |
+
import torch
|
| 138 |
+
|
| 139 |
+
repo_id = "QCRI/OmniScore-deberta-v3"
|
| 140 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
|
| 141 |
+
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True).eval()
|
| 142 |
+
|
| 143 |
+
messages = [
|
| 144 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 145 |
+
{"role": "user", "content": "Write a concise summary of this article."},
|
| 146 |
+
{"role": "assistant", "content": "Here is a short summary..."},
|
| 147 |
+
]
|
| 148 |
+
|
| 149 |
+
flat_text = " ".join([f"{m['role'].capitalize()}: {m['content']}" for m in messages])
|
| 150 |
+
inputs = tokenizer(flat_text, return_tensors="pt", truncation=True, max_length=512)
|
| 151 |
+
|
| 152 |
+
with torch.no_grad():
|
| 153 |
+
outputs = model(**inputs)
|
| 154 |
+
|
| 155 |
+
print(dict((n, float(outputs.predictions[0, i])) for i, n in enumerate(model.config.score_names)))
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
### Programmatic Download (Optional)
|
| 159 |
|
| 160 |
```python
|
|
|
|
| 166 |
|
| 167 |
## Evaluation Summary
|
| 168 |
|
| 169 |
+
Metrics below are from `metrics_final.json` on a held-out test set (`num_samples = 17175`).
|
| 170 |
|
| 171 |
| Dimension | RMSE | MAE | Pearson r | Spearman rho | Acc@0.5 | Acc@1.0 |
|
| 172 |
|---|---:|---:|---:|---:|---:|---:|
|
|
|
|
| 176 |
| plausibility | 1.0431 | 0.7889 | 0.1183 | 0.0289 | 0.3750 | 0.8298 |
|
| 177 |
| faithfulness | 0.9120 | 0.7326 | 0.1803 | 0.1327 | 0.3856 | 0.7766 |
|
| 178 |
|
| 179 |
+
Additional values:
|
| 180 |
|
| 181 |
- Label range: `[1.0, 5.0]`
|
| 182 |
- Prediction range: `[1.2022, 4.9631]`
|
| 183 |
+
- Exact match (all four scores): `0.0293`
|
| 184 |
+
|
| 185 |
|
| 186 |
## Data and Task Coverage
|
| 187 |
|
| 188 |
+
This checkpoint is for multi-task text quality scoring and is evaluated on a mixed test set covering:
|
| 189 |
|
| 190 |
- Chat evaluation
|
| 191 |
- Headline evaluation
|
|
|
|
| 196 |
|
| 197 |
The underlying project data is multilingual and multi-domain.
|
| 198 |
|
| 199 |
+
## Intended Use
|
| 200 |
+
|
| 201 |
+
Use this model to score generated text quality (or response quality) as a supporting signal in:
|
| 202 |
+
|
| 203 |
+
- evaluation dashboards
|
| 204 |
+
- ranking experiments
|
| 205 |
+
- offline model comparison
|
| 206 |
+
- human-in-the-loop workflows
|
| 207 |
+
|
| 208 |
+
Not intended as a sole decision maker for high-stakes or safety-critical settings.
|
| 209 |
+
|
| 210 |
## Limitations
|
| 211 |
|
| 212 |
- Scores are continuous estimates and should not be treated as absolute truth.
|