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

Specify minimum version for sacrebleu #10662

Merged
merged 1 commit into from Mar 11, 2021
Merged

Conversation

LysandreJik
Copy link
Member

The _tests_requirements.txt require an install of sacrebleu without any version specified. However, some sacrebleu versions don't have the same API. I've had problems with version 1.2.10, and @lhoestq confirmed the issue is not present in 1.4.12.

The error was the following:

    def _compute(
        self,
        predictions,
        references,
        smooth_method="exp",
        smooth_value=None,
        force=False,
        lowercase=False,
        tokenize=scb.DEFAULT_TOKENIZER,
        use_effective_order=False,
    ):
        references_per_prediction = len(references[0])
        if any(len(refs) != references_per_prediction for refs in references):
            raise ValueError("Sacrebleu requires the same number of references for each prediction")
        transformed_references = [[refs[i] for refs in references] for i in range(references_per_prediction)]
>       output = scb.corpus_bleu(
            sys_stream=predictions,
            ref_streams=transformed_references,
            smooth_method=smooth_method,
            smooth_value=smooth_value,
            force=force,
            lowercase=lowercase,
            tokenize=tokenize,
            use_effective_order=use_effective_order,
        )
E       TypeError: corpus_bleu() got an unexpected keyword argument 'smooth_method'
/mnt/cache/modules/datasets_modules/metrics/sacrebleu/b390045b3d1dd4abf6a95c4a2a11ee3bcc2b7620b076204d0ddc353fa649fd86/sacrebleu.py:114: TypeError

Full stack trace:

E             File "/__w/transformers/transformers/src/transformers/trainer_seq2seq.py", line 74, in evaluate
E               return super().evaluate(eval_dataset, ignore_keys=ignore_keys, metric_key_prefix=metric_key_prefix)
E             File "/__w/transformers/transformers/src/transformers/trainer.py", line 1650, in evaluate
E               output = self.prediction_loop(
E             File "/__w/transformers/transformers/src/transformers/trainer.py", line 1823, in prediction_loop
E               metrics = self.compute_metrics(EvalPrediction(predictions=preds, label_ids=label_ids))
E             File "/__w/transformers/transformers/examples/seq2seq/run_seq2seq.py", line 563, in compute_metrics
E               result = metric.compute(predictions=decoded_preds, references=decoded_labels)
E             File "/opt/conda/lib/python3.8/site-packages/datasets/metric.py", line 403, in compute
E               output = self._compute(predictions=predictions, references=references, **kwargs)
E             File "/mnt/cache/modules/datasets_modules/metrics/sacrebleu/b390045b3d1dd4abf6a95c4a2a11ee3bcc2b7620b076204d0ddc353fa649fd86/sacrebleu.py", line 114, in _compute
E               output = scb.corpus_bleu(

I'm unsure about the minimum version required here, I just know that 1.2.10 doesn't work. Please advise if you think a better minimum version would be better.

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

1.4.12 seems a good minimum to me.

There was a big refactoring in 1.4.11 but that release was broken, so 1.4.12 is good. (see https://github.com/mjpost/sacrebleu/releases/tag/v1.4.11 and mjpost/sacrebleu#96)

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.4.12 is also the minimum version of sacrebleu for fairseq

@stas00
Copy link
Contributor

stas00 commented Mar 11, 2021

@patil-suraj, you must have meant 1.4.12

@LysandreJik LysandreJik merged commit 9fbb4cd into master Mar 11, 2021
@LysandreJik LysandreJik deleted the sacrebleu-min-version branch March 11, 2021 18:45
Iwontbecreative pushed a commit to Iwontbecreative/transformers that referenced this pull request Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants