wasiahmad / PLBART

Official code of our work, Unified Pre-training for Program Understanding and Generation [NAACL 2021].
https://arxiv.org/abs/2103.06333
MIT License
186 stars 34 forks source link

ImportError: cannot import name '_bleu' from 'bleu' #8

Closed tmarrakchi closed 3 years ago

tmarrakchi commented 3 years ago

HI,

I have a problem when I run the "/scripts/text_to_code/run.sh" file. here is the error:

File "/content/drive/MyDrive/Colab_Notebooks/PLBART-main/scripts/text_to_code/evaluator.py", line 5, in <module> from bleu import _bleu ImportError: cannot import name '_bleu' from 'bleu' (/usr/local/lib/python3.7/dist-packages/bleu/__init__.py) Traceback (most recent call last): File "/content/drive/MyDrive/Colab_Notebooks/PLBART-main/evaluation/CodeBLEU/calc_code_bleu.py", line 34, in <module> assert len(hypothesis) == len(pre_references[i]) AssertionError

if it's still a problem with the packages. Can you send me your project requirements.txt file please?

wasiahmad commented 3 years ago

Can you check by replacing the following line in the evaluator.py script (scripts/text_to_code/evaluator.py)

from bleu import _bleu

by

from evaluation.bleu import _bleu
tmarrakchi commented 3 years ago

Thanks it works well