Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_custom_baseline still produces errors for bertscore #843

Closed
penatbater opened this issue Nov 12, 2020 · 5 comments · Fixed by #1851
Closed

use_custom_baseline still produces errors for bertscore #843

penatbater opened this issue Nov 12, 2020 · 5 comments · Fixed by #1851
Labels
metric bug A bug in a metric script

Comments

@penatbater
Copy link

penatbater commented Nov 12, 2020

metric = load_metric('bertscore')
a1 = "random sentences"
b1 = "random sentences"
metric.compute(predictions = [a1], references = [b1], lang = 'en')

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/stephen_chan/.local/lib/python3.6/site-packages/datasets/metric.py", line 393, in compute output = self._compute(predictions=predictions, references=references, **kwargs) File "/home/stephen_chan/.cache/huggingface/modules/datasets_modules/metrics/bertscore/361e597a01a41d6cf95d94bbfb01dea16261687abc0c6c74cc9930f80488f363/bertscore.py", line 108, in _compute hashcode = bert_score.utils.get_hash(model_type, num_layers, idf, rescale_with_baseline) TypeError: get_hash() missing 1 required positional argument: 'use_custom_baseline'

Adding 'use_custom_baseline = False' as an argument produces this error

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/stephen_chan/.local/lib/python3.6/site-packages/datasets/metric.py", line 393, in compute output = self._compute(predictions=predictions, references=references, **kwargs) TypeError: _compute() got an unexpected keyword argument 'use_custom_baseline'

This is on Ubuntu 18.04, Python 3.6.9, datasets version 1.1.2

@lhoestq lhoestq added the metric bug A bug in a metric script label Nov 12, 2020
@lhoestq
Copy link
Member

lhoestq commented Nov 12, 2020

Thanks for reporting ! That's a bug indeed
If you want to contribute, feel free to fix this issue and open a PR :)

@pvl
Copy link
Contributor

pvl commented Feb 9, 2021

This error is because of a mismatch between datasets and bert_score. With datasets=1.1.2 and bert_score>=0.3.6 it works ok. So pip install -U bert_score should fix the problem.

@lhoestq
Copy link
Member

lhoestq commented Feb 9, 2021

Thanks for the heads up @pvl and for the PR as well :)

@SkanderHellal
Copy link

SkanderHellal commented Aug 24, 2021

Hello everyone,

I think the problem is not solved:

from datasets import load_metric
metric=load_metric('bertscore')
metric.compute(
    predictions=predictions,
    references=references,
    lang='fr',
    rescale_with_baseline=True
)
TypeError: get_hash() missing 2 required positional arguments: 'use_custom_baseline' and 'use_fast_tokenizer'

This code is produced using Python 3.6.9 datasets==1.1.2 and bert_score==0.3.10

@lhoestq
Copy link
Member

lhoestq commented Aug 30, 2021

Hi ! This has been fixed by #2770, we'll do a new release soon to make the fix available :)

In the meantime please use an older version of bert_score

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metric bug A bug in a metric script
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants