Skip to content

Commit 9a65396

Browse files
committed
Merge branch 'bhamehta/track-actions' of github.com:bmehta001/Olive into bhamehta/track-actions
2 parents 3c766e6 + 5247147 commit 9a65396

25 files changed

+241
-43
lines changed

.azure_pipelines/job_templates/olive-test-cpu-template.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ parameters:
77
onnxruntime_nightly: false
88
torch: 'torch'
99
requirements_file: 'requirements-test-cpu.txt'
10+
pytest_marker: ''
11+
test_path: 'test'
1012

1113
jobs:
1214
- job: ${{parameters.name}}
@@ -17,6 +19,8 @@ jobs:
1719
WINDOWS: ${{ parameters.windows}}
1820
python_version: ${{ parameters.python_version }}
1921
requirements_file: ${{ parameters.requirements_file }}
22+
pytest_marker: ${{ parameters.pytest_marker }}
23+
test_path: ${{ parameters.test_path }}
2024
PIP_CACHE_DIR: $(Pipeline.Workspace)/.cache/pip
2125
HF_HOME: $(Pipeline.Workspace)/.cache/huggingface
2226
PYTEST_BASETEMP: $(Pipeline.Workspace)/.pytest_basetemp
@@ -39,7 +43,7 @@ jobs:
3943
python -m pip install pytest
4044
python -m pip install -r $(Build.SourcesDirectory)/test/$(requirements_file)
4145
python -m pip list
42-
coverage run --source=$(Build.SourcesDirectory)/olive -m pytest -v -s -p no:warnings --disable-warnings --log-cli-level=WARNING --junitxml=$(Build.SourcesDirectory)/logs/test-TestOlive.xml $(Build.SourcesDirectory)/test --basetemp $(PYTEST_BASETEMP)
46+
coverage run --source=$(Build.SourcesDirectory)/olive -m pytest -v -s -p no:warnings --disable-warnings --log-cli-level=WARNING --junitxml=$(Build.SourcesDirectory)/logs/test-TestOlive.xml -m "$(pytest_marker)" $(Build.SourcesDirectory)/$(test_path) --basetemp $(PYTEST_BASETEMP)
4347
coverage xml
4448
displayName: Test Olive
4549

.azure_pipelines/job_templates/olive-test-linux-gpu-template.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ parameters:
1313
requirements_file: 'requirements-test-gpu.txt'
1414
test_script: 'run_test.sh'
1515
onnxruntime_nightly: false
16+
pytest_marker: ''
17+
test_path: 'test'
1618

1719
jobs:
1820
- job: ${{parameters.name}}
@@ -68,9 +70,10 @@ jobs:
6870
${{ parameters.onnxruntime }} \
6971
${{ parameters.onnxruntime_nightly }} \
7072
test/${{ parameters.requirements_file }} \
71-
test \
73+
${{ parameters.test_path }} \
7274
false \
73-
$(hf_token)
75+
$(hf_token) \
76+
"${{ parameters.pytest_marker }}"
7477
displayName: Run Tests in Docker
7578
7679
- task: CredScan@3

.azure_pipelines/olive-ci-amd.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
trigger:
2+
branches:
3+
include:
4+
- main
5+
paths:
6+
include:
7+
- olive/passes/quark_quantizer/*
8+
- test/passes/quark_quantizer/*
9+
10+
pr:
11+
branches:
12+
include:
13+
- main
14+
paths:
15+
include:
16+
- olive/passes/quark_quantizer/*
17+
- test/passes/quark_quantizer/*
18+
19+
variables:
20+
runCodesignValidationInjection: false
21+
skipComponentGovernanceDetection: true
22+
23+
jobs:
24+
# Linux AMD unit tests
25+
- template: job_templates/olive-test-cpu-template.yaml
26+
parameters:
27+
name: Linux_CPU_AMD_Unit_Test
28+
pool: $(OLIVE_POOL_UBUNTU2004)
29+
pytest_marker: 'amd'
30+
requirements_file: 'requirements-test-amd.txt'
31+
test_path: 'test/passes/quark_quantizer'
32+
33+
- template: job_templates/olive-test-linux-gpu-template.yaml
34+
parameters:
35+
name: Linux_GPU_AMD_Unit_Test
36+
pool: $(OLIVE_POOL_UBUNTU2004_GPU_V100)
37+
pytest_marker: 'amd'
38+
requirements_file: 'requirements-test-amd.txt'
39+
test_path: 'test/passes/quark_quantizer'
40+
41+
# Windows OpenVINO unit tests
42+
- template: job_templates/olive-test-cpu-template.yaml
43+
parameters:
44+
name: Windows_CPU_AMD_Unit_Test
45+
pool: $(OLIVE_POOL_WIN2019)
46+
windows: True
47+
pytest_marker: 'amd'
48+
requirements_file: 'requirements-test-amd.txt'
49+
test_path: 'test/passes/quark_quantizer'
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
trigger:
2+
branches:
3+
include:
4+
- main
5+
paths:
6+
include:
7+
- olive/passes/openvino/*
8+
- test/passes/openvino/*
9+
10+
pr:
11+
branches:
12+
include:
13+
- main
14+
paths:
15+
include:
16+
- olive/passes/openvino/*
17+
- test/passes/openvino/*
18+
19+
variables:
20+
runCodesignValidationInjection: false
21+
skipComponentGovernanceDetection: true
22+
23+
jobs:
24+
# Linux OpenVINO unit tests
25+
- template: job_templates/olive-test-cpu-template.yaml
26+
parameters:
27+
name: Linux_CPU_OpenVINO_Unit_Test
28+
pool: $(OLIVE_POOL_UBUNTU2004)
29+
pytest_marker: 'openvino'
30+
requirements_file: 'requirements-test-openvino.txt'
31+
test_path: 'test/passes/openvino'
32+
33+
- template: job_templates/olive-test-linux-gpu-template.yaml
34+
parameters:
35+
name: Linux_GPU_OpenVINO_Unit_Test
36+
pool: $(OLIVE_POOL_UBUNTU2004_GPU_V100)
37+
pytest_marker: 'openvino'
38+
requirements_file: 'requirements-test-openvino.txt'
39+
test_path: 'test/passes/openvino'
40+
41+
# Windows OpenVINO unit tests
42+
- template: job_templates/olive-test-cpu-template.yaml
43+
parameters:
44+
name: Windows_CPU_OpenVINO_Unit_Test
45+
pool: $(OLIVE_POOL_WIN2019)
46+
windows: True
47+
pytest_marker: 'openvino'
48+
requirements_file: 'requirements-test-openvino.txt'
49+
test_path: 'test/passes/openvino'

.azure_pipelines/olive-ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ jobs:
3232
parameters:
3333
name: Linux_CPU_CI_Unit_Test
3434
pool: $(OLIVE_POOL_UBUNTU2004)
35+
pytest_marker: 'not openvino and not amd'
3536

3637
- template: job_templates/olive-test-linux-gpu-template.yaml
3738
parameters:
3839
name: Linux_GPU_CI_Unit_Test
3940
pool: $(OLIVE_POOL_UBUNTU2004_GPU_V100)
41+
pytest_marker: 'not openvino and not amd'
4042

4143
# Windows unit tests
4244
- template: job_templates/olive-test-cpu-template.yaml
4345
parameters:
4446
name: Windows_CPU_CI_Unit_Test
4547
pool: $(OLIVE_POOL_WIN2019)
4648
windows: True
49+
pytest_marker: 'not openvino and not amd'

.azure_pipelines/olive-ort-nightly.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
pool: $(OLIVE_POOL_UBUNTU2004)
2222
windows: False
2323
onnxruntime_nightly: true
24+
pytest_marker: 'not openvino'
2425

2526
# Linux GPU unit test
2627
- template: job_templates/olive-test-linux-gpu-template.yaml
@@ -29,6 +30,7 @@ jobs:
2930
pool: $(OLIVE_POOL_UBUNTU2004_GPU_V100)
3031
windows: False
3132
onnxruntime_nightly: true
33+
pytest_marker: 'not openvino'
3234

3335
# Windows unit test
3436
- template: job_templates/olive-test-cpu-template.yaml
@@ -37,3 +39,4 @@ jobs:
3739
pool: $(OLIVE_POOL_WIN2019)
3840
windows: True
3941
onnxruntime_nightly: true
42+
pytest_marker: 'not openvino'

.azure_pipelines/scripts/run_test.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
# $5: Path to the test file to run
88
# $6: Whether to use coverage tracking (true/false)
99
# $7: HF Token
10+
# $8: Pytest marker (optional, e.g., "not openvino")
1011

1112
# activate venv
1213
source olive-venv/bin/activate
1314

15+
# Upgrade pip to avoid dependency resolution bugs
16+
pip install --upgrade pip
17+
1418
# Step 1: Install PyTorch
1519
pip install "$1"
1620

@@ -37,14 +41,19 @@ pip list
3741

3842
# Step 4: Run tests with or without coverage tracking
3943
XML_PATH="/logs/TestOlive.xml"
44+
PYTEST_MARKER_ARGS=()
45+
if [ -n "$8" ]; then
46+
PYTEST_MARKER_ARGS=(-m "$8")
47+
fi
48+
4049
if [ "$6" = "true" ]; then
4150
echo "Running tests with coverage tracking..."
42-
coverage run -m pytest -vv -s --junitxml="$XML_PATH" -p no:warnings --disable-warnings --log-cli-level=WARNING "$5"
51+
coverage run -m pytest -vv -s --junitxml="$XML_PATH" -p no:warnings --disable-warnings --log-cli-level=WARNING "${PYTEST_MARKER_ARGS[@]}" "$5"
4352
coverage xml -o /logs/coverage.xml
4453
else
4554
echo "Starting pytest at $(date)"
4655
echo "Running tests without coverage tracking..."
47-
timeout 1100 python -m pytest -vv -s --junitxml="$XML_PATH" -p no:warnings --disable-warnings --log-cli-level=WARNING "$5"
56+
timeout 1100 python -m pytest -vv -s --junitxml="$XML_PATH" -p no:warnings --disable-warnings --log-cli-level=WARNING "${PYTEST_MARKER_ARGS[@]}" "$5"
4857
exit_code=$?
4958
echo "pytest exited with code $exit_code"
5059

olive/cli/benchmark.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def _get_run_config(self, tempdir: str) -> dict:
8585
assert input_model_config["type"].lower() in {
8686
"hfmodel",
8787
"pytorchmodel",
88-
}, "Only HfModel and PyTorchModel are supported in benchmark command."
88+
"onnxmodel",
89+
}, "Only HfModel, PyTorchModel and OnnxModel are supported in benchmark command."
8990

9091
to_replace = [
9192
("input_model", input_model_config),

olive/passes/onnx/model_builder.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from olive.passes import Pass
2626
from olive.passes.olive_pass import PassConfigParam
2727
from olive.passes.pass_config import BasePassConfig
28+
from olive.search.search_parameter import Boolean, Categorical
2829

2930
logger = logging.getLogger(__name__)
3031

@@ -83,11 +84,15 @@ def _default_config(cls, accelerator_spec: AcceleratorSpec) -> dict[str, PassCon
8384
"int4_block_size": PassConfigParam(
8485
type_=ModelBuilder.BlockSize,
8586
required=False,
87+
search_defaults=Categorical(
88+
[ModelBuilder.BlockSize.B32, ModelBuilder.BlockSize.B64, ModelBuilder.BlockSize.B128]
89+
),
8690
description="Specify the block_size for int4 quantization. Acceptable values: 16/32/64/128/256.",
8791
),
8892
"int4_is_symmetric": PassConfigParam(
8993
type_=bool,
9094
required=False,
95+
search_defaults=Boolean(),
9196
description="Specify whether symmetric or asymmetric INT4 quantization needs to be used.",
9297
),
9398
"int4_op_types_to_quantize": PassConfigParam(
@@ -106,6 +111,14 @@ def _default_config(cls, accelerator_spec: AcceleratorSpec) -> dict[str, PassCon
106111
"int4_algo_config": PassConfigParam(
107112
type_=str,
108113
required=False,
114+
search_defaults=Categorical(
115+
[
116+
"default",
117+
"rtn",
118+
"k_quant_mixed",
119+
"k_quant_last",
120+
]
121+
),
109122
description="Specify the INT4 quantization algorithm to use in GenAI Model Builder",
110123
),
111124
"use_qdq": PassConfigParam(

olive/passes/pytorch/selective_mixed_precision.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from olive.passes import Pass
2121
from olive.passes.pass_config import BasePassConfig, PassConfigParam
2222
from olive.passes.pytorch.train_utils import get_calibration_dataset, kl_div_loss, load_hf_base_model
23+
from olive.search.search_parameter import Categorical
2324

2425
if TYPE_CHECKING:
2526
from olive.hardware.accelerator import AcceleratorSpec
@@ -65,7 +66,14 @@ def _default_config(cls, accelerator_spec: AcceleratorSpec) -> dict[str, PassCon
6566
return {
6667
"algorithm": PassConfigParam(
6768
type_=SelectiveMixedPrecision.Algorithm,
68-
required=True,
69+
required=False,
70+
search_defaults=Categorical(
71+
[
72+
SelectiveMixedPrecision.Algorithm.K_QUANT_DOWN,
73+
SelectiveMixedPrecision.Algorithm.K_QUANT_MIXED,
74+
SelectiveMixedPrecision.Algorithm.K_QUANT_LAST,
75+
]
76+
),
6977
description="The algorithm to use for mixed precision.",
7078
),
7179
"bits": PassConfigParam(

0 commit comments

Comments
 (0)