Skip to content

ivotron/sweepj2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jinja2-based parameter sweep generation

Build Status

Utilities for running parameter sweeps by providing a Jinja2 template and a parameter space (in YAML).

Installation

pip install sweepj2

Usage

Here's is an example script with three variables, viz. wn_grams, learning_rate and epoch.

# script.j2
./fasttext supervised -input cooking.train -output model_cooking \
    -wordNgrams {{ wn_grams }} \
    -lr {{ learning_rate }} \
    -epoch {{ epoch }}

To do a parameter sweep over some parameter space, create a YAML file with the list of all the values corresponding to each variable in the script.

e.g. space.yml

learning_rate: [ 0.3, 0.5, 0.8 ]
epoch: [ 20, 30 ]
wn_grams: [1, 2, 3, 4, 5 ]

You can generate the scripts with all the possible combinations from the YAML file by doing:

sweepj2 --template path/to/script.j2 --space path/to/space.yml --make-executable

You will find the generated scripts in ./sweepj2-output directory, or you could mention the directory to save the files by using --output flag.

make-executable makes the resulting files executable. It can be skiped if you don't want the files executable.

About

Generate a parameter sweep using jinja2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages