Skip to content
Snippets Groups Projects

Support subword and word language models

Merged Solene Tarride requested to merge subword-and-word-lm into main
All threads resolved!
3 files
+ 221
125
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 7
3
@@ -571,10 +571,14 @@ class CTCLanguageDecoder:
).strip()
for hypothesis in hypotheses
]
# Normalize confidence score
# Normalize confidence scoref"{np.around(np.mean(char_confidences[current : next_token]), 2)}
out["confidence"] = [
np.exp(
hypothesis[0].score / ((self.language_model_weight + 1) * length.item())
np.around(
np.exp(
hypothesis[0].score
/ ((self.language_model_weight + 1) * length.item())
),
2,
)
for hypothesis, length in zip(hypotheses, batch_sizes)
]
Loading