facebookresearch / fairseq

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.
MIT License
30.16k stars 6.37k forks source link

fairseq/en_de translation: Error: No module named 'examples.simultaneous_translation #3399

Open GOhaike opened 3 years ago

GOhaike commented 3 years ago

👉 Please follow one of these issue templates 👈

I am working on reproducing English to German translation on Mac terminal by following the Readme instructions but I keep getting "ModuleNotFoundError: No module named 'examples.simultaneous_translation'". when I run

TEXT=examples/translation/wmt17_en_de airseq-preprocess \

--source-lang en --target-lang de \
--trainpref $TEXT/train --validpref $TEXT/valid --testpref $TEXT/test \
--destdir data-bin/wmt17_en_de --thresholdtgt 0 --thresholdsrc 0 \
--workers 20

more-itertools in /Users/myname/opt/anaconda3/lib/python3.7/site-packages (from zipp>=0.4->importlib-resources->hydra-core<1.1->fairseq) (8.0.2) (base) Gabriels-MBP:translation myname$ TEXT=examples/translation/wmt17_en_de (base) Gabriels-MBP:translation myname$ fairseq-preprocess \

--source-lang en --target-lang de \
--trainpref $TEXT/train --validpref $TEXT/valid --testpref $TEXT/test \
--destdir data-bin/wmt17_en_de --thresholdtgt 0 --thresholdsrc 0 \
--workers 20

Traceback (most recent call last): File "/Users/myname/opt/anaconda3/bin/fairseq-preprocess", line 33, in sys.exit(load_entry_point('fairseq', 'console_scripts', 'fairseq-preprocess')()) File "/Users/myname/opt/anaconda3/bin/fairseq-preprocess", line 25, in importlib_load_entry_point return next(matches).load() File "/Users/myname/opt/anaconda3/lib/python3.7/site-packages/importlib_metadata/init.py", line 96, in load module = import_module(match.group('module')) File "/Users/myname/opt/anaconda3/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/myname/Desktop/fairseq/fairseq_cli/preprocess.py", line 18, in from fairseq import options, tasks, utils File "/Users/myname/Desktop/fairseq/fairseq/init.py", line 32, in import fairseq.criterions # noqa File "/Users/myname/Desktop/fairseq/fairseq/criterions/init.py", line 36, in importlib.import_module("fairseq.criterions." + file_name) File "/Users/myname/opt/anaconda3/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/Users/myname/Desktop/fairseq/fairseq/criterions/label_smoothed_cross_entropy_latency_augmented.py", line 6, in from examples.simultaneous_translation.utils.latency import LatencyTraining ModuleNotFoundError: No module named 'examples.simultaneous_translation' (base) Gabriels-MBP:translation myname$ from fairseq.examples import simultaneous_translation from: can't read /var/mail/fairseq.examples (base) Gabriels-MBP:translation myname$ python Python 3.7.6 (default, Jan 8 2020, 13:42:34) [Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information.

from fairseq.examples import simultaneous_translation Traceback (most recent call last): File "", line 1, in File "/Users/myname/Desktop/fairseq/fairseq/init.py", line 32, in import fairseq.criterions # noqa File "/Users/gabrielohaike/Desktop/fairseq/fairseq/criterions/init.py", line 36, in importlib.import_module("fairseq.criterions." + file_name) File "/Users/gabrielohaike/opt/anaconda3/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/Users/myname/Desktop/fairseq/fairseq/criterions/label_smoothed_cross_entropy_latency_augmented.py", line 6, in from examples.simultaneous_translation.utils.latency import LatencyTraining ModuleNotFoundError: No module named 'examples.simultaneous_translation'

jmp84 commented 3 years ago

@GOhaike thanks for the report. Could you try the solution described in https://github.com/pytorch/fairseq/issues/3309 ? If you follow the installation instructions, you should be able to run this: import examples.simultaneous_translation

stale[bot] commented 3 years ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!