MCPcopy Index your code
hub / github.com/RingBDStack/GDAP / translation_metrics

Function translation_metrics

seq2seq/utils.py:96–101  ·  view source on GitHub ↗
(pred: EvalPrediction)

Source from the content-addressed store, hash-verified

94 return rouge
95
96 def translation_metrics(pred: EvalPrediction) -> Dict:
97 pred_str, label_str = decode_pred(pred)
98 bleu: Dict = calculate_bleu(pred_str, label_str)
99 gen_len = np.round(np.mean(lmap(non_pad_len, pred.predictions)), 1)
100 bleu.update({"gen_len": gen_len})
101 return bleu
102
103 compute_metrics_fn = summarization_metrics if "summarization" in task_name else translation_metrics
104 return compute_metrics_fn

Callers

nothing calls this directly

Calls 3

calculate_bleuFunction · 0.85
lmapFunction · 0.85
decode_predFunction · 0.70

Tested by

no test coverage detected