edit

Scripts usage

By default, OpenNMT's scripts can only be called from the root of OpenNMT's directory. If calling the scripts from any directory is more convenient to you, you need to extend the LUA_PATH:

export LUA_PATH="$LUA_PATH;/path/to/OpenNMT/?.lua"

Configuration files

You can pass options using a configuration file. 该文件具有简单的键值句法,每行都是 选项 = 值 。 下面是一个例子:

$ cat generic.txt
rnn_size = 600
layers = 4
brnn = true
save_model = generic

It handles empty lines and ignores lines prefixed with #.

然后,您可以在命令行上传递此文件和其它选项:

th train.lua -config generic.txt -data data/demo-train.t7 -gpuid 1

如果某选项同时出在文件和命令行中,则文件优先。

Boolean options

Boolean options can be used without argument. In this case, their presence on the command line negates their default value. For example the option -brnn enables bidirectional encoder when added to the command line.

They optionally accept an argument to make it more practical in scripts:

  • 0 or false
  • 1 or true

Multiple arguments

Some options can take multiple arguments (

argument type in the option listings). You can either space-separate (value1 value2 value3) or comma-separate (value1,value2,value3) the values.