from rouge_score import rouge_scorer scorer = rouge_scorer.RougeScorer(['rougeL'], use_stemmer=True) def metric_rouge_score(pred, ref): return scorer.score(pred, ref)['rougeL'].fmeasure