Skip to content

Commit 8f521ba

Browse files
committed
Move Qnn-Gpu recipes to QNN directory
1 parent e6bd75d commit 8f521ba

File tree

34 files changed

+294
-552
lines changed

34 files changed

+294
-552
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Bert-base-multilingual-cased Model Optimization
2+
3+
### QNN-GPU:
4+
5+
Running QNN-GPU configs requires features and fixes that are not available in the released Olive version 0.9.3.
6+
To ensure compatibility, please install Olive directly from the source at the required commit:
7+
8+
```bash
9+
pip install git+https://github.com/microsoft/Olive.git@da24463e14ed976503dc5871572b285bc5ddc4b2
10+
```
11+
12+
If you previously installed Olive via PyPI or pinned it to version 0.9.3, please uninstall it first and then use the above
13+
commit to install:
14+
15+
```bash
16+
pip uninstall olive-ai
17+
```
18+
19+
To run the config:
20+
21+
```bash
22+
olive run --config config_qnn_gpu.json
23+
```
24+
25+
✅ Optimized model saved in: `output/`
Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -46,50 +46,26 @@
4646
]
4747
}
4848
},
49-
"data_configs": [
50-
{
51-
"name": "quantization_data_config",
52-
"type": "HuggingfaceContainer",
53-
"load_dataset_config": {
54-
"data_name": "facebook/xnli",
55-
"subset": "en",
56-
"split": "validation"
57-
},
58-
"pre_process_data_config": {
59-
"input_cols": [
60-
"premise"
61-
],
62-
"padding": "max_length",
63-
"max_length": 128,
64-
"max_samples": 10
65-
},
66-
"dataloader_config": {
67-
"batch_size": 1
68-
}
49+
"passes": {
50+
"conversion": {
51+
"type": "OnnxConversion",
52+
"target_opset": 20,
53+
"save_as_external_data": false
6954
},
70-
{
71-
"name": "evaluation_data_config",
72-
"type": "HuggingfaceContainer",
73-
"load_dataset_config": {
74-
"data_name": "facebook/xnli",
75-
"subset": "en",
76-
"split": "validation"
77-
},
78-
"pre_process_data_config": {
79-
"input_cols": [
80-
"premise"
81-
],
82-
"padding": "max_length",
83-
"max_length": 128,
84-
"max_samples": 10
85-
},
86-
"dataloader_config": {
87-
"batch_size": 1
88-
}
55+
"surgery": {
56+
"type": "GraphSurgeries",
57+
"surgeries": [
58+
{
59+
"surgeon": "ReplaceAttentionMaskValue"
60+
},
61+
{
62+
"surgeon": "MatMulAddToGemm"
63+
}
64+
]
8965
}
90-
],
66+
},
9167
"target": "target_system",
9268
"cache_dir": "cache",
93-
"output_dir": "model/google_bert",
69+
"output_dir": "output",
9470
"evaluate_input_model": false
9571
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
keywords:
2+
QNN
3+
arch: bert
4+
recipes:
5+
- file: "config_qnn_gpu.json"
6+
device: gpu
7+
ep: QNNExecutionProvider

google-bert-bert-base-multilingual-cased/aitk/bert-base-multilingual-cased_qnn_gpu.json.config

Lines changed: 0 additions & 38 deletions
This file was deleted.

google-bert-bert-base-multilingual-cased/aitk/info.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ recipes:
2323
- file: "bert-base-multilingual-cased_migraphx.json"
2424
device: gpu
2525
ep: MIGraphXExecutionProvider
26-
- file: "bert-base-multilingual-cased_qnn_gpu.json"
27-
device: gpu
28-
ep: QNNExecutionProvider
2926
aitk:
3027
modelInfo:
3128
id: "huggingface/google-bert/bert-base-multilingual-cased"

google-vit-base-patch16-224/QNN/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,27 @@ You can test output model with provided scripts. It is also a example you can re
1616
```
1717
python .\val_tiny_imagenet.py
1818
```
19+
20+
### QNN-GPU:
21+
22+
Running QNN-GPU configs requires features and fixes that are not available in the released Olive version 0.9.3.
23+
To ensure compatibility, please install Olive directly from the source at the required commit:
24+
25+
```bash
26+
pip install git+https://github.com/microsoft/Olive.git@da24463e14ed976503dc5871572b285bc5ddc4b2
27+
```
28+
29+
If you previously installed Olive via PyPI or pinned it to version 0.9.3, please uninstall it first and then use the above
30+
commit to install:
31+
32+
```bash
33+
pip uninstall olive-ai
34+
```
35+
36+
To run the config:
37+
38+
```bash
39+
olive run --config vit_qnn_gpu.json
40+
```
41+
42+
✅ Optimized model saved in: `output/`

google-vit-base-patch16-224/QNN/info.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ recipes:
55
- file: "vit_qnn_fp32_ctx.json"
66
device: npu
77
ep: QNNExecutionProvider
8+
- file: "vit_qnn_gpu.json"
9+
device: gpu
10+
ep: QNNExecutionProvider
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"input_model": {
3+
"type": "HfModel",
4+
"model_path": "google/vit-base-patch16-224",
5+
"task": "image-classification",
6+
"io_config": {
7+
"input_names": [
8+
"pixel_values"
9+
],
10+
"input_shapes": [
11+
[
12+
1,
13+
3,
14+
224,
15+
224
16+
]
17+
],
18+
"output_names": [
19+
"logits"
20+
]
21+
}
22+
},
23+
"systems": {
24+
"target_system": {
25+
"type": "LocalSystem",
26+
"accelerators": [
27+
{
28+
"device": "gpu",
29+
"execution_providers": [
30+
"QNNExecutionProvider"
31+
]
32+
}
33+
]
34+
}
35+
},
36+
"passes": {
37+
"conversion": {
38+
"type": "OnnxConversion",
39+
"target_opset": 20,
40+
"save_as_external_data": false
41+
},
42+
"surgery": {
43+
"type": "GraphSurgeries",
44+
"surgeries": [
45+
{
46+
"surgeon": "MatMulAddToGemm"
47+
}
48+
]
49+
}
50+
},
51+
"target": "target_system",
52+
"output_dir": "output",
53+
"evaluate_input_model": false,
54+
"cache_dir": "cache"
55+
}

google-vit-base-patch16-224/aitk/info.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ recipes:
2323
- file: "vit-base-patch16-224_migraphx.json"
2424
device: gpu
2525
ep: MIGraphXExecutionProvider
26-
- file: "vit-base-patch16-224_qnn_gpu.json"
27-
device: gpu
28-
ep: QNNExecutionProvider
2926
aitk:
3027
modelInfo:
3128
id: "huggingface/google/vit-base-patch16-224"

google-vit-base-patch16-224/aitk/vit-base-patch16-224_qnn_gpu.json

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)