mit-han-lab / lite-transformer

[ICLR 2020] Lite Transformer with Long-Short Range Attention
https://arxiv.org/abs/2004.11886
Other
596 stars 81 forks source link

Fairseq cli fix redirect #10

Closed chenw23 closed 4 years ago

chenw23 commented 4 years ago

Hi Zhanghao, As I was trying to reproduce the results in your paper based on the code you have provided, I have encountered the following errors when I try to execute the command bash configs/iwslt14.de-en/prepare.sh in README.md,

Traceback (most recent call last):
  File "/usr/local/bin/fairseq-preprocess", line 11, in <module>
    load_entry_point('fairseq', 'console_scripts', 'fairseq-preprocess')()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/ubuntu/lite-transformer/fairseq_cli/preprocess.py", line 1
    ../preprocess.py
    ^
SyntaxError: invalid syntax

I was running the script on the following machine:

Deep Learning Base AMI (Ubuntu 18.04) Version 25.0 Nvidia driver version: 440.33.01 CUDA versions available: cuda-10.0 cuda-10.1 cuda-10.2 cuda-9.0 cuda-9.2 Default CUDA version is 10.0 Libraries: cuDNN, NCCL, Intel MKL-DNN

I found out that it may be the file fairseq_cli/preprocess.py that is resulting in this error. Given the code you have provided, you might want to redirect the script to ../preprocess.py. But the current code doesn't seem to be working on all platforms. So I am proposing the following changes.

Furthermore, I have analyzed code in your repo and confirmed that there is actually no other reference to the ./fairseq_cli/ files. So maybe we can just remove them and redirect everything to its real position.

By the way, I have also noticed some others wishing to have similar change on your code, for example, Akramz in their commit af6f3be.

Please point out if there is anything not correct or if there are other considerations about the issue.

Thanks!

Michaelvll commented 4 years ago

Thank you for proposing the changes! The fairseq_cli folder is from the original pytorch/fairseq repository, but I think your changes are reasonable. I merged the changes. Thank you again for your contribution. :)