Training is performed in the same Docker image as development. You might also want to setup data.
Parameters are set in file data/params.json
which is not tracked by Git.
To generate one with default values or validate an existing one, run:
python -m awe.training.params
They are documented in the script awe/training/params.py
.
For experiments, use notebook awe/training/training.ipynb
or script awe/training/train.py
.
python -m awe.training.train
Full cross-validation experiment can be performed via a Python script (if you have enough RAM to fit all training and testing data),
python -m awe.training.crossval
or a bash script (which runs each fold as a separate process to ensure only necessary data are loaded to memory).
./sh/crossval.sh
It is recommended to set val_subset
to 1
(since testing will be performed)
and disable all checkpoint creation (save_*
parameters).
To perform an experiment over SSH without losing it on hangup,
tmux
can be used to start the experiment,
then detached,
and its output obtained continuously using:
tmux capture-pane -S - && tmux save-buffer $(pwd)/out.txt
After cross-validation, compute mean results of all runs:
python -m awe.training.crossval_mean <first_version_num>
Training can be run on CPU
as GitHub Action Training.
To pass data/params.json
as input, minify them using:
jq -c . < data/params.json
Training can be run on GPU as a Gradient Workflow.
-
Prepare data (including GloVe embeddings by running
python -m awe.prepare
) and build a Docker image containing them:docker build -t janjones/awe-data -f gradient/Dockerfile.data . docker push janjones/awe-data export TIMESTAMP=$(date +%s) docker tag janjones/awe-data janjones/awe-data:$TIMESTAMP docker push janjones/awe-data:$TIMESTAMP
-
Login to Gradient CLI:
gradient apiKey <api_key>
-
Create a workflow (and copy the resulting ID):
gradient workflows create --name crossval --projectId <project_id>
-
Run the workflow1:
jq --null-input --arg params "$(cat data/params.json)" '{ "params": { "value": $params } }' > data/input.json gradient workflows run --id <workflow_id> --path ./gradient/crossval.yml --inputPath data/input.json
Footnotes
-
The workflow spec
crossval.yml
can be freely edited without pushing to Git, it is read by the Gradient CLI only locally. ↩