Skip to content

Commit 45a61d8

Browse files
committed
[WIP] QNN GPU Procyon recipes
1 parent 5b2312c commit 45a61d8

9 files changed

Lines changed: 572 additions & 7 deletions

File tree

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": "Salesforce/blip-image-captioning-base",
5+
"task": "image-text-to-text",
6+
"load_kwargs": {
7+
"output_attentions": true
8+
},
9+
"io_config": {
10+
"input_names": [
11+
"pixel_values",
12+
"input_ids",
13+
"attention_mask"
14+
],
15+
"input_shapes": [
16+
[ 1, 3, 384, 384 ],
17+
[ 1, 31 ],
18+
[ 1, 31 ]
19+
],
20+
"input_types": [
21+
"float32",
22+
"int64",
23+
"int64"
24+
],
25+
"output_names": [ "logits", "encoder_hidden_states" ]
26+
}
27+
},
28+
"systems": {
29+
"target_system": {
30+
"type": "LocalSystem",
31+
"accelerators": [ { "device": "gpu", "execution_providers": [ "QNNExecutionProvider" ] } ]
32+
}
33+
},
34+
"passes": {
35+
"cs": {
36+
"type": "CaptureSplitInfo",
37+
"block_to_split": [ "vision_model", "text_decoder" ],
38+
"num_splits": 2
39+
},
40+
"conversion": { "device": "cpu", "type": "OnnxConversion", "target_opset": 20 },
41+
"add_metadata": { "type": "AddOliveMetadata", "graph_name": "main_graph" },
42+
"surgery": {
43+
"type": "GraphSurgeries",
44+
"surgeries": [ { "surgeon": "MatMulAddToGemm" } ]
45+
},
46+
"sp": { "type": "SplitModel" }
47+
},
48+
"host": "target_system",
49+
"target": "target_system",
50+
"cache_dir": "cache",
51+
"output_dir": "output",
52+
"evaluate_input_model": false,
53+
"clean_cache": true
54+
}
55+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"input_model": {
3+
"type": "HfModel",
4+
"model_path": "caidas/swin2SR-realworld-sr-x4-64-bsrgan-psnr",
5+
"task": "image-to-image",
6+
"io_config": {
7+
"input_names": [ "pixel_values" ],
8+
"input_shapes": [ [ 1, 3, 232, 232 ] ],
9+
"output_names": [ "output" ]
10+
}
11+
},
12+
"systems": {
13+
"target_system": {
14+
"type": "LocalSystem",
15+
"accelerators": [ { "device": "gpu", "execution_providers": [ "QNNExecutionProvider" ] } ]
16+
}
17+
},
18+
"passes": {
19+
"conversion": { "device": "cpu", "type": "OnnxConversion", "target_opset": 20 },
20+
"add_metadata": { "type": "AddOliveMetadata", "graph_name": "main_graph" }
21+
},
22+
"host": "target_system",
23+
"target": "target_system",
24+
"cache_dir": "cache",
25+
"output_dir": "output",
26+
"evaluate_input_model": false,
27+
"clean_cache": true
28+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"input_model": {
3+
"type": "HfModel",
4+
"model_path": "facebook/convnext-tiny-224",
5+
"task": "image-classification",
6+
"io_config": {
7+
"input_names": [ "pixel_values" ],
8+
"input_shapes": [ [ 1, 3, 224, 224 ] ],
9+
"output_names": [ "logits" ]
10+
}
11+
},
12+
"systems": {
13+
"target_system": {
14+
"type": "LocalSystem",
15+
"accelerators": [ { "device": "gpu", "execution_providers": [ "QNNExecutionProvider" ] } ]
16+
}
17+
}, "data_configs": [
18+
{
19+
"name": "evaluate_data_config",
20+
"type": "HuggingfaceContainer",
21+
"user_script": "imagenet.py",
22+
"load_dataset_config": {
23+
"data_name": "imagenet-1k",
24+
"split": "validation",
25+
"streaming": true,
26+
"trust_remote_code": true
27+
},
28+
"pre_process_data_config": { "type": "dataset_pre_process", "size": 256, "cache_key": "imagenet" },
29+
"post_process_data_config": { "type": "imagenet_post_fun" }
30+
}
31+
],
32+
"evaluators": {
33+
"common_evaluator": {
34+
"metrics": [
35+
{
36+
"name": "accuracy_qnn",
37+
"type": "accuracy",
38+
"data_config": "evaluate_data_config",
39+
"sub_types": [
40+
{
41+
"name": "accuracy_score",
42+
"priority": 1,
43+
"metric_config": { "task": "multiclass", "num_classes": 1000 }
44+
}
45+
],
46+
"user_config": {
47+
"inference_settings": {
48+
"onnx": {
49+
"session_options": {
50+
"extra_session_config": { "session.disable_cpu_ep_fallback": "0" }
51+
},
52+
"execution_provider": "QNNExecutionProvider",
53+
"provider_options": [
54+
{
55+
"backend_path": "QnnGpu.dll"
56+
}
57+
]
58+
}
59+
}
60+
}
61+
},
62+
{
63+
"name": "accuracy_cpu",
64+
"type": "accuracy",
65+
"data_config": "evaluate_data_config",
66+
"sub_types": [
67+
{
68+
"name": "accuracy_score",
69+
"priority": 2,
70+
"metric_config": { "task": "multiclass", "num_classes": 1000 }
71+
}
72+
],
73+
"user_config": {
74+
"inference_settings": { "onnx": { "execution_provider": "CPUExecutionProvider" } }
75+
}
76+
},
77+
{
78+
"name": "latency_qnn",
79+
"type": "latency",
80+
"data_config": "evaluate_data_config",
81+
"sub_types": [ { "name": "avg", "priority": 3 } ],
82+
"user_config": {
83+
"inference_settings": {
84+
"onnx": {
85+
"session_options": {
86+
"extra_session_config": { "session.disable_cpu_ep_fallback": "0" }
87+
},
88+
"execution_provider": "QNNExecutionProvider",
89+
"provider_options": [
90+
{
91+
"backend_path": "QnnGpu.dll" }
92+
]
93+
}
94+
}
95+
}
96+
},
97+
{
98+
"name": "latency_cpu",
99+
"type": "latency",
100+
"data_config": "evaluate_data_config",
101+
"sub_types": [ { "name": "avg", "priority": 4 } ],
102+
"user_config": {
103+
"inference_settings": { "onnx": { "execution_provider": "CPUExecutionProvider" } }
104+
}
105+
}
106+
]
107+
}
108+
},
109+
"passes": {
110+
"conversion": { "device": "cpu", "type": "OnnxConversion", "target_opset": 20 },
111+
"add_metadata": { "type": "AddOliveMetadata", "graph_name": "main_graph" }
112+
},
113+
"host": "target_system",
114+
"target": "target_system",
115+
"evaluator": "common_evaluator",
116+
"cache_dir": "cache",
117+
"output_dir": "output",
118+
"evaluate_input_model": false,
119+
"clean_cache": true
120+
}
121+
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"workflow_id": "default_workflow",
3+
"input_model": {
4+
"type": "onnxmodel",
5+
"config": {
6+
"model_path": "sam21_vision_encoder.onnx"
7+
}
8+
},
9+
"systems": {
10+
"local_system": {
11+
"type": "LocalSystem",
12+
"config": {
13+
"accelerators": null,
14+
"hf_token": null
15+
}
16+
}
17+
},
18+
"data_configs": [],
19+
"evaluators": null,
20+
"engine": {
21+
"search_strategy": null,
22+
"host": {
23+
"type": "LocalSystem",
24+
"config": {
25+
"accelerators": null,
26+
"hf_token": null
27+
}
28+
},
29+
"target": {
30+
"type": "LocalSystem",
31+
"config": {
32+
"accelerators": null,
33+
"hf_token": null
34+
}
35+
},
36+
"evaluator": null,
37+
"plot_pareto_frontier": false,
38+
"no_artifacts": true,
39+
"evaluate_input_model": true,
40+
"output_dir": "C:\\Users\\HCKTest\\Desktop\\Olive\\olive-recipes\\sam2.1-hiera-small\\QNN\\model\\encoder",
41+
"packaging_config": null,
42+
"cache_config": null,
43+
"cache_dir": "cache_encoder",
44+
"clean_cache": false,
45+
"clean_evaluation_cache": false,
46+
"enable_shared_cache": false,
47+
"log_severity_level": 0,
48+
"ort_log_severity_level": 1,
49+
"ort_py_log_severity_level": 1,
50+
"log_to_file": false
51+
},
52+
"passes": {
53+
"f16": [
54+
{
55+
"type": "onnxfloattofloat16",
56+
"config": null,
57+
"host": null,
58+
"evaluator": null
59+
}
60+
],
61+
"surgeries": [
62+
{
63+
"type": "graphsurgeries",
64+
"config": {
65+
"surgeries": [
66+
{
67+
"surgeon": "RenameOutputs",
68+
"old_names": [
69+
"3922",
70+
"3926",
71+
"3924"
72+
],
73+
"new_names": [
74+
"image_embeddings",
75+
"high_res_features1",
76+
"high_res_features2"
77+
]
78+
}
79+
]
80+
},
81+
"host": null,
82+
"evaluator": null
83+
}
84+
]
85+
}
86+
}

0 commit comments

Comments
 (0)