Im2Text
Im2Text copied to clipboard
OpenNMT not found - google colab
Hi, I am trying to use im2text on google colab and there is a problem with path to opennmt
OpenNMT not found. Please enter the path to OpenNMT:
/content/Im2Text/opennmt
Error: opennmt not found in the specified path!
how can I fix it?
Is the folder there then? Can you try
! ls /content/Im2Text/opennmt
and see if it's there?
btw, did you install lua-torch on colab youself? I don't think colab comes with lua-torch, but maybe I'm wrong.
Yes @da03, I have under !ls /content/Im2Text/opennmt everything from https://github.com/OpenNMT/Im2Text/tree/master/opennmt Also, I have installed lua-torch on colab myself. It was weird because I had to compile some sources but it seems that it is installed.
%cd /content/
!git clone https://github.com/nagadomi/distro.git torch --recursive
import os
os.chdir('./torch/')
!bash install-deps
!./install.sh
!. ./install/bin/torch-activate
and then
!/content/torch/install/bin/luarocks list
----------------
argcheck
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
class
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
cudnn
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
cunn
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
cutorch
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
cwrap
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
dok
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
env
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
gnuplot
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
graph
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
image
1.1.alpha-0 (installed) - /content/torch/install/lib/luarocks/rocks
lua-cjson
2.1devel-1 (installed) - /content/torch/install/lib/luarocks/rocks
luaffi
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
luafilesystem
1.6.3-1 (installed) - /content/torch/install/lib/luarocks/rocks
moses
2.1.0-1 (installed) - /root/.luarocks/lib/luarocks/rocks
1.6.1-1 (installed) - /content/torch/install/lib/luarocks/rocks
nn
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
nngraph
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
nnx
0.1-1 (installed) - /content/torch/install/lib/luarocks/rocks
opennmt
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
optim
1.0.5-0 (installed) - /content/torch/install/lib/luarocks/rocks
paths
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
penlight
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
qtlua
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
qttorch
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
sundown
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
sys
1.1-0 (installed) - /content/torch/install/lib/luarocks/rocks
tds
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
threads
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
torch
scm-1 (installed) - /root/.luarocks/lib/luarocks/rocks
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
trepl
scm-1 (installed) - /content/torch/install/lib/luarocks/rocks
xlua
1.0-0 (installed) - /content/torch/install/lib/luarocks/rocks```
!ls you mentioned gives results below:
/content
Constants.lua init.lua ModelSelector.lua SeqTagger.lua translate
data LanguageModel.lua modules tagger utils
Factory.lua Model.lua Seq2Seq.lua train
so it seems that it works
Hmm weird, can you directly try
require 'opennmt.init'
in th
?
such as th -e 'require opennmt.init'
and see what's the error msg.
Ok, tried !/content/torch/install/bin/th -e 'require opennmt.init'
and got: attempt to call a nil value
Hmm it might be due to the opennmt installed in rocks, can you remove /root/.luarocks/lib/luarocks/rocks/opennmt
? Like by
!rm -rf /root/.luarocks/lib/luarocks/rocks/opennmt
Yes, I tried that but unfortunately it didn't fix the problem :/