forked from kubeflow/katib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrial-metadata-substitution.yaml
82 lines (82 loc) · 2.73 KB
/
trial-metadata-substitution.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
# This example shows how you can use trial metadata in template substitution
apiVersion: kubeflow.org/v1beta1
kind: Experiment
metadata:
namespace: kubeflow
name: trial-metadata-substitution
spec:
objective:
type: maximize
goal: 0.99
objectiveMetricName: Validation-accuracy
additionalMetricNames:
- Train-accuracy
algorithm:
algorithmName: random
parallelTrialCount: 3
maxTrialCount: 12
maxFailedTrialCount: 3
parameters:
- name: lr
parameterType: double
feasibleSpace:
min: "0.01"
max: "0.03"
trialTemplate:
primaryContainerName: training-container
trialParameters:
- name: learningRate
description: Learning rate for the training model
reference: lr
- name: trialName
description: Name of the current trial's job
reference: ${trialSpec.Name}
- name: trialNamespace
description: Namespace of the current trial's job
reference: ${trialSpec.Namespace}
- name: trialKind
description: Kind of the current trial's job
reference: ${trialSpec.Kind}
- name: trialAPIVersion
description: API version of the current trial's job
reference: ${trialSpec.APIVersion}
- name: trialLabelCustom
description: Trial's job label with custom value
reference: ${trialSpec.Labels[custom-key]}
- name: trialAnnotationCustom
description: Trial's job annotation with custom value
reference: ${trialSpec.Annotations[custom-key]}
trialSpec:
apiVersion: batch/v1
kind: Job
metadata:
annotations:
"custom-key": "custom-annotation"
labels:
"custom-key": "custom-label"
spec:
template:
spec:
containers:
- name: training-container
image: docker.io/kubeflowkatib/mxnet-mnist:latest
command:
- "python3"
- "/opt/mxnet-mnist/mnist.py"
- "--batch-size=64"
- "--lr=${trialParameters.learningRate}"
env:
- name: TRIAL_NAME
value: ${trialParameters.trialName}
- name: TRIAL_NAMESPACE
value: ${trialParameters.trialNamespace}
- name: TRIAL_KIND
value: ${trialParameters.trialKind}
- name: TRIAL_API_VERSION
value: ${trialParameters.trialAPIVersion}
- name: TRIAL_LABEL_CUSTOM
value: ${trialParameters.trialLabelCustom}
- name: TRIAL_ANNOTATION_CUSTOM
value: ${trialParameters.trialAnnotationCustom}
restartPolicy: Never