Skip to content

Commit e210b1f

Browse files
author
hualxie
committed
add add_json
1 parent 84382ca commit e210b1f

File tree

8 files changed

+147
-16
lines changed

8 files changed

+147
-16
lines changed

.aitk/configs/checks.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"configCheck": 161,
2+
"configCheck": 162,
33
"copyCheck": 177,
4-
"extensionCheck": 1,
4+
"extensionCheck": 2,
55
"gitignoreCheck": 41,
66
"inferenceModelCheck": 25,
77
"ipynbCheck": 39,
88
"licenseCheck": 38,
9-
"modelProjectCheck": 42,
9+
"modelProjectCheck": 43,
1010
"oliveCheck": 60,
11-
"oliveJsonCheck": 161,
12-
"pathCheck": 1359,
11+
"oliveJsonCheck": 162,
12+
"pathCheck": 1364,
1313
"requirementsCheck": 37,
1414
"templateCheck": 3,
1515
"venvRequirementsCheck": 15

.aitk/configs/model_list.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,20 @@
733733
"version": 1,
734734
"extension": true
735735
},
736+
{
737+
"displayName": "Add Json Template",
738+
"icon": "HuggingFace",
739+
"modelLink": "https://huggingface.co/",
740+
"id": "extension/add_json",
741+
"runtimes": [
742+
"CPU"
743+
],
744+
"architecture": "Others",
745+
"status": "Hide",
746+
"relativePath": ".aitk/non_model_projects/extensions/add_json",
747+
"version": 1,
748+
"extension": true
749+
},
736750
{
737751
"displayName": "Hugging Face Model Template",
738752
"description": "Input Hugging face id to download project, generate code by copilot then use it.",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__pycache__
2+
/cache
3+
/history/*/*
4+
!/history/*/history.config
5+
!/history/*/olive_config.json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
placeholder
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"workflows": [
3+
{
4+
"displayName": "Conversion Sample",
5+
"file": "sample.json",
6+
"templateName": "sample"
7+
}
8+
],
9+
"modelInfo": {
10+
"id": "extension/add_json",
11+
"version": 1,
12+
"displayName": "Add Json Template",
13+
"modelLink": "https://huggingface.co/",
14+
"architecture": "Others"
15+
}
16+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"input_model": {
3+
"type": "HfModel",
4+
"model_path": "MODEL_PATH",
5+
"task": "MODEL_TASK"
6+
},
7+
"systems": {
8+
"local_system": {
9+
"type": "LocalSystem",
10+
"accelerators": [
11+
{
12+
"device": "cpu",
13+
"execution_providers": [
14+
"CPUExecutionProvider"
15+
]
16+
}
17+
]
18+
}
19+
},
20+
"evaluators": {
21+
"common_evaluator": {
22+
}
23+
},
24+
"passes": {
25+
"conversion": {
26+
"type": "OnnxConversion",
27+
"target_opset": 17,
28+
"save_as_external_data": true
29+
}
30+
},
31+
"evaluator": "common_evaluator",
32+
"evaluate_input_model": false,
33+
"target": "local_system",
34+
"cache_dir": "cache",
35+
"output_dir": "model/output"
36+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "https://github.com/microsoft/olive-recipes/raw/refs/heads/main/.aitk/configs/config_schema.json",
3+
"name": "Conversion Sample",
4+
"evalNoDataConfig": true,
5+
"disableConversionGeneration": true,
6+
"runtime": {
7+
"autoGenerated": true,
8+
"name": "Evaluate on",
9+
"type": "enum",
10+
"displayNames": [
11+
"CPU"
12+
],
13+
"path": "systems.local_system.accelerators.0.execution_providers.0",
14+
"values": [
15+
"CPUExecutionProvider"
16+
],
17+
"readOnly": false
18+
},
19+
"sections": [
20+
{
21+
"name": "Convert",
22+
"phase": "Conversion",
23+
"parameters": [],
24+
"disableToggleGeneration": true,
25+
"toggle": {
26+
"name": "Convert the model",
27+
"type": "bool",
28+
"path": "passes",
29+
"actions": [
30+
[],
31+
[]
32+
],
33+
"readOnly": true
34+
}
35+
},
36+
{
37+
"name": "Evaluate",
38+
"phase": "Evaluation",
39+
"parameters": [],
40+
"toggle": {
41+
"autoGenerated": true,
42+
"name": "Evaluate model performance",
43+
"type": "bool",
44+
"path": "evaluator",
45+
"actions": [
46+
[],
47+
[
48+
{
49+
"type": "delete",
50+
"path": "evaluator"
51+
}
52+
]
53+
]
54+
}
55+
}
56+
]
57+
}

.aitk/scripts/sanitize/model_parameter.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ class ModelParameter(BaseModelClass):
254254
# Default is False - CPU execution provider is only added when explicitly set to True
255255
addCpu: Optional[bool] = None
256256
epMinVersions: Optional[Dict[EPNames, str]] = None
257+
disableConversionGeneration: Optional[bool] = None
257258

258259
runtime: Optional[Parameter] = None
259260
runtimeInConversion: Optional[Parameter] = None
@@ -296,17 +297,18 @@ def Check(self, templates: Dict[str, Parameter], oliveJson: Any, modelList: Mode
296297

297298
self.isLLM = isLLM_by_id(modelInfo.id) or None
298299

299-
if self.sections and self.sections[0].phase == PhaseTypeEnum.Conversion:
300-
self.sections = self.sections[1:]
301-
self.sections.insert(
302-
0,
303-
Section(
304-
autoGenerated=True,
305-
name="Convert",
306-
phase=PhaseTypeEnum.Conversion,
307-
parameters=[],
308-
),
309-
)
300+
if not self.disableConversionGeneration:
301+
if self.sections and self.sections[0].phase == PhaseTypeEnum.Conversion:
302+
self.sections = self.sections[1:]
303+
self.sections.insert(
304+
0,
305+
Section(
306+
autoGenerated=True,
307+
name="Convert",
308+
phase=PhaseTypeEnum.Conversion,
309+
parameters=[],
310+
),
311+
)
310312

311313
# Add runtime
312314
syskey, system = get_target_system(oliveJson)

0 commit comments

Comments
 (0)