rsennrich / subword-nmt

Unsupervised Word Segmentation for Neural Machine Translation and Text Generation
MIT License
2.18k stars 464 forks source link

No module named apply_bpe #107

Closed RamoramaInteractive closed 2 years ago

RamoramaInteractive commented 2 years ago

After training the model I wanted to do the translation in the section translation https://awslabs.github.io/sockeye/tutorials/wmt.html, but I only receive /opt/conda/envs/rapids/bin/python3: No module named apply_bpe,

How to fix this problem?

rsennrich commented 2 years ago

you'll have to follow one of the earlier steps in the tutorial to make this work (and this isn't persistent, so you'll have to repeat this for each session or add it to your .bashrc file:

export PYTHONPATH=$(pwd)/subword-nmt:$PYTHONPATH

(if you add it to your .bashrc file, make sure to provide the absolute path, not the one relative to your working directory ($(pwd)))

PS: the recommended way to install/execute apply_bpe is shown in the README - the tutorial doesn't properly install subword-nmt.

RamoramaInteractive commented 2 years ago

Hi Rico,

After re-adding export PYTHONPATH=$(pwd)/subword-nmt:$PYTHONPATH I was able to execute the translation, but it didn't return the expected outputhe is a great guy and a family father .`, but nothing.

I will try the recommended installation in the README next.

rsennrich commented 2 years ago

you can check if this error is related to subword-nmt by only executing the top three lines of the script (without the trailing | \). If this works properly, it's probably a problem with Sockeye. Remove the 2>/dev/null part so you get error messages.

RamoramaInteractive commented 2 years ago

I found a solution for my problem! :)

My model hasn't even trained yet, so I probably couldn't do any translation due to the missing data like "metrics" and the "params".

What I find funny, I had to rewrite the Sockeye code like in the last WMT 2014 English-German Tutorial: https://awslabs.github.io/sockeye/tutorials/wmt_large.html

Here is another link with important hints: https://github.com/awslabs/sockeye/issues/981