(pred: EvalPrediction)
| 54 | return decode_tree_str(pred.predictions, tokenizer), decode_tree_str(pred.label_ids, tokenizer) |
| 55 | |
| 56 | def extraction_metrics(pred: EvalPrediction) -> Dict: |
| 57 | pred_str, label_str = decode_pred(pred) |
| 58 | extraction = get_extract_metrics(pred_lns=pred_str, tgt_lns=label_str, label_constraint=decoding_type_schema, |
| 59 | decoding_format=decoding_format) |
| 60 | # rouge: Dict = calculate_rouge(pred_str, label_str) |
| 61 | summ_len = np.round(np.mean(lmap(non_pad_len, pred.predictions)), 1) |
| 62 | extraction.update({"gen_len": summ_len}) |
| 63 | # extraction.update( ) |
| 64 | return extraction |
| 65 | |
| 66 | compute_metrics_fn = extraction_metrics |
| 67 | return compute_metrics_fn |
nothing calls this directly
no test coverage detected