Problem with add method

#3
by mdocekal - opened

Not sure whether I'm missing something, but I'm not able to use .add method.
This code:

 rouge = evaluate.load('rouge')
 rouge.add(predictions="sentence 1", references="sentence 2")

will rise following exception:

 ValueError: Evaluation module inputs don't match the expected format.
 Expected format: {'predictions': Value(dtype='string', id='sequence'), 'references': Value(dtype='string', id='sequence')},

I've also tried:

 rouge.add(predictions="sentence 1", references=["sentence 2"])

, but it also raised an exception:

 ValueError: Evaluation module inputs don't match the expected format.
 Expected format: {'predictions': Value(dtype='string', id='sequence'), 'references': Sequence(feature=Value(dtype='string', id='sequence'), length=-1, id=None)},

The original exception is TypeError with following traceback:

.../.../evaluate/module.py", line 531, in add
    self._enforce_nested_string_type(self.info.features, example)
.../.../evaluate/module.py", line 691, in _enforce_nested_string_type
    return [self._enforce_nested_string_type(sub_schema, o) for o in obj]
.../.../evaluate/module.py", line 691, in <listcomp>
    return [self._enforce_nested_string_type(sub_schema, o) for o in obj]
.../.../evaluate/module.py", line 687, in _enforce_nested_string_type
    return [self._enforce_nested_string_type(sub_schema, o) for k, (sub_schema, o) in zip_dict(schema, obj)]
.../.../evaluate/module.py", line 687, in <listcomp>
    return [self._enforce_nested_string_type(sub_schema, o) for k, (sub_schema, o) in zip_dict(schema, obj)]
.../.../datasets/utils/py_utils.py", line 286, in zip_dict
    yield key, tuple(d[key] for d in dicts)
.../.../datasets/utils/py_utils.py", line 286, in <genexpr>
    yield key, tuple(d[key] for d in dicts)
Evaluate Metric org

Thanks for reporting, opened an issue on the main repo, too.

Sign up or log in to comment