Skip to content

Commit 592e78c

Browse files
committed
[ML] Run PyTorch allowlist validation as a dedicated Buildkite step
The Linux build/test Docker images don't include Python 3 (it's only used during image builds to compile PyTorch, then dropped in the multi-stage final image). Move the validation to a dedicated pipeline step using a python:3 agent image, triggered only for run_pytorch_tests builds. Made-with: Cursor
1 parent ba5b141 commit 592e78c

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

.buildkite/pipeline.json.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ def main():
8484
".buildkite/pipelines/check_build_regression.yml.sh",
8585
soft_fail=True))
8686

87+
# Validate the PyTorch allowlist against HuggingFace models when
88+
# triggered from the PyTorch edge pipeline. Runs in a python:3
89+
# container since the build/test images don't include Python.
90+
if config.run_pytorch_tests:
91+
pipeline_steps.append(pipeline_steps.generate_step("Upload PyTorch allowlist validation",
92+
".buildkite/pipelines/validate_pytorch_allowlist.yml.sh",
93+
soft_fail=True))
94+
8795
pipeline["env"] = env
8896
pipeline["steps"] = pipeline_steps
8997
print(json.dumps(pipeline, indent=2))
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
# or more contributor license agreements. Licensed under the Elastic License
4+
# 2.0 and the following additional limitation. Functionality enabled by the
5+
# files subject to the Elastic License 2.0 may only be used in production when
6+
# invoked by an Elasticsearch process with a license key installed that permits
7+
# use of machine learning features. You may not use this file except in
8+
# compliance with the Elastic License 2.0 and the foregoing additional
9+
# limitation.
10+
11+
cat <<'EOL'
12+
steps:
13+
- label: "Validate PyTorch allowlist :torch:"
14+
key: "validate_pytorch_allowlist"
15+
command:
16+
- "pip install -q -r dev-tools/extract_model_ops/requirements.txt"
17+
- "python3 dev-tools/extract_model_ops/validate_allowlist.py --config dev-tools/extract_model_ops/validation_models.json --pt-dir dev-tools/extract_model_ops/es_it_models --verbose"
18+
EOL
19+
20+
# Depend on the build steps so validation doesn't start before the
21+
# pipeline is fully generated.
22+
if [ -n "${ML_BUILD_STEP_KEYS:-}" ]; then
23+
echo ' depends_on:'
24+
IFS=',' read -ra STEP_KEYS <<< "$ML_BUILD_STEP_KEYS"
25+
for key in "${STEP_KEYS[@]}"; do
26+
echo " - \"${key}\""
27+
done
28+
fi
29+
30+
cat <<'EOL'
31+
allow_dependency_failure: true
32+
soft_fail: true
33+
agents:
34+
image: "python:3"
35+
EOL

0 commit comments

Comments
 (0)