OpenSTBench 0.3.2__tar.gz → 0.3.3__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.
Files changed (25) hide show
  1. {openstbench-0.3.2 → openstbench-0.3.3}/PKG-INFO +1 -1
  2. {openstbench-0.3.2 → openstbench-0.3.3}/pyproject.toml +1 -1
  3. {openstbench-0.3.2 → openstbench-0.3.3}/src/OpenSTBench.egg-info/PKG-INFO +1 -1
  4. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/__init__.py +1 -1
  5. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/speech_quality_evaluator.py +31 -1
  6. {openstbench-0.3.2 → openstbench-0.3.3}/README.md +0 -0
  7. {openstbench-0.3.2 → openstbench-0.3.3}/setup.cfg +0 -0
  8. {openstbench-0.3.2 → openstbench-0.3.3}/src/OpenSTBench.egg-info/SOURCES.txt +0 -0
  9. {openstbench-0.3.2 → openstbench-0.3.3}/src/OpenSTBench.egg-info/dependency_links.txt +0 -0
  10. {openstbench-0.3.2 → openstbench-0.3.3}/src/OpenSTBench.egg-info/requires.txt +0 -0
  11. {openstbench-0.3.2 → openstbench-0.3.3}/src/OpenSTBench.egg-info/top_level.txt +0 -0
  12. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/_model_loading.py +0 -0
  13. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/dataset.py +0 -0
  14. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/emotion_evaluator.py +0 -0
  15. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/__init__.py +0 -0
  16. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/agent.py +0 -0
  17. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/basics.py +0 -0
  18. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/cli.py +0 -0
  19. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/instance.py +0 -0
  20. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/metrics.py +0 -0
  21. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/latency/utils.py +0 -0
  22. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/paralinguistic_evaluator.py +0 -0
  23. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/speaker_similarity_evaluator.py +0 -0
  24. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/temporal_consistency_evaluator.py +0 -0
  25. {openstbench-0.3.2 → openstbench-0.3.3}/src/openstbench/translation_evaluator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenSTBench
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Open speech and translation benchmarking toolkit supporting MT, ASR, TTS, SimulST, VC, and paralinguistics with optimized CJK language support
5
5
  Author-email: Yanjie An <691476922@qq.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "OpenSTBench"
7
- version = "0.3.2"
7
+ version = "0.3.3"
8
8
  description = "Open speech and translation benchmarking toolkit supporting MT, ASR, TTS, SimulST, VC, and paralinguistics with optimized CJK language support"
9
9
  readme = {file = "README.md", content-type = "text/markdown"}
10
10
  requires-python = ">=3.9,<3.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenSTBench
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Open speech and translation benchmarking toolkit supporting MT, ASR, TTS, SimulST, VC, and paralinguistics with optimized CJK language support
5
5
  Author-email: Yanjie An <691476922@qq.com>
6
6
  License: MIT
@@ -9,7 +9,7 @@ actually accessed.
9
9
  from importlib import import_module
10
10
  from typing import Dict, Tuple
11
11
 
12
- __version__ = "0.3.2"
12
+ __version__ = "0.3.3"
13
13
 
14
14
  __all__ = [
15
15
  "TranslationEvaluator",
@@ -27,6 +27,7 @@ class SpeechQualityEvaluator:
27
27
  use_wer: bool = True,
28
28
  use_utmos: bool = True,
29
29
  whisper_model: str = DEFAULT_WHISPER_MODEL,
30
+ whisper_language: Optional[str] = None,
30
31
  utmos_model_path: Optional[str] = None,
31
32
  utmos_ckpt_path: Optional[str] = None,
32
33
  device: Optional[str] = None):
@@ -36,6 +37,7 @@ class SpeechQualityEvaluator:
36
37
  self.use_utmos = use_utmos
37
38
 
38
39
  self.whisper_model_name = whisper_model
40
+ self.whisper_language = self._normalize_whisper_language(whisper_language)
39
41
  self.utmos_path = utmos_model_path
40
42
  self.utmos_ckpt = utmos_ckpt_path
41
43
 
@@ -51,6 +53,21 @@ class SpeechQualityEvaluator:
51
53
  jiwer.RemoveEmptyStrings(),
52
54
  ])
53
55
 
56
+ @staticmethod
57
+ def _normalize_whisper_language(language: Optional[str]) -> Optional[str]:
58
+ if language is None:
59
+ return None
60
+ normalized = str(language).strip().lower()
61
+ if normalized in {"zh", "zh-cn", "cmn", "<|cmn|>"}:
62
+ return "zh"
63
+ if normalized in {"en", "eng", "<|eng|>"}:
64
+ return "en"
65
+ if normalized in {"ja", "jp", "jpn"}:
66
+ return "ja"
67
+ if normalized in {"ko", "kor"}:
68
+ return "ko"
69
+ return normalized or None
70
+
54
71
  def _load_whisper(self):
55
72
  if self.whisper_model is None and self.use_wer:
56
73
  if not whisper:
@@ -93,7 +110,20 @@ class SpeechQualityEvaluator:
93
110
  self._load_whisper()
94
111
  if not self.whisper_model:
95
112
  return [""] * len(audio_paths)
96
-
113
+
114
+ transcribe_kwargs = {
115
+ "fp16": torch.cuda.is_available() and "cuda" in self.device,
116
+ "task": "transcribe",
117
+ }
118
+ if self.whisper_language:
119
+ transcribe_kwargs["language"] = self.whisper_language
120
+
121
+ results = []
122
+ for path in tqdm(audio_paths, desc="Whisper transcription"):
123
+ res = self.whisper_model.transcribe(path, **transcribe_kwargs)
124
+ results.append(res["text"].strip())
125
+ return results
126
+
97
127
  results = []
98
128
  for path in tqdm(audio_paths, desc="🎙️ Whisper 转写中"):
99
129
  res = self.whisper_model.transcribe(path, fp16=torch.cuda.is_available() and "cuda" in self.device)
File without changes
File without changes