Skip to content

Commit 22bf27e

Browse files
add components to output artifacts from final eval
Signed-off-by: Michael Clifford <mcliffor@redhat.com>
1 parent 31086d0 commit 22bf27e

File tree

6 files changed

+143
-11
lines changed

6 files changed

+143
-11
lines changed

eval/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .final import run_final_eval_op, generate_metrics_report_op
1+
from .final import generate_metrics_report_op, run_final_eval_op
22
from .mt_bench import run_mt_bench_op
33

44
__all__ = ["run_final_eval_op", "run_mt_bench_op", "generate_metrics_report_op"]

eval/final.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# type: ignore
22
# pylint: disable=import-outside-toplevel,import-error
33

4-
from kfp.dsl import Artifact, Input, Metrics, Output, component
4+
from kfp.dsl import Metrics, Output, component
55

66
from utils.consts import PYTHON_IMAGE, RHELAI_IMAGE
77

pipeline.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use_secret_as_volume,
1818
)
1919

20-
from eval import run_final_eval_op, run_mt_bench_op, generate_metrics_report_op
20+
from eval import generate_metrics_report_op, run_final_eval_op, run_mt_bench_op
2121
from sdg import (
2222
git_clone_op,
2323
sdg_op,
@@ -33,7 +33,9 @@
3333
from utils import (
3434
ilab_importer_op,
3535
model_to_pvc_op,
36+
pvc_to_mmlu_branch_op,
3637
pvc_to_model_op,
38+
pvc_to_mt_bench_branch_op,
3739
pvc_to_mt_bench_op,
3840
)
3941
from utils.consts import RHELAI_IMAGE
@@ -58,13 +60,11 @@
5860
JUDGE_CA_CERT_PATH = "/tmp/cert"
5961

6062

61-
6263
@dsl.pipeline(
6364
display_name="InstructLab",
6465
name="instructlab",
6566
description="InstructLab pipeline",
6667
)
67-
6868
def ilab_pipeline(
6969
# SDG phase
7070
sdg_repo_url: str = "https://github.com/instructlab/taxonomy.git",
@@ -426,27 +426,54 @@ def ilab_pipeline(
426426
mount_path="/output",
427427
)
428428

429+
output_mt_bench_branch_task = pvc_to_mt_bench_branch_op(
430+
pvc_path="/output/mt_bench_branch/mt_bench_branch_data.json",
431+
)
432+
output_mt_bench_branch_task.after(final_eval_task)
433+
output_mt_bench_branch_task.set_caching_options(False)
434+
435+
mount_pvc(
436+
task=output_mt_bench_branch_task,
437+
pvc_name=output_pvc_task.output,
438+
mount_path="/output",
439+
)
440+
441+
output_mmlu_branch_task = pvc_to_mmlu_branch_op(
442+
pvc_path="/output/mmlu_branch/mmlu_branch_data.json",
443+
)
444+
output_mmlu_branch_task.after(final_eval_task)
445+
output_mmlu_branch_task.set_caching_options(False)
446+
447+
mount_pvc(
448+
task=output_mmlu_branch_task,
449+
pvc_name=output_pvc_task.output,
450+
mount_path="/output",
451+
)
452+
429453
sdg_pvc_delete_task = DeletePVC(pvc_name=sdg_input_pvc_task.output)
430454
sdg_pvc_delete_task.after(final_eval_task)
431455

432456
model_pvc_delete_task = DeletePVC(pvc_name=model_pvc_task.output)
433457
model_pvc_delete_task.after(final_eval_task)
434458

435459
generate_metrics_report_task = generate_metrics_report_op()
436-
generate_metrics_report_task.after(output_mt_bench_task, final_eval_task)
460+
generate_metrics_report_task.after(final_eval_task)
437461
generate_metrics_report_task.set_caching_options(False)
438462
mount_pvc(
439463
task=generate_metrics_report_task,
440464
pvc_name=output_pvc_task.output,
441465
mount_path="/output",
442466
)
443-
467+
444468
output_pvc_delete_task = DeletePVC(pvc_name=output_pvc_task.output)
445469
output_pvc_delete_task.after(
446470
output_model_task,
447-
output_mt_bench_task, final_eval_task
471+
output_mt_bench_task,
472+
output_mmlu_branch_task,
473+
output_mt_bench_branch_task,
474+
generate_metrics_report_task,
448475
)
449-
476+
450477
return
451478

452479

pipeline.yaml

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,18 @@ components:
329329
defaultValue: /model
330330
isOptional: true
331331
parameterType: STRING
332+
comp-pvc-to-mmlu-branch-op:
333+
executorLabel: exec-pvc-to-mmlu-branch-op
334+
inputDefinitions:
335+
parameters:
336+
pvc_path:
337+
parameterType: STRING
338+
outputDefinitions:
339+
artifacts:
340+
mmlu_branch_output:
341+
artifactType:
342+
schemaTitle: system.Artifact
343+
schemaVersion: 0.0.1
332344
comp-pvc-to-model-op:
333345
executorLabel: exec-pvc-to-model-op
334346
inputDefinitions:
@@ -341,6 +353,18 @@ components:
341353
artifactType:
342354
schemaTitle: system.Model
343355
schemaVersion: 0.0.1
356+
comp-pvc-to-mt-bench-branch-op:
357+
executorLabel: exec-pvc-to-mt-bench-branch-op
358+
inputDefinitions:
359+
parameters:
360+
pvc_path:
361+
parameterType: STRING
362+
outputDefinitions:
363+
artifacts:
364+
mt_bench_branch_output:
365+
artifactType:
366+
schemaTitle: system.Artifact
367+
schemaVersion: 0.0.1
344368
comp-pvc-to-mt-bench-op:
345369
executorLabel: exec-pvc-to-mt-bench-op
346370
inputDefinitions:
@@ -765,6 +789,14 @@ deploymentSpec:
765789
- /bin/sh
766790
- -c
767791
image: registry.redhat.io/ubi9/toolbox@sha256:da31dee8904a535d12689346e65e5b00d11a6179abf1fa69b548dbd755fa2770
792+
exec-pvc-to-mmlu-branch-op:
793+
container:
794+
args:
795+
- cp -r {{$.inputs.parameters['pvc_path']}} {{$.outputs.artifacts['mmlu_branch_output'].path}}
796+
command:
797+
- /bin/sh
798+
- -c
799+
image: registry.redhat.io/ubi9/toolbox@sha256:da31dee8904a535d12689346e65e5b00d11a6179abf1fa69b548dbd755fa2770
768800
exec-pvc-to-model-op:
769801
container:
770802
args:
@@ -773,6 +805,14 @@ deploymentSpec:
773805
- /bin/sh
774806
- -c
775807
image: registry.redhat.io/ubi9/toolbox@sha256:da31dee8904a535d12689346e65e5b00d11a6179abf1fa69b548dbd755fa2770
808+
exec-pvc-to-mt-bench-branch-op:
809+
container:
810+
args:
811+
- cp -r {{$.inputs.parameters['pvc_path']}} {{$.outputs.artifacts['mt_bench_branch_output'].path}}
812+
command:
813+
- /bin/sh
814+
- -c
815+
image: registry.redhat.io/ubi9/toolbox@sha256:da31dee8904a535d12689346e65e5b00d11a6179abf1fa69b548dbd755fa2770
776816
exec-pvc-to-mt-bench-op:
777817
container:
778818
args:
@@ -1700,9 +1740,11 @@ root:
17001740
name: comp-deletepvc-3
17011741
dependentTasks:
17021742
- createpvc-3
1743+
- generate-metrics-report-op
1744+
- pvc-to-mmlu-branch-op
17031745
- pvc-to-model-op
1746+
- pvc-to-mt-bench-branch-op
17041747
- pvc-to-mt-bench-op
1705-
- run-final-eval-op
17061748
inputs:
17071749
parameters:
17081750
pvc_name:
@@ -1717,7 +1759,6 @@ root:
17171759
name: comp-generate-metrics-report-op
17181760
dependentTasks:
17191761
- createpvc-3
1720-
- pvc-to-mt-bench-op
17211762
- run-final-eval-op
17221763
taskInfo:
17231764
name: generate-metrics-report-op
@@ -1772,6 +1813,20 @@ root:
17721813
producerTask: importer
17731814
taskInfo:
17741815
name: model-to-pvc-op
1816+
pvc-to-mmlu-branch-op:
1817+
cachingOptions: {}
1818+
componentRef:
1819+
name: comp-pvc-to-mmlu-branch-op
1820+
dependentTasks:
1821+
- createpvc-3
1822+
- run-final-eval-op
1823+
inputs:
1824+
parameters:
1825+
pvc_path:
1826+
runtimeValue:
1827+
constant: /output/mmlu_branch/mmlu_branch_data.json
1828+
taskInfo:
1829+
name: pvc-to-mmlu-branch-op
17751830
pvc-to-model-op:
17761831
cachingOptions: {}
17771832
componentRef:
@@ -1786,6 +1841,20 @@ root:
17861841
constant: /output/phase_2/model/hf_format/candidate_model
17871842
taskInfo:
17881843
name: pvc-to-model-op
1844+
pvc-to-mt-bench-branch-op:
1845+
cachingOptions: {}
1846+
componentRef:
1847+
name: comp-pvc-to-mt-bench-branch-op
1848+
dependentTasks:
1849+
- createpvc-3
1850+
- run-final-eval-op
1851+
inputs:
1852+
parameters:
1853+
pvc_path:
1854+
runtimeValue:
1855+
constant: /output/mt_bench_branch/mt_bench_branch_data.json
1856+
taskInfo:
1857+
name: pvc-to-mt-bench-branch-op
17891858
pvc-to-mt-bench-op:
17901859
cachingOptions: {}
17911860
componentRef:
@@ -2226,12 +2295,24 @@ platforms:
22262295
taskOutputParameter:
22272296
outputParameterKey: name
22282297
producerTask: createpvc-2
2298+
exec-pvc-to-mmlu-branch-op:
2299+
pvcMount:
2300+
- mountPath: /output
2301+
taskOutputParameter:
2302+
outputParameterKey: name
2303+
producerTask: createpvc-3
22292304
exec-pvc-to-model-op:
22302305
pvcMount:
22312306
- mountPath: /output
22322307
taskOutputParameter:
22332308
outputParameterKey: name
22342309
producerTask: createpvc-3
2310+
exec-pvc-to-mt-bench-branch-op:
2311+
pvcMount:
2312+
- mountPath: /output
2313+
taskOutputParameter:
2314+
outputParameterKey: name
2315+
producerTask: createpvc-3
22352316
exec-pvc-to-mt-bench-op:
22362317
pvcMount:
22372318
- mountPath: /output

utils/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
from .components import (
22
ilab_importer_op,
33
model_to_pvc_op,
4+
pvc_to_mmlu_branch_op,
45
pvc_to_model_op,
6+
pvc_to_mt_bench_branch_op,
57
pvc_to_mt_bench_op,
68
)
79

810
__all__ = [
911
"model_to_pvc_op",
1012
"pvc_to_mt_bench_op",
13+
"pvc_to_mt_bench_branch_op",
14+
"pvc_to_mmlu_branch_op",
1115
"pvc_to_model_op",
1216
"ilab_importer_op",
1317
]

utils/components.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ def pvc_to_mt_bench_op(mt_bench_output: dsl.Output[dsl.Artifact], pvc_path: str)
1414
)
1515

1616

17+
@dsl.container_component
18+
def pvc_to_mt_bench_branch_op(
19+
mt_bench_branch_output: dsl.Output[dsl.Artifact], pvc_path: str
20+
):
21+
return dsl.ContainerSpec(
22+
TOOLBOX_IMAGE,
23+
["/bin/sh", "-c"],
24+
[f"cp -r {pvc_path} {mt_bench_branch_output.path}"],
25+
)
26+
27+
28+
@dsl.container_component
29+
def pvc_to_mmlu_branch_op(mmlu_branch_output: dsl.Output[dsl.Artifact], pvc_path: str):
30+
return dsl.ContainerSpec(
31+
TOOLBOX_IMAGE,
32+
["/bin/sh", "-c"],
33+
[f"cp -r {pvc_path} {mmlu_branch_output.path}"],
34+
)
35+
36+
1737
@dsl.container_component
1838
def pvc_to_model_op(model: dsl.Output[dsl.Model], pvc_path: str):
1939
return dsl.ContainerSpec(

0 commit comments

Comments
 (0)