Spaces:
Runtime error
Runtime error
Error: __init__() got an unexpected keyword argument 'tokenizer'
#5
by
drets
- opened
Any thoughts on how to fix this error?
Steps to recreate:
import evaluate
rouge = evaluate.load("rouge")
p = ["abc"]
r = ["xyz"]
rouge.compute(predictions=p, references=r)
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/rdivekar/opt/miniconda3/envs/huggingface/lib/python3.8/site-packages/evaluate/module.py", line 444, in compute
output = self._compute(**inputs, **compute_kwargs)
File "/Users/rdivekar/.cache/huggingface/modules/evaluate_modules/metrics/evaluate-metric--rouge/b01e0accf3bd6dd24839b769a5fda24e14995071570870922c71970b3a6ed886/rouge.py", line 132, in _compute
scorer = rouge_scorer.RougeScorer(rouge_types=rouge_types, use_stemmer=use_stemmer, tokenizer=tokenizer)
TypeError: __init__() got an unexpected keyword argument 'tokenizer'
Hi,
Tokenizer argument has been added less than a year ago. So I guess there is a mismatch between the 'rouge' package from evaluate and the underlying package 'rouge_scorer' (https://github.com/google-research/google-research/blob/master/rouge/rouge_scorer.py).
I'm using Python 3.10 and there is no error. Maybe your version is older and installs an old version 'rouge_scorer' where tokenizer is not expected?
Thank you, that was it! For some reason pip wasn't installing the most recent version of rouge-score by default and I had to force it to go to a newer version.
drets
changed discussion status to
closed