lua - 无效参数类型
lua - invalid argument type
我是 Lua 的新手。当前收到以下错误消息:
invalid argument type for argument -model (should be the model checkpoint
to use for sampling)
Usage: [options] <model>
我确信这是很容易解决的问题,但无法设法找到解决方案。
'model'是一个文件lm_checkpoint_epoch50.00_2.7196.t7,在目录
中
/home/ubuntu/xxx/nn/cv
我运行正在从父目录(/home/ubuntu/xxx/nn)安装程序
我已经为 运行 程序尝试了以下选项(从保存模型的目录上方的一个目录):
th sample.lua - model lm_chelm_checkpoint_epoch50.00_2.5344.t7
th sample.lua lm_chelm_checkpoint_epoch50.00_2.5344.t7
th sample.lua /cv/lm_chelm_checkpoint_epoch50.00_2.5344.t7
th sample.lua - /cv/model lm_chelm_checkpoint_epoch50.00_2.5344.t7
此外,程序有一个 torch.CmdLine() 对象,其中 :argument 等于 '/cv/lm_checkpoint_epoch50.00_2.7196.t7'。该程序打印参数,以便您在屏幕上看到以下输出:
Options
<model> /cv/lm_checkpoint_epoch50.00_2.7196.t7
所以它找到参数 'model' 的值,它是从 .lua 文件中获取的,而不是命令行中的参数。此文件是有效模式。
很迷茫,希望有人能解决这个问题。谢谢。
找到了问题 - 正如 smhx 所建议的那样,这是一个错误。我无意中更改了源代码:
require 'torch'
cmd = torch.CmdLine()
cmd:argument('-model','model checkpoint to use for sampling')
请注意,源代码中没有参数。收件人:
cmd:argument('-model','/cv/model lm_chelm_checkpoint_epoch50.00_2.5344.t7'
'model checkpoint to use for sampling')
所以参数必须通过命令行传递,而不是源代码。有了参数,就不同了——你可以把它们包含在源代码中。
因此,如果我从命令行更改回源代码和运行以下内容:
th sample.lua cv/lm_chelm_checkpoint_epoch50.00_2.5344.t7
有效。
我是 Lua 的新手。当前收到以下错误消息:
invalid argument type for argument -model (should be the model checkpoint
to use for sampling)
Usage: [options] <model>
我确信这是很容易解决的问题,但无法设法找到解决方案。
'model'是一个文件lm_checkpoint_epoch50.00_2.7196.t7,在目录
中/home/ubuntu/xxx/nn/cv
我运行正在从父目录(/home/ubuntu/xxx/nn)安装程序
我已经为 运行 程序尝试了以下选项(从保存模型的目录上方的一个目录):
th sample.lua - model lm_chelm_checkpoint_epoch50.00_2.5344.t7
th sample.lua lm_chelm_checkpoint_epoch50.00_2.5344.t7
th sample.lua /cv/lm_chelm_checkpoint_epoch50.00_2.5344.t7
th sample.lua - /cv/model lm_chelm_checkpoint_epoch50.00_2.5344.t7
此外,程序有一个 torch.CmdLine() 对象,其中 :argument 等于 '/cv/lm_checkpoint_epoch50.00_2.7196.t7'。该程序打印参数,以便您在屏幕上看到以下输出:
Options
<model> /cv/lm_checkpoint_epoch50.00_2.7196.t7
所以它找到参数 'model' 的值,它是从 .lua 文件中获取的,而不是命令行中的参数。此文件是有效模式。
很迷茫,希望有人能解决这个问题。谢谢。
找到了问题 - 正如 smhx 所建议的那样,这是一个错误。我无意中更改了源代码:
require 'torch'
cmd = torch.CmdLine()
cmd:argument('-model','model checkpoint to use for sampling')
请注意,源代码中没有参数。收件人:
cmd:argument('-model','/cv/model lm_chelm_checkpoint_epoch50.00_2.5344.t7'
'model checkpoint to use for sampling')
所以参数必须通过命令行传递,而不是源代码。有了参数,就不同了——你可以把它们包含在源代码中。
因此,如果我从命令行更改回源代码和运行以下内容:
th sample.lua cv/lm_chelm_checkpoint_epoch50.00_2.5344.t7
有效。