OpenSTBench 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstbench-0.2.0/PKG-INFO +181 -0
- openstbench-0.2.0/README.md +132 -0
- openstbench-0.2.0/pyproject.toml +65 -0
- openstbench-0.2.0/setup.cfg +4 -0
- openstbench-0.2.0/src/OpenSTBench.egg-info/PKG-INFO +181 -0
- openstbench-0.2.0/src/OpenSTBench.egg-info/SOURCES.txt +21 -0
- openstbench-0.2.0/src/OpenSTBench.egg-info/dependency_links.txt +1 -0
- openstbench-0.2.0/src/OpenSTBench.egg-info/requires.txt +36 -0
- openstbench-0.2.0/src/OpenSTBench.egg-info/top_level.txt +1 -0
- openstbench-0.2.0/src/openstbench/__init__.py +143 -0
- openstbench-0.2.0/src/openstbench/dataset.py +199 -0
- openstbench-0.2.0/src/openstbench/emotion_evaluator.py +262 -0
- openstbench-0.2.0/src/openstbench/latency/__init__.py +4 -0
- openstbench-0.2.0/src/openstbench/latency/agent.py +108 -0
- openstbench-0.2.0/src/openstbench/latency/basics.py +57 -0
- openstbench-0.2.0/src/openstbench/latency/cli.py +257 -0
- openstbench-0.2.0/src/openstbench/latency/instance.py +176 -0
- openstbench-0.2.0/src/openstbench/latency/metrics.py +418 -0
- openstbench-0.2.0/src/openstbench/latency/utils.py +295 -0
- openstbench-0.2.0/src/openstbench/paralinguistic_evaluator.py +1318 -0
- openstbench-0.2.0/src/openstbench/speaker_similarity_evaluator.py +147 -0
- openstbench-0.2.0/src/openstbench/speech_quality_evaluator.py +171 -0
- openstbench-0.2.0/src/openstbench/translation_evaluator.py +257 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OpenSTBench
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Open speech and translation benchmarking toolkit supporting MT, ASR, TTS, SimulST, VC, and paralinguistics with optimized CJK language support
|
|
5
|
+
Author-email: Yanjie An <691476922@qq.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sjtuayj/OpenSTBench
|
|
8
|
+
Project-URL: Repository, https://github.com/sjtuayj/OpenSTBench
|
|
9
|
+
Project-URL: Documentation, https://github.com/sjtuayj/OpenSTBench#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/sjtuayj/OpenSTBench/issues
|
|
11
|
+
Keywords: translation,evaluation,BLEU,COMET,BLEURT,ASR,speech-synthesis,voice-conversion,UTMOS,WER,machine-translation,multilingual,CJK,emotion,paralinguistics,CLAP,audio-events
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: torch>=1.9.0
|
|
20
|
+
Requires-Dist: torchaudio>=0.9.0
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: sacrebleu>=2.0.0
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: tqdm
|
|
25
|
+
Requires-Dist: scipy
|
|
26
|
+
Requires-Dist: soundfile
|
|
27
|
+
Requires-Dist: textgrid
|
|
28
|
+
Requires-Dist: transformers
|
|
29
|
+
Requires-Dist: matplotlib
|
|
30
|
+
Requires-Dist: resemblyzer
|
|
31
|
+
Provides-Extra: comet
|
|
32
|
+
Requires-Dist: unbabel-comet>=2.2.2; extra == "comet"
|
|
33
|
+
Provides-Extra: whisper
|
|
34
|
+
Requires-Dist: openai-whisper; extra == "whisper"
|
|
35
|
+
Provides-Extra: speech-quality
|
|
36
|
+
Requires-Dist: jiwer; extra == "speech-quality"
|
|
37
|
+
Provides-Extra: emotion
|
|
38
|
+
Requires-Dist: funasr; extra == "emotion"
|
|
39
|
+
Requires-Dist: modelscope; extra == "emotion"
|
|
40
|
+
Provides-Extra: paralinguistics
|
|
41
|
+
Requires-Dist: transformers; extra == "paralinguistics"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: unbabel-comet>=2.2.2; extra == "all"
|
|
44
|
+
Requires-Dist: openai-whisper; extra == "all"
|
|
45
|
+
Requires-Dist: jiwer; extra == "all"
|
|
46
|
+
Requires-Dist: funasr; extra == "all"
|
|
47
|
+
Requires-Dist: modelscope; extra == "all"
|
|
48
|
+
Requires-Dist: transformers; extra == "all"
|
|
49
|
+
|
|
50
|
+
# OpenSTBench
|
|
51
|
+
|
|
52
|
+
English | [Chinese](./README_zh.md)
|
|
53
|
+
|
|
54
|
+
[](https://pypi.org/project/OpenSTBench/)
|
|
55
|
+
[](https://www.python.org/downloads/)
|
|
56
|
+
[](https://opensource.org/licenses/MIT)
|
|
57
|
+
|
|
58
|
+
OpenSTBench is an evaluation toolkit centered on translation and speech translation. It provides a unified way to score text translation quality, speech output quality, preservation-related properties, and streaming latency.
|
|
59
|
+
|
|
60
|
+
## What It Can Be Used For
|
|
61
|
+
|
|
62
|
+
This project is best suited for these directions:
|
|
63
|
+
|
|
64
|
+
- MT or S2TT text-side evaluation with `BLEU`, `chrF++`, `COMET`, and `BLEURT`
|
|
65
|
+
- S2ST evaluation by combining text quality, speech quality, speaker similarity, and latency
|
|
66
|
+
- Streaming or simultaneous speech translation latency evaluation with a custom agent
|
|
67
|
+
- Preservation analysis for speech translation outputs, including speaker similarity, emotion, and paralinguistic similarity
|
|
68
|
+
|
|
69
|
+
## Core Modules
|
|
70
|
+
|
|
71
|
+
| Module | Main Use | Typical Metrics |
|
|
72
|
+
| :--- | :--- | :--- |
|
|
73
|
+
| `TranslationEvaluator` | Text-side translation quality | `sacreBLEU`, `chrF++`, `COMET`, `BLEURT` |
|
|
74
|
+
| `SpeechQualityEvaluator` | Naturalness and text-speech consistency | `UTMOS`, `WER_Consistency`, `CER_Consistency` |
|
|
75
|
+
| `SpeakerSimilarityEvaluator` | Speaker preservation | `wavlm_similarity`, `resemblyzer_similarity` |
|
|
76
|
+
| `EmotionEvaluator` | Emotion preservation or classification accuracy | `Emotion2Vec_Cosine_Similarity`, `Audio_Emotion_Accuracy` |
|
|
77
|
+
| `ParalinguisticEvaluator` | Non-verbal and paralinguistic preservation | `Paralinguistic_Fidelity_Cosine`, `Acoustic_Event_Preservation_Rate`, `Acoustic_Event_Preservation_Macro_F1`, `Acoustic_Event_Preservation_Macro_Recall`, `Event_Aligned_Preservation_Rate`, `Conditional_Relative_Onset_Error` |
|
|
78
|
+
| `LatencyEvaluator` | Streaming / simultaneous translation latency | `StartOffset`, `ATD`, `CustomATD`, `RTF`, `Model_Generate_RTF` |
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
Basic install:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install OpenSTBench
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Optional extras:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install "OpenSTBench[comet]"
|
|
92
|
+
pip install "OpenSTBench[whisper]"
|
|
93
|
+
pip install "OpenSTBench[speech_quality]"
|
|
94
|
+
pip install "OpenSTBench[emotion]"
|
|
95
|
+
pip install "OpenSTBench[paralinguistics]"
|
|
96
|
+
pip install "OpenSTBench[all]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If you need BLEURT:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install git+https://github.com/lucadiliello/bleurt-pytorch.git
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Import
|
|
106
|
+
|
|
107
|
+
PyPI package name:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
OpenSTBench
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Python import name:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
openstbench
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from openstbench import TranslationEvaluator, SpeechQualityEvaluator
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Quick Start
|
|
126
|
+
|
|
127
|
+
Quick-start scripts live under `examples/`.
|
|
128
|
+
|
|
129
|
+
Python examples:
|
|
130
|
+
|
|
131
|
+
- `examples/python/translation_eval.py`
|
|
132
|
+
- `examples/python/speech_quality_eval.py`
|
|
133
|
+
- `examples/python/speaker_similarity_eval.py`
|
|
134
|
+
- `examples/python/emotion_eval.py`
|
|
135
|
+
- `examples/python/paralinguistic_eval.py`
|
|
136
|
+
- `examples/python/paralinguistic_identity_baseline.py`
|
|
137
|
+
- `examples/python/latency_eval.py`
|
|
138
|
+
|
|
139
|
+
Shell examples:
|
|
140
|
+
|
|
141
|
+
- `examples/bash/install_extras.sh`
|
|
142
|
+
- `examples/bash/run_latency_cli.sh`
|
|
143
|
+
|
|
144
|
+
Latency output distinguishes two RTF variants:
|
|
145
|
+
|
|
146
|
+
- `Real_Time_Factor_(RTF)`: system-level RTF. This includes agent policy overhead, pre/post-processing, and other runtime costs around model inference.
|
|
147
|
+
- `Model_Generate_RTF`: model-level RTF. This is reported only when the agent explicitly records model inference time via `record_model_inference_time(...)` or returns it in `Segment.config["model_inference_time"]`.
|
|
148
|
+
|
|
149
|
+
## Input Conventions
|
|
150
|
+
|
|
151
|
+
Common text inputs support:
|
|
152
|
+
|
|
153
|
+
- Python `List[str]`
|
|
154
|
+
- `.txt` files with one sample per line
|
|
155
|
+
- `.json` files
|
|
156
|
+
|
|
157
|
+
Common audio inputs support:
|
|
158
|
+
|
|
159
|
+
- folder path
|
|
160
|
+
- Python `List[str]`
|
|
161
|
+
- `.txt` files
|
|
162
|
+
- `.json` files
|
|
163
|
+
|
|
164
|
+
## Notes
|
|
165
|
+
|
|
166
|
+
- For `zh` / `ja` / `ko`, the toolkit uses CJK-aware handling for text-side evaluation.
|
|
167
|
+
- `SpeechQualityEvaluator` returns `CER_Consistency` for `zh` / `ja` / `ko`, and `WER_Consistency` for most other languages.
|
|
168
|
+
- `ParalinguisticEvaluator` always supports `Paralinguistic_Fidelity_Cosine`, a continuous CLAP-based audio similarity score between source and target speech.
|
|
169
|
+
- The discrete preservation branch is an utterance-level single-label task. With source-side gold labels, it reports `Acoustic_Event_Preservation_Rate`, `Acoustic_Event_Preservation_Macro_F1`, and `Acoustic_Event_Preservation_Macro_Recall`.
|
|
170
|
+
- If `source_onsets_ms` are available, the evaluator can also report alignment-aware metrics: `Event_Aligned_Preservation_Rate` and `Conditional_Relative_Onset_Error`.
|
|
171
|
+
- Alignment is computed on relative onset position, not absolute wall-clock time. This makes it suitable for cross-lingual S2ST where source and target utterance durations naturally differ.
|
|
172
|
+
- If target-side onset timestamps are not provided, the default localizer estimates them with CLAP sliding-window scoring conditioned on the target event label.
|
|
173
|
+
- These alignment metrics should be interpreted as weak, coarse-grained alignment signals rather than timestamp-accurate event localization benchmarks.
|
|
174
|
+
- If source-side gold labels are not available, the evaluator can still run in prediction-only mode and reports `Predicted_Event_Consistency_Rate`, `Predicted_Event_Consistency_Macro_F1`, and `Predicted_Event_Consistency_Macro_Recall`.
|
|
175
|
+
- The default discrete predictor is a closed-set CLAP classifier over `candidate_labels`. Users may replace it with any custom predictor object that implements `predict(audio_paths, candidate_labels)`.
|
|
176
|
+
- The default event localizer is also replaceable. Custom localizers only need to implement `localize(audio_paths, labels, candidate_labels)`.
|
|
177
|
+
- Dataset-specific label mapping is intentionally outside the core package. Pass `candidate_labels` and `label_normalizer` at call time so the same evaluator works across datasets without changing core code.
|
|
178
|
+
- For offline environments, `clap_model_path` accepts either a Hugging Face repo id or a local model directory or snapshot.
|
|
179
|
+
- In S2S latency evaluation, alignment prefers the model's native transcript when available. If the model is audio-only, the evaluator can optionally use ASR fallback to prepare alignment text.
|
|
180
|
+
- For S2S forced alignment, pass language-appropriate MFA models through `alignment_acoustic_model` and `alignment_dictionary_model`. The defaults are English.
|
|
181
|
+
- Some modules rely on optional dependencies or local model paths in offline environments.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# OpenSTBench
|
|
2
|
+
|
|
3
|
+
English | [Chinese](./README_zh.md)
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/OpenSTBench/)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
OpenSTBench is an evaluation toolkit centered on translation and speech translation. It provides a unified way to score text translation quality, speech output quality, preservation-related properties, and streaming latency.
|
|
10
|
+
|
|
11
|
+
## What It Can Be Used For
|
|
12
|
+
|
|
13
|
+
This project is best suited for these directions:
|
|
14
|
+
|
|
15
|
+
- MT or S2TT text-side evaluation with `BLEU`, `chrF++`, `COMET`, and `BLEURT`
|
|
16
|
+
- S2ST evaluation by combining text quality, speech quality, speaker similarity, and latency
|
|
17
|
+
- Streaming or simultaneous speech translation latency evaluation with a custom agent
|
|
18
|
+
- Preservation analysis for speech translation outputs, including speaker similarity, emotion, and paralinguistic similarity
|
|
19
|
+
|
|
20
|
+
## Core Modules
|
|
21
|
+
|
|
22
|
+
| Module | Main Use | Typical Metrics |
|
|
23
|
+
| :--- | :--- | :--- |
|
|
24
|
+
| `TranslationEvaluator` | Text-side translation quality | `sacreBLEU`, `chrF++`, `COMET`, `BLEURT` |
|
|
25
|
+
| `SpeechQualityEvaluator` | Naturalness and text-speech consistency | `UTMOS`, `WER_Consistency`, `CER_Consistency` |
|
|
26
|
+
| `SpeakerSimilarityEvaluator` | Speaker preservation | `wavlm_similarity`, `resemblyzer_similarity` |
|
|
27
|
+
| `EmotionEvaluator` | Emotion preservation or classification accuracy | `Emotion2Vec_Cosine_Similarity`, `Audio_Emotion_Accuracy` |
|
|
28
|
+
| `ParalinguisticEvaluator` | Non-verbal and paralinguistic preservation | `Paralinguistic_Fidelity_Cosine`, `Acoustic_Event_Preservation_Rate`, `Acoustic_Event_Preservation_Macro_F1`, `Acoustic_Event_Preservation_Macro_Recall`, `Event_Aligned_Preservation_Rate`, `Conditional_Relative_Onset_Error` |
|
|
29
|
+
| `LatencyEvaluator` | Streaming / simultaneous translation latency | `StartOffset`, `ATD`, `CustomATD`, `RTF`, `Model_Generate_RTF` |
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Basic install:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install OpenSTBench
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Optional extras:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install "OpenSTBench[comet]"
|
|
43
|
+
pip install "OpenSTBench[whisper]"
|
|
44
|
+
pip install "OpenSTBench[speech_quality]"
|
|
45
|
+
pip install "OpenSTBench[emotion]"
|
|
46
|
+
pip install "OpenSTBench[paralinguistics]"
|
|
47
|
+
pip install "OpenSTBench[all]"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If you need BLEURT:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install git+https://github.com/lucadiliello/bleurt-pytorch.git
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Import
|
|
57
|
+
|
|
58
|
+
PyPI package name:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
OpenSTBench
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Python import name:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
openstbench
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Example:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from openstbench import TranslationEvaluator, SpeechQualityEvaluator
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
Quick-start scripts live under `examples/`.
|
|
79
|
+
|
|
80
|
+
Python examples:
|
|
81
|
+
|
|
82
|
+
- `examples/python/translation_eval.py`
|
|
83
|
+
- `examples/python/speech_quality_eval.py`
|
|
84
|
+
- `examples/python/speaker_similarity_eval.py`
|
|
85
|
+
- `examples/python/emotion_eval.py`
|
|
86
|
+
- `examples/python/paralinguistic_eval.py`
|
|
87
|
+
- `examples/python/paralinguistic_identity_baseline.py`
|
|
88
|
+
- `examples/python/latency_eval.py`
|
|
89
|
+
|
|
90
|
+
Shell examples:
|
|
91
|
+
|
|
92
|
+
- `examples/bash/install_extras.sh`
|
|
93
|
+
- `examples/bash/run_latency_cli.sh`
|
|
94
|
+
|
|
95
|
+
Latency output distinguishes two RTF variants:
|
|
96
|
+
|
|
97
|
+
- `Real_Time_Factor_(RTF)`: system-level RTF. This includes agent policy overhead, pre/post-processing, and other runtime costs around model inference.
|
|
98
|
+
- `Model_Generate_RTF`: model-level RTF. This is reported only when the agent explicitly records model inference time via `record_model_inference_time(...)` or returns it in `Segment.config["model_inference_time"]`.
|
|
99
|
+
|
|
100
|
+
## Input Conventions
|
|
101
|
+
|
|
102
|
+
Common text inputs support:
|
|
103
|
+
|
|
104
|
+
- Python `List[str]`
|
|
105
|
+
- `.txt` files with one sample per line
|
|
106
|
+
- `.json` files
|
|
107
|
+
|
|
108
|
+
Common audio inputs support:
|
|
109
|
+
|
|
110
|
+
- folder path
|
|
111
|
+
- Python `List[str]`
|
|
112
|
+
- `.txt` files
|
|
113
|
+
- `.json` files
|
|
114
|
+
|
|
115
|
+
## Notes
|
|
116
|
+
|
|
117
|
+
- For `zh` / `ja` / `ko`, the toolkit uses CJK-aware handling for text-side evaluation.
|
|
118
|
+
- `SpeechQualityEvaluator` returns `CER_Consistency` for `zh` / `ja` / `ko`, and `WER_Consistency` for most other languages.
|
|
119
|
+
- `ParalinguisticEvaluator` always supports `Paralinguistic_Fidelity_Cosine`, a continuous CLAP-based audio similarity score between source and target speech.
|
|
120
|
+
- The discrete preservation branch is an utterance-level single-label task. With source-side gold labels, it reports `Acoustic_Event_Preservation_Rate`, `Acoustic_Event_Preservation_Macro_F1`, and `Acoustic_Event_Preservation_Macro_Recall`.
|
|
121
|
+
- If `source_onsets_ms` are available, the evaluator can also report alignment-aware metrics: `Event_Aligned_Preservation_Rate` and `Conditional_Relative_Onset_Error`.
|
|
122
|
+
- Alignment is computed on relative onset position, not absolute wall-clock time. This makes it suitable for cross-lingual S2ST where source and target utterance durations naturally differ.
|
|
123
|
+
- If target-side onset timestamps are not provided, the default localizer estimates them with CLAP sliding-window scoring conditioned on the target event label.
|
|
124
|
+
- These alignment metrics should be interpreted as weak, coarse-grained alignment signals rather than timestamp-accurate event localization benchmarks.
|
|
125
|
+
- If source-side gold labels are not available, the evaluator can still run in prediction-only mode and reports `Predicted_Event_Consistency_Rate`, `Predicted_Event_Consistency_Macro_F1`, and `Predicted_Event_Consistency_Macro_Recall`.
|
|
126
|
+
- The default discrete predictor is a closed-set CLAP classifier over `candidate_labels`. Users may replace it with any custom predictor object that implements `predict(audio_paths, candidate_labels)`.
|
|
127
|
+
- The default event localizer is also replaceable. Custom localizers only need to implement `localize(audio_paths, labels, candidate_labels)`.
|
|
128
|
+
- Dataset-specific label mapping is intentionally outside the core package. Pass `candidate_labels` and `label_normalizer` at call time so the same evaluator works across datasets without changing core code.
|
|
129
|
+
- For offline environments, `clap_model_path` accepts either a Hugging Face repo id or a local model directory or snapshot.
|
|
130
|
+
- In S2S latency evaluation, alignment prefers the model's native transcript when available. If the model is audio-only, the evaluator can optionally use ASR fallback to prepare alignment text.
|
|
131
|
+
- For S2S forced alignment, pass language-appropriate MFA models through `alignment_acoustic_model` and `alignment_dictionary_model`. The defaults are English.
|
|
132
|
+
- Some modules rely on optional dependencies or local model paths in offline environments.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "OpenSTBench"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Open speech and translation benchmarking toolkit supporting MT, ASR, TTS, SimulST, VC, and paralinguistics with optimized CJK language support"
|
|
9
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Yanjie An", email = "691476922@qq.com"}
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
keywords = [
|
|
17
|
+
"translation", "evaluation", "BLEU", "COMET", "BLEURT",
|
|
18
|
+
"ASR", "speech-synthesis", "voice-conversion", "UTMOS", "WER",
|
|
19
|
+
"machine-translation", "multilingual", "CJK", "emotion",
|
|
20
|
+
"paralinguistics", "CLAP", "audio-events"
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 4 - Beta",
|
|
25
|
+
"Intended Audience :: Science/Research",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
dependencies = [
|
|
32
|
+
"torch>=1.9.0",
|
|
33
|
+
"torchaudio>=0.9.0",
|
|
34
|
+
"numpy",
|
|
35
|
+
"sacrebleu>=2.0.0",
|
|
36
|
+
"pandas",
|
|
37
|
+
"tqdm",
|
|
38
|
+
"scipy",
|
|
39
|
+
"soundfile",
|
|
40
|
+
"textgrid",
|
|
41
|
+
"transformers",
|
|
42
|
+
"matplotlib",
|
|
43
|
+
"resemblyzer"
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/sjtuayj/OpenSTBench"
|
|
48
|
+
Repository = "https://github.com/sjtuayj/OpenSTBench"
|
|
49
|
+
Documentation = "https://github.com/sjtuayj/OpenSTBench#readme"
|
|
50
|
+
"Bug Tracker" = "https://github.com/sjtuayj/OpenSTBench/issues"
|
|
51
|
+
|
|
52
|
+
[project.optional-dependencies]
|
|
53
|
+
comet = ["unbabel-comet>=2.2.2"]
|
|
54
|
+
whisper = ["openai-whisper"]
|
|
55
|
+
speech_quality = ["jiwer"]
|
|
56
|
+
emotion = ["funasr", "modelscope"]
|
|
57
|
+
paralinguistics = ["transformers"]
|
|
58
|
+
all = ["unbabel-comet>=2.2.2", "openai-whisper", "jiwer", "funasr", "modelscope", "transformers"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools]
|
|
61
|
+
package-dir = {"" = "src"}
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.packages.find]
|
|
64
|
+
where = ["src"]
|
|
65
|
+
include = ["openstbench*"]
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: OpenSTBench
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Open speech and translation benchmarking toolkit supporting MT, ASR, TTS, SimulST, VC, and paralinguistics with optimized CJK language support
|
|
5
|
+
Author-email: Yanjie An <691476922@qq.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sjtuayj/OpenSTBench
|
|
8
|
+
Project-URL: Repository, https://github.com/sjtuayj/OpenSTBench
|
|
9
|
+
Project-URL: Documentation, https://github.com/sjtuayj/OpenSTBench#readme
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/sjtuayj/OpenSTBench/issues
|
|
11
|
+
Keywords: translation,evaluation,BLEU,COMET,BLEURT,ASR,speech-synthesis,voice-conversion,UTMOS,WER,machine-translation,multilingual,CJK,emotion,paralinguistics,CLAP,audio-events
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: torch>=1.9.0
|
|
20
|
+
Requires-Dist: torchaudio>=0.9.0
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: sacrebleu>=2.0.0
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: tqdm
|
|
25
|
+
Requires-Dist: scipy
|
|
26
|
+
Requires-Dist: soundfile
|
|
27
|
+
Requires-Dist: textgrid
|
|
28
|
+
Requires-Dist: transformers
|
|
29
|
+
Requires-Dist: matplotlib
|
|
30
|
+
Requires-Dist: resemblyzer
|
|
31
|
+
Provides-Extra: comet
|
|
32
|
+
Requires-Dist: unbabel-comet>=2.2.2; extra == "comet"
|
|
33
|
+
Provides-Extra: whisper
|
|
34
|
+
Requires-Dist: openai-whisper; extra == "whisper"
|
|
35
|
+
Provides-Extra: speech-quality
|
|
36
|
+
Requires-Dist: jiwer; extra == "speech-quality"
|
|
37
|
+
Provides-Extra: emotion
|
|
38
|
+
Requires-Dist: funasr; extra == "emotion"
|
|
39
|
+
Requires-Dist: modelscope; extra == "emotion"
|
|
40
|
+
Provides-Extra: paralinguistics
|
|
41
|
+
Requires-Dist: transformers; extra == "paralinguistics"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: unbabel-comet>=2.2.2; extra == "all"
|
|
44
|
+
Requires-Dist: openai-whisper; extra == "all"
|
|
45
|
+
Requires-Dist: jiwer; extra == "all"
|
|
46
|
+
Requires-Dist: funasr; extra == "all"
|
|
47
|
+
Requires-Dist: modelscope; extra == "all"
|
|
48
|
+
Requires-Dist: transformers; extra == "all"
|
|
49
|
+
|
|
50
|
+
# OpenSTBench
|
|
51
|
+
|
|
52
|
+
English | [Chinese](./README_zh.md)
|
|
53
|
+
|
|
54
|
+
[](https://pypi.org/project/OpenSTBench/)
|
|
55
|
+
[](https://www.python.org/downloads/)
|
|
56
|
+
[](https://opensource.org/licenses/MIT)
|
|
57
|
+
|
|
58
|
+
OpenSTBench is an evaluation toolkit centered on translation and speech translation. It provides a unified way to score text translation quality, speech output quality, preservation-related properties, and streaming latency.
|
|
59
|
+
|
|
60
|
+
## What It Can Be Used For
|
|
61
|
+
|
|
62
|
+
This project is best suited for these directions:
|
|
63
|
+
|
|
64
|
+
- MT or S2TT text-side evaluation with `BLEU`, `chrF++`, `COMET`, and `BLEURT`
|
|
65
|
+
- S2ST evaluation by combining text quality, speech quality, speaker similarity, and latency
|
|
66
|
+
- Streaming or simultaneous speech translation latency evaluation with a custom agent
|
|
67
|
+
- Preservation analysis for speech translation outputs, including speaker similarity, emotion, and paralinguistic similarity
|
|
68
|
+
|
|
69
|
+
## Core Modules
|
|
70
|
+
|
|
71
|
+
| Module | Main Use | Typical Metrics |
|
|
72
|
+
| :--- | :--- | :--- |
|
|
73
|
+
| `TranslationEvaluator` | Text-side translation quality | `sacreBLEU`, `chrF++`, `COMET`, `BLEURT` |
|
|
74
|
+
| `SpeechQualityEvaluator` | Naturalness and text-speech consistency | `UTMOS`, `WER_Consistency`, `CER_Consistency` |
|
|
75
|
+
| `SpeakerSimilarityEvaluator` | Speaker preservation | `wavlm_similarity`, `resemblyzer_similarity` |
|
|
76
|
+
| `EmotionEvaluator` | Emotion preservation or classification accuracy | `Emotion2Vec_Cosine_Similarity`, `Audio_Emotion_Accuracy` |
|
|
77
|
+
| `ParalinguisticEvaluator` | Non-verbal and paralinguistic preservation | `Paralinguistic_Fidelity_Cosine`, `Acoustic_Event_Preservation_Rate`, `Acoustic_Event_Preservation_Macro_F1`, `Acoustic_Event_Preservation_Macro_Recall`, `Event_Aligned_Preservation_Rate`, `Conditional_Relative_Onset_Error` |
|
|
78
|
+
| `LatencyEvaluator` | Streaming / simultaneous translation latency | `StartOffset`, `ATD`, `CustomATD`, `RTF`, `Model_Generate_RTF` |
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
Basic install:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install OpenSTBench
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Optional extras:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install "OpenSTBench[comet]"
|
|
92
|
+
pip install "OpenSTBench[whisper]"
|
|
93
|
+
pip install "OpenSTBench[speech_quality]"
|
|
94
|
+
pip install "OpenSTBench[emotion]"
|
|
95
|
+
pip install "OpenSTBench[paralinguistics]"
|
|
96
|
+
pip install "OpenSTBench[all]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If you need BLEURT:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install git+https://github.com/lucadiliello/bleurt-pytorch.git
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Import
|
|
106
|
+
|
|
107
|
+
PyPI package name:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
OpenSTBench
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Python import name:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
openstbench
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from openstbench import TranslationEvaluator, SpeechQualityEvaluator
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Quick Start
|
|
126
|
+
|
|
127
|
+
Quick-start scripts live under `examples/`.
|
|
128
|
+
|
|
129
|
+
Python examples:
|
|
130
|
+
|
|
131
|
+
- `examples/python/translation_eval.py`
|
|
132
|
+
- `examples/python/speech_quality_eval.py`
|
|
133
|
+
- `examples/python/speaker_similarity_eval.py`
|
|
134
|
+
- `examples/python/emotion_eval.py`
|
|
135
|
+
- `examples/python/paralinguistic_eval.py`
|
|
136
|
+
- `examples/python/paralinguistic_identity_baseline.py`
|
|
137
|
+
- `examples/python/latency_eval.py`
|
|
138
|
+
|
|
139
|
+
Shell examples:
|
|
140
|
+
|
|
141
|
+
- `examples/bash/install_extras.sh`
|
|
142
|
+
- `examples/bash/run_latency_cli.sh`
|
|
143
|
+
|
|
144
|
+
Latency output distinguishes two RTF variants:
|
|
145
|
+
|
|
146
|
+
- `Real_Time_Factor_(RTF)`: system-level RTF. This includes agent policy overhead, pre/post-processing, and other runtime costs around model inference.
|
|
147
|
+
- `Model_Generate_RTF`: model-level RTF. This is reported only when the agent explicitly records model inference time via `record_model_inference_time(...)` or returns it in `Segment.config["model_inference_time"]`.
|
|
148
|
+
|
|
149
|
+
## Input Conventions
|
|
150
|
+
|
|
151
|
+
Common text inputs support:
|
|
152
|
+
|
|
153
|
+
- Python `List[str]`
|
|
154
|
+
- `.txt` files with one sample per line
|
|
155
|
+
- `.json` files
|
|
156
|
+
|
|
157
|
+
Common audio inputs support:
|
|
158
|
+
|
|
159
|
+
- folder path
|
|
160
|
+
- Python `List[str]`
|
|
161
|
+
- `.txt` files
|
|
162
|
+
- `.json` files
|
|
163
|
+
|
|
164
|
+
## Notes
|
|
165
|
+
|
|
166
|
+
- For `zh` / `ja` / `ko`, the toolkit uses CJK-aware handling for text-side evaluation.
|
|
167
|
+
- `SpeechQualityEvaluator` returns `CER_Consistency` for `zh` / `ja` / `ko`, and `WER_Consistency` for most other languages.
|
|
168
|
+
- `ParalinguisticEvaluator` always supports `Paralinguistic_Fidelity_Cosine`, a continuous CLAP-based audio similarity score between source and target speech.
|
|
169
|
+
- The discrete preservation branch is an utterance-level single-label task. With source-side gold labels, it reports `Acoustic_Event_Preservation_Rate`, `Acoustic_Event_Preservation_Macro_F1`, and `Acoustic_Event_Preservation_Macro_Recall`.
|
|
170
|
+
- If `source_onsets_ms` are available, the evaluator can also report alignment-aware metrics: `Event_Aligned_Preservation_Rate` and `Conditional_Relative_Onset_Error`.
|
|
171
|
+
- Alignment is computed on relative onset position, not absolute wall-clock time. This makes it suitable for cross-lingual S2ST where source and target utterance durations naturally differ.
|
|
172
|
+
- If target-side onset timestamps are not provided, the default localizer estimates them with CLAP sliding-window scoring conditioned on the target event label.
|
|
173
|
+
- These alignment metrics should be interpreted as weak, coarse-grained alignment signals rather than timestamp-accurate event localization benchmarks.
|
|
174
|
+
- If source-side gold labels are not available, the evaluator can still run in prediction-only mode and reports `Predicted_Event_Consistency_Rate`, `Predicted_Event_Consistency_Macro_F1`, and `Predicted_Event_Consistency_Macro_Recall`.
|
|
175
|
+
- The default discrete predictor is a closed-set CLAP classifier over `candidate_labels`. Users may replace it with any custom predictor object that implements `predict(audio_paths, candidate_labels)`.
|
|
176
|
+
- The default event localizer is also replaceable. Custom localizers only need to implement `localize(audio_paths, labels, candidate_labels)`.
|
|
177
|
+
- Dataset-specific label mapping is intentionally outside the core package. Pass `candidate_labels` and `label_normalizer` at call time so the same evaluator works across datasets without changing core code.
|
|
178
|
+
- For offline environments, `clap_model_path` accepts either a Hugging Face repo id or a local model directory or snapshot.
|
|
179
|
+
- In S2S latency evaluation, alignment prefers the model's native transcript when available. If the model is audio-only, the evaluator can optionally use ASR fallback to prepare alignment text.
|
|
180
|
+
- For S2S forced alignment, pass language-appropriate MFA models through `alignment_acoustic_model` and `alignment_dictionary_model`. The defaults are English.
|
|
181
|
+
- Some modules rely on optional dependencies or local model paths in offline environments.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/OpenSTBench.egg-info/PKG-INFO
|
|
4
|
+
src/OpenSTBench.egg-info/SOURCES.txt
|
|
5
|
+
src/OpenSTBench.egg-info/dependency_links.txt
|
|
6
|
+
src/OpenSTBench.egg-info/requires.txt
|
|
7
|
+
src/OpenSTBench.egg-info/top_level.txt
|
|
8
|
+
src/openstbench/__init__.py
|
|
9
|
+
src/openstbench/dataset.py
|
|
10
|
+
src/openstbench/emotion_evaluator.py
|
|
11
|
+
src/openstbench/paralinguistic_evaluator.py
|
|
12
|
+
src/openstbench/speaker_similarity_evaluator.py
|
|
13
|
+
src/openstbench/speech_quality_evaluator.py
|
|
14
|
+
src/openstbench/translation_evaluator.py
|
|
15
|
+
src/openstbench/latency/__init__.py
|
|
16
|
+
src/openstbench/latency/agent.py
|
|
17
|
+
src/openstbench/latency/basics.py
|
|
18
|
+
src/openstbench/latency/cli.py
|
|
19
|
+
src/openstbench/latency/instance.py
|
|
20
|
+
src/openstbench/latency/metrics.py
|
|
21
|
+
src/openstbench/latency/utils.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
torch>=1.9.0
|
|
2
|
+
torchaudio>=0.9.0
|
|
3
|
+
numpy
|
|
4
|
+
sacrebleu>=2.0.0
|
|
5
|
+
pandas
|
|
6
|
+
tqdm
|
|
7
|
+
scipy
|
|
8
|
+
soundfile
|
|
9
|
+
textgrid
|
|
10
|
+
transformers
|
|
11
|
+
matplotlib
|
|
12
|
+
resemblyzer
|
|
13
|
+
|
|
14
|
+
[all]
|
|
15
|
+
unbabel-comet>=2.2.2
|
|
16
|
+
openai-whisper
|
|
17
|
+
jiwer
|
|
18
|
+
funasr
|
|
19
|
+
modelscope
|
|
20
|
+
transformers
|
|
21
|
+
|
|
22
|
+
[comet]
|
|
23
|
+
unbabel-comet>=2.2.2
|
|
24
|
+
|
|
25
|
+
[emotion]
|
|
26
|
+
funasr
|
|
27
|
+
modelscope
|
|
28
|
+
|
|
29
|
+
[paralinguistics]
|
|
30
|
+
transformers
|
|
31
|
+
|
|
32
|
+
[speech_quality]
|
|
33
|
+
jiwer
|
|
34
|
+
|
|
35
|
+
[whisper]
|
|
36
|
+
openai-whisper
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
openstbench
|