how to run translate command in open nmt

188 Views Asked by At
  1. I have a folder called sample1 which is residing in OpenNMT-py folder i have completed first 2 steps that is

    1. Preparing the data - have created vocabulary
    2. Train the data

    but as i am translating the data with this command

    You can check the following documentation https://github.com/OpenNMT/OpenNMT-py

    onmt_translate -model sample1/newmodel_step_1200.pt -src sample1/src-test.hi -output sample1/pred_1000.txt -verbose

    it shows following error

    (nmt1) C:\Users\anurag\OpenNMT-py>onmt_translate -model sample1/newmodel_step_1200.pt -src sample1/src-test.hi -output sample1/pred_1000.txt -verbose Traceback (most recent call last):
    File "C:\Users\anurag\anaconda3\envs\nmt1\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\anurag\anaconda3\envs\nmt1\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "C:\Users\anurag\anaconda3\envs\nmt1\Scripts\onmt_translate.exe_main.py", line 7, in File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\bin\translate.py", line 60, in main translate(opt) File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\bin\translate.py", line 41, in translate _, _ = translator._translate( File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\translate\translator.py", line 343, in _translate for batch in infer_iter: File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\inputter.py", line 28, in iter for tensor_batch in self.iterable: File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\dynamic_iterator.py", line 290, in iter for bucket in self._bucketing(): File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\dynamic_iterator.py", line 231, in _bucketing for ex in self.mixer: File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\dynamic_iterator.py", line 45, in iter yield from iterable File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\text_corpus.py", line 209, in iter yield from indexed_corpus File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\text_corpus.py", line 186, in _add_index for i, item in enumerate(stream): File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\text_corpus.py", line 170, in _transform for example in stream: File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\text_corpus.py", line 153, in _tokenize for example in stream: File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\text_corpus.py", line 63, in load with exfile_open(self.src, mode='rb') as fs,\ File "C:\Users\anurag\anaconda3\envs\nmt1\lib\contextlib.py", line 113, in enter return next(self.gen) File "C:\Users\anurag\anaconda3\envs\nmt1\lib\site-packages\onmt\inputters\text_corpus.py", line 32, in exfile_open _file = codecs.open(filename, *args, **kwargs) File "C:\Users\anurag\anaconda3\envs\nmt1\lib\codecs.py", line 905, in open file = builtins.open(filename, mode, buffering) FileNotFoundError: [Errno 2] No such file or directory: 'sample1/src-test.hi'

0

There are 0 best solutions below