Valohai Tasks allow you to run a set of parallel executions with varying parameters and input data values. They can be generated for any step that has predefined parameters.
You can launch a Task through the web application and define its properties while creating the Task, or you can define a blueprint for a task in valohai.yaml
.
Before you can create a Task blueprint in valohai.yaml
you’ll need to define at least one step
with parameters.
You can use the valohai.yaml
to define Task related properties, such as the number of maximum queued execution, on-error behavior, and of course the parameter values used in the Task executions.
The valohai.yaml
example below creates a Grid search type Task based on the step called train-model
. There will be 5 executions, one for each value defined for the epochs
parameter under the Task preset. In addition, the maximum number of queued executions for the task is 3 and the on-error
behavior is set to stop all executions if one them has an error and set the whole Task state as errored.
- step:
name: train-model
image: tensorflow/tensorflow:2.6.0
command:
- pip install valohai-utils
- python ./train_model.py {parameters}
parameters:
- name: epochs
default: 5
type: integer
- name: learning_rate
default: 0.001
type: float
inputs:
- name: dataset
default: https://valohaidemo.blob.core.windows.net/mnist/preprocessed_mnist.npz
- task:
step: train-model
name: train-in-task
type: grid-search
maximum-queued-executions: 3
on-child-error: stop-all-and-error
parameters:
- name: epochs
style: multiple
rules:
items: [5, 10, 15, 20, 25]
Run a Task based on the valohai.yaml defaults
Remember to save the changes, push them to Git and fetch the repository to Valohai!
- Open your project in Valohai
- Navigate to the Task tab.
- Click “Create Task.”
- Select the Step that is used for the Task blueprint.
- Use the “Select task blueprint…” dropdown and choose the blueprint you want to use.
- Click on the “Create task” button.