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

Function decode_pred

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

Source from the content-addressed store, hash-verified

80 return np.count_nonzero(tokens != tokenizer.pad_token_id)
81
82 def decode_pred(pred: EvalPrediction) -> Tuple[List[str], List[str]]:
83 pred_str = tokenizer.batch_decode(pred.predictions, skip_special_tokens=True)
84 label_str = tokenizer.batch_decode(pred.label_ids, skip_special_tokens=True)
85 pred_str = lmap(str.strip, pred_str)
86 label_str = lmap(str.strip, label_str)
87 return pred_str, label_str
88
89 def summarization_metrics(pred: EvalPrediction) -> Dict:
90 pred_str, label_str = decode_pred(pred)

Callers 2

summarization_metricsFunction · 0.70
translation_metricsFunction · 0.70

Calls 1

lmapFunction · 0.85

Tested by

no test coverage detected