Fairseq: Error while calculating score

Created on 8 May 2019  路  5Comments  路  Source: pytorch/fairseq

Hi
When I try to run the generate.py file and calculate the BLEU score, an ImportError is thrown.
ImportError: cannot import name 'libbleu' from 'fairseq'
Any help would be appreciated.

Most helpful comment

The BLEU scorer depends on a C module that is compiled when you run python setup.py develop or pip install --editable .. Did that compilation succeed without errors and/or can you try again?

Alternatively you can pip install sacrebleu and pass the --sacrebleu option to generate.py

All 5 comments

Hi! You can try cd into the folder containing fairseq's code, and run:

pip install --editable .

did you run the setup?

Running the generate script results in
AttributeError: function 'bleu_zero_init' not found

did you run the setup?

Yes

The BLEU scorer depends on a C module that is compiled when you run python setup.py develop or pip install --editable .. Did that compilation succeed without errors and/or can you try again?

Alternatively you can pip install sacrebleu and pass the --sacrebleu option to generate.py

Was this page helpful?
0 / 5 - 0 ratings