The train_and_eval.py code errored out upon the following line:
from rouge import Rouge
...
def compute_rouge(predictions, targets):
predictions = [" ".join(prediction).lower() for prediction in predictions]
predictions = [prediction if prediction else "EMPTY" for prediction in predictions]
targets = [" ".join(target).lower() for target in targets]
targets = [target if target else "EMPTY" for target in targets]
rouge = Rouge()
# Error 1: reports all kwargs as unexpected
# scores = rouge.get_scores(hyps=predictions, refs=targets, avg=True)
scores = rouge.get_scores(predictions, targets)
# Error 2: scores should have been a list of nested dictionaries
# return scores['rouge-2']['f']
return scores[0]['rouge-2']['f']
I am using a rouge library installed from https://github.com/pltrdy/rouge, and although the outputs are largely similar, I can see the API differences. Would you mind pointing me to the correct rouge library? Thanks a lot!
The
train_and_eval.py
code errored out upon the following line:I am using a rouge library installed from https://github.com/pltrdy/rouge, and although the outputs are largely similar, I can see the API differences. Would you mind pointing me to the correct rouge library? Thanks a lot!