|
| 1 | +# Zip Parameter Mode Example |
| 2 | +# Demonstrates using parameter_mode: zip for paired parameter expansion |
| 3 | +# |
| 4 | +# When using Cartesian product (default): 3 datasets × 3 models = 9 jobs |
| 5 | +# When using zip mode: 3 pairs = 3 jobs (dataset[i] paired with model[i]) |
| 6 | +# |
| 7 | +# This is useful when you have pre-determined parameter combinations rather than |
| 8 | +# wanting to test all possible combinations. |
| 9 | + |
| 10 | +name: zip_parameter_example |
| 11 | +description: Example workflow demonstrating zip parameter mode for paired parameters |
| 12 | + |
| 13 | +jobs: |
| 14 | + # Setup job - runs once before all training jobs |
| 15 | + - name: setup_environment |
| 16 | + command: | |
| 17 | + echo "Setting up training environment" |
| 18 | + mkdir -p /models /results |
| 19 | +
|
| 20 | + # Training jobs using zip mode - each dataset is paired with a specific model |
| 21 | + # Instead of 3×3=9 combinations, we get exactly 3 jobs: |
| 22 | + # - cifar10 with resnet |
| 23 | + # - mnist with cnn |
| 24 | + # - imagenet with transformer |
| 25 | + - name: train_{dataset}_{model} |
| 26 | + command: | |
| 27 | + python train.py \ |
| 28 | + --dataset={dataset} \ |
| 29 | + --model={model} \ |
| 30 | + --output=/models/{dataset}_{model}.pt |
| 31 | + depends_on: |
| 32 | + - setup_environment |
| 33 | + output_files: |
| 34 | + - model_{dataset}_{model} |
| 35 | + parameters: |
| 36 | + dataset: "['cifar10', 'mnist', 'imagenet']" |
| 37 | + model: "['resnet', 'cnn', 'transformer']" |
| 38 | + parameter_mode: zip |
| 39 | + |
| 40 | + # Evaluation job that processes all models |
| 41 | + # Note: This job uses the same parameters with zip mode to wait for the |
| 42 | + # correct corresponding training jobs |
| 43 | + - name: evaluate_{dataset}_{model} |
| 44 | + command: | |
| 45 | + python evaluate.py \ |
| 46 | + --model=/models/{dataset}_{model}.pt \ |
| 47 | + --output=/results/{dataset}_{model}_metrics.json |
| 48 | + depends_on: |
| 49 | + - train_{dataset}_{model} |
| 50 | + input_files: |
| 51 | + - model_{dataset}_{model} |
| 52 | + output_files: |
| 53 | + - metrics_{dataset}_{model} |
| 54 | + parameters: |
| 55 | + dataset: "['cifar10', 'mnist', 'imagenet']" |
| 56 | + model: "['resnet', 'cnn', 'transformer']" |
| 57 | + parameter_mode: zip |
| 58 | + |
| 59 | + # Final aggregation job |
| 60 | + - name: aggregate_results |
| 61 | + command: | |
| 62 | + python aggregate.py \ |
| 63 | + --input-dir=/results \ |
| 64 | + --output=/results/summary.json |
| 65 | + # Use regex to depend on all evaluation jobs |
| 66 | + depends_on_regexes: |
| 67 | + - "evaluate_.*" |
| 68 | + |
| 69 | +# File specifications also support zip mode |
| 70 | +files: |
| 71 | + - name: model_{dataset}_{model} |
| 72 | + path: /models/{dataset}_{model}.pt |
| 73 | + parameters: |
| 74 | + dataset: "['cifar10', 'mnist', 'imagenet']" |
| 75 | + model: "['resnet', 'cnn', 'transformer']" |
| 76 | + parameter_mode: zip |
| 77 | + |
| 78 | + - name: metrics_{dataset}_{model} |
| 79 | + path: /results/{dataset}_{model}_metrics.json |
| 80 | + parameters: |
| 81 | + dataset: "['cifar10', 'mnist', 'imagenet']" |
| 82 | + model: "['resnet', 'cnn', 'transformer']" |
| 83 | + parameter_mode: zip |
0 commit comments