wittawatj / cmdprod

Automatically generate command-line arguments for parameter sweeping
MIT License
1 stars 0 forks source link

Specify tasks via config files #1

Open p16i opened 4 years ago

p16i commented 4 years ago

It would be nice if one can use this module via config files.

For example, consider this configuration file

# filename: testing.yml

cmd_template: train.py --model {model} --lr {lr} --dataset {dataset} --epoch 10
parameters:
- model: [mlp, resnet20]
- lr: [0.001, 0.0001]
- dataset: [mnist, fashion_mnist]

One might just call

$ cmdprod --config testing.yml
# Output

train.py --model mlp --lr 0.001 --dataset mnist --epoch 10
train.py --model mlp --lr 0.001 --dataset fashion_mnist --epoch 10
train.py --model mlp --lr 0.0001 --dataset mnist --epoch 10
train.py --model mlp --lr 0.0001 --dataset fashion_mnist --epoch 10
train.py --model resnet --lr 0.001 --dataset mnist --epoch 10
train.py --model resnet --lr 0.001 --dataset fashion_mnist --epoch 10
train.py --model resnet --lr 0.0001 --dataset mnist --epoch 10
train.py --model resnet --lr 0.0001 --dataset fashion_mnist --epoch 10
wittawatj commented 4 years ago

Thank you for the suggestion. In fact, having a config file was the first idea I had. But then I thought, if one has to write a new file, one might as well write a Python script. That is why I only have the pure Python version. I will consider.

Another version I thought of is an inline version, say:

train.py --model @[mlp, resnet20] --lr @[0.001, 0.0001] --dataset @[mnist, fashion_mnist] --epoch 10

In the current version, there are also many other missing features. One thing is an "if". For example, it could be that the combination of {model=mlp, lr=0.001} does not make sense and should be excluded. Still cannot figure out how best to specify this.

wittawatj commented 4 years ago

Feel free to propose what you want to see. Just make up some syntax you want to be able to use and I will think about it. The "if" feature (or rather the "except" features) is definitely a must in my opinion. We can't do that yet in the current version. The closest thing is ParamGroup.