Using Parameters

💡 About this tutorial: We use YOLOv8 as a practical example to demonstrate Valohai's features. You don't need computer vision knowledge—the patterns you learn here apply to any ML framework. This tutorial focuses on defining parameters and configuration values while ensuring proper versioning and tracking of your ML workflows.

Define parameters in valohai.yaml

Tell Valohai which arguments your training script accepts. Parameters become command-line arguments automatically, no boilerplate needed.

- step:
    name: yolo
    image: docker.io/ultralytics/ultralytics:8.0.180-python
    command: python train.py {parameters}
    environment: aws-eu-west-1-p3-2xlarge
    parameters:
        - name: epochs
          type: integer
          default: 3
        - name: verbose
          type: flag
          default: False
          pass-true-as: --verbose=True
          pass-false-as: --verbose=False

What's happening here:

  • {parameters} placeholder → Valohai injects --epochs=3 --verbose=True

  • environment → GPU instance type (find available options: vh environments --gpu)

  • Flag parameters need explicit pass-true/false values for boolean handling

Parse parameters in Python

Use Python's standard argparse to receive these values. No special Valohai SDK required.

Run with custom parameters

Override defaults directly from the CLI:

Your execution details page now shows:

  • Parameters section: Displays epochs: 1 and other values

  • Logs: Confirms YOLOv8 ran exactly 1 epoch

Compare experiments at a glance

Navigate to the Executions tab to see all your runs in a table with parameter columns. No more guessing which job used which configuration.


Last updated

Was this helpful?