@@ -63,30 +63,23 @@ type Arg struct {
63
63
Value string `json:"value,omitempty"`
64
64
}
65
65
66
- type EnvSecret struct {
67
- // Environment's name
68
- Env string `json:"env"`
69
- // The secret is from a secret object
66
+ type Card struct {
67
+ // Unitxt card's ID
70
68
// +optional
71
- SecretRef * corev1.SecretKeySelector `json:"secretRef,omitempty"`
72
- // The secret is from a plain text
69
+ Name string `json:"name,omitempty"`
70
+ // A JSON string for a custom unitxt card which contains the custom dataset.
71
+ // Use the documentation here: https://www.unitxt.ai/en/latest/docs/adding_dataset.html#adding-to-the-catalog
72
+ // to compose a custom card, store it as a JSON file, and use the JSON content as the value here.
73
73
// +optional
74
- Secret * string `json:"secret,omitempty"`
75
- }
76
-
77
- type FileSecret struct {
78
- // The secret object
79
- SecretRef corev1.SecretVolumeSource `json:"secretRef,omitempty"`
80
- // The path to mount the secret
81
- MountPath string `json:"mountPath"`
74
+ Custom string `json:"custom,omitempty"`
82
75
}
83
76
84
77
// Use a task recipe to form a custom task. It maps to the Unitxt Recipe
85
78
// Find details of the Unitxt Recipe here:
86
79
// https://www.unitxt.ai/en/latest/unitxt.standard.html#unitxt.standard.StandardRecipe
87
80
type TaskRecipe struct {
88
81
// The Unitxt dataset card
89
- Card string `json:"card"`
82
+ Card Card `json:"card"`
90
83
// The Unitxt template
91
84
Template string `json:"template"`
92
85
// The Unitxt Task
@@ -118,7 +111,7 @@ type TaskList struct {
118
111
119
112
func (t * TaskRecipe ) String () string {
120
113
var b strings.Builder
121
- b .WriteString (fmt .Sprintf ("card=%s,template=%s" , t .Card , t .Template ))
114
+ b .WriteString (fmt .Sprintf ("card=%s,template=%s" , t .Card . Name , t .Template ))
122
115
if t .Task != nil {
123
116
b .WriteString (fmt .Sprintf (",task=%s" , * t .Task ))
124
117
}
@@ -140,6 +133,76 @@ func (t *TaskRecipe) String() string {
140
133
return b .String ()
141
134
}
142
135
136
+ type LMEvalContainer struct {
137
+ // Define Env information for the main container
138
+ // +optional
139
+ Env []corev1.EnvVar `json:"env,omitempty"`
140
+ // Define the volume mount information
141
+ // +optional
142
+ VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
143
+ // Compute Resources required by this container.
144
+ // More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
145
+ // +optional
146
+ Resources * corev1.ResourceRequirements `json:"resources,omitempty"`
147
+ }
148
+
149
+ // The following Getter-ish functions avoid nil pointer panic
150
+ func (c * LMEvalContainer ) GetEnv () []corev1.EnvVar {
151
+ if c == nil {
152
+ return nil
153
+ }
154
+ return c .Env
155
+ }
156
+
157
+ func (c * LMEvalContainer ) GetVolumMounts () []corev1.VolumeMount {
158
+ if c == nil {
159
+ return nil
160
+ }
161
+ return c .VolumeMounts
162
+ }
163
+
164
+ func (c * LMEvalContainer ) GetResources () * corev1.ResourceRequirements {
165
+ if c == nil {
166
+ return nil
167
+ }
168
+ return c .Resources
169
+ }
170
+
171
+ type LMEvalPodSpec struct {
172
+ // Extra container data for the lm-eval container
173
+ // +optional
174
+ Container * LMEvalContainer `json:"container,omitempty"`
175
+ // Specify the volumes information for the lm-eval and sidecar containers
176
+ // +optional
177
+ Volumes []corev1.Volume `json:"volumes,omitempty"`
178
+ // Specify extra containers for the lm-eval job
179
+ // FIXME: aggregate the sidecar containers into the pod
180
+ // +optional
181
+ SideCars []corev1.Container `json:"sideCars,omitempty"`
182
+ }
183
+
184
+ // The following Getter-ish functions avoid nil pointer panic
185
+ func (p * LMEvalPodSpec ) GetContainer () * LMEvalContainer {
186
+ if p == nil {
187
+ return nil
188
+ }
189
+ return p .Container
190
+ }
191
+
192
+ func (p * LMEvalPodSpec ) GetVolumes () []corev1.Volume {
193
+ if p == nil {
194
+ return nil
195
+ }
196
+ return p .Volumes
197
+ }
198
+
199
+ func (p * LMEvalPodSpec ) GetSideCards () []corev1.Container {
200
+ if p == nil {
201
+ return nil
202
+ }
203
+ return p .SideCars
204
+ }
205
+
143
206
// LMEvalJobSpec defines the desired state of LMEvalJob
144
207
type LMEvalJobSpec struct {
145
208
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
@@ -167,14 +230,12 @@ type LMEvalJobSpec struct {
167
230
// model, will be saved at per-document granularity
168
231
// +optional
169
232
LogSamples * bool `json:"logSamples,omitempty"`
170
- // Assign secrets to the environment variables
171
- // +optional
172
- EnvSecrets []EnvSecret `json:"envSecrets,omitempty"`
173
- // Use secrets as files
174
- FileSecrets []FileSecret `json:"fileSecrets,omitempty"`
175
233
// Batch size for the evaluation. This is used by the models that run and are loaded
176
234
// locally and not apply for the commercial APIs.
177
235
BatchSize * int `json:"batchSize,omitempty"`
236
+ // Specify extra information for the lm-eval job's pod
237
+ // +optional
238
+ Pod * LMEvalPodSpec `json:"pod,omitempty"`
178
239
}
179
240
180
241
// LMEvalJobStatus defines the observed state of LMEvalJob
0 commit comments