Quick Start Chapter 1: Training a Model¶
Here we'll walk through training a model in PEDL using a provided example.
From the examples page, download the MNIST TensorFlow example,
mnist_tf.tgz, which contains all the files needed to run a convolutional neural net in TensorFlow using PEDL.
Extract the downloaded example file
mnist_tf.tgzinto a directory
mnist_tf. Double-clicking the file in Mac Finder or Windows File Explorer is typically sufficient. Or, in a command line, navigate to the directory containing the file and run the following commands:
mkdir mnist_tf tar -xvzf mnist_tf.tgz -C mnist_tf
After extraction, you will find that the
mnist_tfdirectory contains a collection of
.yamlfiles. Generally, the Python file(s) will specify the model and dataset, while the
.yamlfiles specify the experiment configuration. In this particular example, all the Python files in the directory together specify one model definition, whereas each
.yamlfile specifies a separate experiment configuration for that model.
Navigate to the directory
mnist_tfcontaining the extracted files of the MNIST TensorFlow example.
Double-check that the PEDL CLI is installed. If so, the command
pedl -hshould return information about the CLI.
If you are planning to run PEDL in a virtualenv, activate the virtualenv before doing this step.
To create an experiment, use the following command:
pedl experiment create const.yaml .
experimentcan also be abbreviated to
pedl e create const.yaml .
The generated experiment uses the
const.yamlexperiment configuration as well as the convolutional neural net defined in
model_def.pyon the MNIST dataset. The entire directory is passed in to the experiment definition. The
-foption can be added after
createto follow the logs of the experiment.
In general, the command to create a new experiment in PEDL is:
pedl e create <experiment configuration file> <model definition>
In the above instructions, the
const.yamlexperiment configuration file sets the searcher mode to train one model with fixed hyperparameters; replacing it by another provided experiment configuration file will run a different hyperparameter search mode (e.g.,
adaptive) for the model. See QS2: hyperparameter search.
The model definition and data source can be specified by either one Python file or a directory. See QS4: defining models.
To see more details for the experiment, use the following command. The experiment number is returned by the PEDL CLI during experiment creation in a message of the form "Created experiment 12".More information on how to interact with PEDL experiments can be found with
pedl e describe <experiment number>
pedl e -h.
pedl t describe <trial number>will give details on a particular trial within an experiment.
If desired, an experiment can be canceled before it is completed using this command:
pedl e cancel <experiment number>
Try creating experiments with other models and frameworks provided on the examples page using a similar workflow. If the example contains an
__init__.pyfile, the whole directory should be passed in as the model definition; otherwise, there should be only one
.pyfile that contains the model definition. The one exception is the
mnist_pytorchexample, which contains two distinct model definitions in separate