Update README.md
Browse files
README.md
CHANGED
|
@@ -3,6 +3,9 @@ language:
|
|
| 3 |
- multilingual
|
| 4 |
license: apache-2.0
|
| 5 |
library_name: pytorch
|
|
|
|
|
|
|
|
|
|
| 6 |
tags:
|
| 7 |
- machine-translation
|
| 8 |
- mt-evaluation
|
|
@@ -11,10 +14,6 @@ tags:
|
|
| 11 |
- pairwise-ranking
|
| 12 |
- mbr
|
| 13 |
- pear
|
| 14 |
-
metrics:
|
| 15 |
-
- pear
|
| 16 |
-
base_model: microsoft/infoxlm-large
|
| 17 |
-
pipeline_tag: translation
|
| 18 |
---
|
| 19 |
|
| 20 |
<div align="center">
|
|
@@ -25,25 +24,35 @@ pipeline_tag: translation
|
|
| 25 |
|
| 26 |
[](https://2026.aclweb.org/)
|
| 27 |
[](https://aclanthology.org/2026.acl-long.1953/)
|
|
|
|
| 28 |
[](https://github.com/prosho-97/pear)
|
| 29 |
[](https://huggingface.co/collections/Prosho/pear)
|
| 30 |
[](https://www.apache.org/licenses/LICENSE-2.0)
|
| 31 |
|
| 32 |
</div>
|
| 33 |
|
| 34 |
-
|
| 35 |
## Model variant
|
| 36 |
|
| 37 |
This repository contains the PEAR checkpoint trained without Knowledge Distillation (KD).
|
| 38 |
|
| 39 |
## Installation
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
```bash
|
| 44 |
git clone https://github.com/prosho-97/pear.git
|
| 45 |
cd pear
|
| 46 |
-
pip install .
|
| 47 |
```
|
| 48 |
|
| 49 |
## Quick start: pairwise QE scoring
|
|
@@ -59,12 +68,13 @@ scores = pear.score_pairwise(
|
|
| 59 |
translations_a=["El gato está en la alfombra."],
|
| 60 |
translations_b=["El gato está en el mapa."],
|
| 61 |
batch_size=16,
|
| 62 |
-
gpus=
|
| 63 |
progress_bar=True,
|
| 64 |
)
|
| 65 |
```
|
| 66 |
|
| 67 |
-
Positive scores prefer `translations_a`; negative scores prefer
|
|
|
|
| 68 |
|
| 69 |
To score both candidate orders:
|
| 70 |
|
|
@@ -81,7 +91,8 @@ scores = pear.score_pairwise(
|
|
| 81 |
|
| 82 |
## Reference-anchored PEAR
|
| 83 |
|
| 84 |
-
PEAR can also
|
|
|
|
| 85 |
|
| 86 |
```python
|
| 87 |
scores = pear.score_reference_anchored(
|
|
@@ -93,7 +104,8 @@ scores = pear.score_reference_anchored(
|
|
| 93 |
)
|
| 94 |
```
|
| 95 |
|
| 96 |
-
As in pairwise QE scoring, `mode="both"` is available for both-order
|
|
|
|
| 97 |
|
| 98 |
## PEAR for MBR decoding
|
| 99 |
|
|
@@ -108,12 +120,20 @@ hypotheses = [
|
|
| 108 |
"This is a bad translation.",
|
| 109 |
]
|
| 110 |
|
| 111 |
-
utility = pear_utility_matrix(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
index, expected_utility = select_mbr_hypothesis(utility)
|
| 113 |
print(hypotheses[index], expected_utility)
|
| 114 |
```
|
| 115 |
|
| 116 |
-
Use `mode="full"` for all off-diagonal ordered pairs, or `mode="half"` to
|
|
|
|
|
|
|
| 117 |
|
| 118 |
## CLI examples
|
| 119 |
|
|
@@ -136,6 +156,9 @@ MBR input JSONL rows must contain `src` and `hypotheses`:
|
|
| 136 |
pear mbr --model pear --input nbest.jsonl --output selected.jsonl --utility half --batch-size 16
|
| 137 |
```
|
| 138 |
|
|
|
|
|
|
|
|
|
|
| 139 |
## Citation
|
| 140 |
|
| 141 |
If you use this model, please cite the PEAR paper:
|
|
@@ -164,7 +187,9 @@ If you use this model, please cite the PEAR paper:
|
|
| 164 |
|
| 165 |
## Links
|
| 166 |
|
|
|
|
| 167 |
- Paper: <https://aclanthology.org/2026.acl-long.1953/>
|
| 168 |
- Code: <https://github.com/prosho-97/pear>
|
|
|
|
| 169 |
- Collection: <https://huggingface.co/collections/Prosho/pear>
|
| 170 |
-
- PEAR-XL: <https://huggingface.co/Prosho/pear-xl>
|
|
|
|
| 3 |
- multilingual
|
| 4 |
license: apache-2.0
|
| 5 |
library_name: pytorch
|
| 6 |
+
datasets:
|
| 7 |
+
- Prosho/pear-data
|
| 8 |
+
base_model: microsoft/infoxlm-large
|
| 9 |
tags:
|
| 10 |
- machine-translation
|
| 11 |
- mt-evaluation
|
|
|
|
| 14 |
- pairwise-ranking
|
| 15 |
- mbr
|
| 16 |
- pear
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
<div align="center">
|
|
|
|
| 24 |
|
| 25 |
[](https://2026.aclweb.org/)
|
| 26 |
[](https://aclanthology.org/2026.acl-long.1953/)
|
| 27 |
+
[](https://pypi.org/project/pear-mt/)
|
| 28 |
[](https://github.com/prosho-97/pear)
|
| 29 |
[](https://huggingface.co/collections/Prosho/pear)
|
| 30 |
[](https://www.apache.org/licenses/LICENSE-2.0)
|
| 31 |
|
| 32 |
</div>
|
| 33 |
|
|
|
|
| 34 |
## Model variant
|
| 35 |
|
| 36 |
This repository contains the PEAR checkpoint trained without Knowledge Distillation (KD).
|
| 37 |
|
| 38 |
## Installation
|
| 39 |
|
| 40 |
+
PEAR supports Python 3.12 and 3.13. Install the published inference toolkit
|
| 41 |
+
from PyPI:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
python -m pip install pear-mt
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
The distribution is named `pear-mt`; the Python import package and primary CLI
|
| 48 |
+
command are both named `pear`.
|
| 49 |
+
|
| 50 |
+
To install from source instead:
|
| 51 |
|
| 52 |
```bash
|
| 53 |
git clone https://github.com/prosho-97/pear.git
|
| 54 |
cd pear
|
| 55 |
+
python -m pip install .
|
| 56 |
```
|
| 57 |
|
| 58 |
## Quick start: pairwise QE scoring
|
|
|
|
| 68 |
translations_a=["El gato está en la alfombra."],
|
| 69 |
translations_b=["El gato está en el mapa."],
|
| 70 |
batch_size=16,
|
| 71 |
+
gpus="auto",
|
| 72 |
progress_bar=True,
|
| 73 |
)
|
| 74 |
```
|
| 75 |
|
| 76 |
+
Positive scores prefer `translations_a`; negative scores prefer
|
| 77 |
+
`translations_b`.
|
| 78 |
|
| 79 |
To score both candidate orders:
|
| 80 |
|
|
|
|
| 91 |
|
| 92 |
## Reference-anchored PEAR
|
| 93 |
|
| 94 |
+
PEAR can also use a human reference, or any other anchor translation, as the
|
| 95 |
+
second candidate:
|
| 96 |
|
| 97 |
```python
|
| 98 |
scores = pear.score_reference_anchored(
|
|
|
|
| 104 |
)
|
| 105 |
```
|
| 106 |
|
| 107 |
+
As in pairwise QE scoring, `mode="both"` is available for both-order
|
| 108 |
+
reference-anchored inference.
|
| 109 |
|
| 110 |
## PEAR for MBR decoding
|
| 111 |
|
|
|
|
| 120 |
"This is a bad translation.",
|
| 121 |
]
|
| 122 |
|
| 123 |
+
utility = pear_utility_matrix(
|
| 124 |
+
metric,
|
| 125 |
+
source,
|
| 126 |
+
hypotheses,
|
| 127 |
+
mode="half",
|
| 128 |
+
batch_size=16,
|
| 129 |
+
)
|
| 130 |
index, expected_utility = select_mbr_hypothesis(utility)
|
| 131 |
print(hypotheses[index], expected_utility)
|
| 132 |
```
|
| 133 |
|
| 134 |
+
Use `mode="full"` for all off-diagonal ordered pairs, or `mode="half"` to
|
| 135 |
+
score only one triangular half and fill the opposite direction by PEAR
|
| 136 |
+
antisymmetry.
|
| 137 |
|
| 138 |
## CLI examples
|
| 139 |
|
|
|
|
| 156 |
pear mbr --model pear --input nbest.jsonl --output selected.jsonl --utility half --batch-size 16
|
| 157 |
```
|
| 158 |
|
| 159 |
+
Use `--gpus 0` to force CPU inference. The default, `--gpus auto`, selects one
|
| 160 |
+
available CUDA or MPS accelerator.
|
| 161 |
+
|
| 162 |
## Citation
|
| 163 |
|
| 164 |
If you use this model, please cite the PEAR paper:
|
|
|
|
| 187 |
|
| 188 |
## Links
|
| 189 |
|
| 190 |
+
- Package: <https://pypi.org/project/pear-mt/>
|
| 191 |
- Paper: <https://aclanthology.org/2026.acl-long.1953/>
|
| 192 |
- Code: <https://github.com/prosho-97/pear>
|
| 193 |
+
- Dataset: <https://huggingface.co/datasets/Prosho/pear-data>
|
| 194 |
- Collection: <https://huggingface.co/collections/Prosho/pear>
|
| 195 |
+
- PEAR-XL: <https://huggingface.co/Prosho/pear-xl>
|