Uses sacrebleu's corpus_bleu implementation.
(output_lns, refs_lns, **kwargs)
| 71 | |
| 72 | |
| 73 | def calculate_bleu(output_lns, refs_lns, **kwargs) -> dict: |
| 74 | """Uses sacrebleu's corpus_bleu implementation.""" |
| 75 | return {"bleu": round(corpus_bleu(output_lns, [refs_lns], **kwargs).score, 4)} |
| 76 | |
| 77 | |
| 78 | def build_compute_metrics_fn(task_name: str, tokenizer: PreTrainedTokenizer) -> Callable[[EvalPrediction], Dict]: |
no outgoing calls
no test coverage detected