New Feature: YAML Config File on Gradient

The YAML config file simplifies your work from the command line by storing default arguments for different tasks.

5 years ago   •   2 min read

By Rachel Rapp

[12/2/2021 Update: This article contains information about Gradient Experiments. Experiments are now deprecated, and Gradient Workflows has replaced its functionality. Please see the Workflows docs for more information.]

Instead of typing out each argument every time you want to run something from the Gradient CLI, you can save your preferred default arguments in the config.yaml file. If you find yourself repeatedly typing the same commands and want the configuration to be reusable (and with integrated version control), this tool is for you.

Define Default Arguments

Within the YAML config file you can define your most-used or preferred command arguments for a specific task, and create multiple files for different tasks. Take a single node experiment, for example. Rather than writing out something like:

gradient experiments run singlenode \
  --projectId <your-project-id> \
  --name singleEx \
  --experimentEnv "{\"EPOCHS_EVAL\":5,\"TRAIN_EPOCHS\":10,\"MAX_STEPS\":1000,\"EVAL_SECS\":10}" \
  --container tensorflow/tensorflow:1.13.1-gpu-py3 \
  --machineType K80 \
  --command "python mnist.py" \
  --workspaceUrl https://github.com/Paperspace/mnist-sample.git \
  --modelType Tensorflow \
  --modelPath /artifacts

With the config file, you can instead specify your task and the specific configuration you want to use with it. In this case, you would just write:

gradient experiments run singlenode --optionsFile config.yaml

Generate a Template Config File

You can generate a new config file by specifying the task you want to run and using the --createOptionsFile flag:

gradient experiments run singlenode --createOptionsFile config_file_name.yaml

When you first create a config file it will automatically create a list of all potential parameters and populate each field as empty (null) values. You can then fill in each parameter which is relevant to your task, leave the other values as null, or delete them altogether.

Note: you cannot currently override specific parameters defined in the file by redefining them from the command line. If you want to make any specific parameter changes, you will have to change the values in the config.yaml itself.

Example Use Cases

You can use different config files for different tasks. Config files can be used for running notebooks, experiments, TensorBoard, and essentially any other task with parameters which you can run from the CLI. In addition to allowing integrated version control with GradientCI, this also simplifies collaboration, as you can share your config.yaml file for others to use.

For example, if you want to deploy your model you might generate the following config file:

deploymentType: TFServing
imageUrl: tensortensorflow/serving:latest-gpuflow/
instanceCount: 1
machineType: K80
modelId: mos3vkbikxc6c38
name: tfserving deployment

On the other hand, if you want to run a single node experiment your config file might look like this:

command: python mnist.py
container: tensorflow/tensorflow:1.13.1-gpu-py3
experimentEnv:
  EPOCHS_EVAL: 5
  EVAL_SECS: 10
  MAX_STEPS: 1000
  TRAIN_EPOCHS: 10
machineType: K80
modelPath: /artifacts
modelType: Tensorflow
name: mnist-cli-local-workspace
projectId: pr64qlxl0
tensorboard: false
workspace: 'https://github.com/Paperspace/mnist-sample.git'

For more information check out the docs.

Spread the word

Keep reading