I have two Torch scripts. One is some code for training a model, and the other is for testing it.
The training script accepts command line arguments
cmd = torch.CmdLine()
cmd:option('--foo', 'bar', 'example option')
opt = cmd:parse(arg or {})
The testing script also accepts command line arguments. It requires the training script because it needs some functions and constants the training script defines
require 'training'
cmd = torch.CmdLine()
cmd:option('--bar', 'foo', 'other option')
opt = cmd:parse(arg or {})
When I run my testing script, it runs the cmd:parse
call from training, and it fails because bar
isn't a valid option to pass in. Is there a convention for how to make the cmd:parse call not happen unless it's run from the command line?