huggingface / huggingface/evaluate
Calculating F1 fails due to error(AttributeError: 'float' object has no attribute 'size')
Open
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 341
- PR merge metrics
- No merged PRs in 30d
Description
When I try to calculate `f1` score I get this error:
```
return {"f1": float(score) if score.size == 1 else score}
^^^^^^
AttributeError: 'float' object has no attribute 'size'
```
Code to Reproduce
```py
import evaluate
f1_metric = evaluate.load("f1")
result = f1_metric.compute(predictions=[0, 1], references=[0, 1])
print(result["f1"])
```
- Tested on a default github codespaces environment and google colab.
- evaluate==0.4.3
Contributor guide
Assessment
This issue has not been assessed yet.