Problem when installing new version after using luarocks install on an older version

I have made a new dir on my gpu machine and cloned version 0.9 from github

[vincent@knox /home/local/opennmt/version0.9]$ git clone https://github.com/OpenNMT/OpenNMT.git
Cloning into ‘OpenNMT’…
remote: Counting objects: 18184, done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 18184 (delta 26), reused 50 (delta 18), pack-reused 18105
Receiving objects: 100% (18184/18184), 23.29 MiB | 11.71 MiB/s, done.
Resolving deltas: 100% (11276/11276), done.

When I now try to use train.lua as before with version 0.8, I get an error:

[vincent@knox /home/wiske/tmmt/enhu/nmt]$ th /home/local/opennmt/version0.9/OpenNMT/train.lua -data enhu-train.t7 -save_model enhu -gpuid 1
/home/pricie/vincent/torch/install/bin/luajit: /home/local/opennmt/version0.9/OpenNMT/train.lua:24: attempt to index field ‘DynamicDataRepository’ (a nil value)
stack traceback:
/home/local/opennmt/version0.9/OpenNMT/train.lua:24: in main chunk
[C]: in function ‘dofile’
…cent/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x004064f0

Did I forget something or is this a bug?

I think this is related to:

Does this imply that I cannot have two different versions of OpenNMT running on the same machine?

You can but you need to remove the version that was globally installed with luarocks. You can simply maintain 2 separate directories and cd into the one you want to use.

Thanks.
I took your suggestion, which seemed to work fine

[vincent@knox /home/local/opennmt/version0.9/OpenNMT]$ luarocks make rocks/opennmt-scm-1.rockspec
Updating manifest for /home/pricie/vincent/torch/install/lib/luarocks/rocks
opennmt scm-1 is now built and installed in /home/pricie/vincent/torch/install/ (license: MIT)

But when I try to train, I still get

[vincent@knox /home/wiske/tmmt/enhu/nmt]$ th /home/local/opennmt/version0.9/OpenNMT/train.lua -data enhu-train.t7 -save_model enhu -gpuid 1
/home/pricie/vincent/torch/install/bin/luajit: …t/torch/install/share/lua/5.1/onmt/data/Preprocessor.lua:198: attempt to call field ‘getOpts’ (a nil value)
stack traceback:
…t/torch/install/share/lua/5.1/onmt/data/Preprocessor.lua:198: in function ‘declareOpts’
…nstall/share/lua/5.1/onmt/data/DynamicDataRepository.lua:7: in function ‘declareOpts’
/home/local/opennmt/version0.9/OpenNMT/train.lua:24: in main chunk
[C]: in function ‘dofile’
…cent/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x004064f0

I think your only problem is that you have to launch your command being in the main ONMT folder itself.

cd /home/local/opennmt/version0.9/OpenNMT/
th train.lua -data [PathToYourData]/enhu-train.t7 -save_model [PathToYourData]/enhu -gpuid 1

:wink:

Simply don’t install OpenNMT with luarocks. This is source of errors.

Type:

luarocks remove opennmt

and re-try.

Thanks, that did indeed the trick. So if I want to be able to call it from anywhere, I should remove the globally installed version using luarocks remove opennmt ? But from which path would I have to launch this luarocks command?

You can call luarocks from anywhere but you will still need to use OpenNMT from the OpenNMT directory.