Skip to content
Snippets Groups Projects

Add Language Model Decoder

Merged Solene Tarride requested to merge lm-decoder into main
All threads resolved!
3 files
+ 69
91
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