Skip to content

Commit ba4f1c7

Browse files
author
hualxie
committed
add back against olive example check
1 parent 3ec5e59 commit ba4f1c7

36 files changed

+54
-60
lines changed

.aitk/scripts/sanitize/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ def shouldCheckModel(rootDir: str, configDir: str, model: ModelInfo) -> str | No
3232
def main():
3333
argparser = argparse.ArgumentParser(description="Check model lab configs")
3434
argparser.add_argument("-v", "--verbose", action="store_true", help="Verbose mode")
35+
# for recipes not migrated https://github.com/microsoft/Olive/tree/rel-0.9.2/examples
36+
argparser.add_argument("-o", "--olive", default="", help="Olive path to check recipes")
3537
args = argparser.parse_args()
3638
GlobalVars.verbose = args.verbose
39+
GlobalVars.olivePath = args.olive
3740

3841
# need to resolve due to d:\ vs D:\
3942
rootDir = Path(__file__).parent.parent.parent.parent.resolve(strict=False)

.aitk/scripts/sanitize/model_parameter.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,17 +600,21 @@ def checkOliveFile(self, oliveJson: Any, modelInfo: ModelInfo):
600600
return
601601
printWarning(f"{self._file} does not have oliveFile")
602602
return
603-
604-
if self._file:
603+
if self.oliveFile.startswith("o:"):
604+
if GlobalVars.olivePath:
605+
oliveFile = Path(GlobalVars.olivePath) / "examples" / self.oliveFile[2:]
606+
else:
607+
return
608+
elif self._file:
605609
# relative to aitk folder
606610
oliveFile = Path(self._file).parent.parent / self.oliveFile
607611
if not oliveFile.exists():
608-
printWarning(f"{self._file}'s oliveFile {self.oliveFile} does not exist")
612+
printError(f"{self._file}'s oliveFile {self.oliveFile} does not exist")
609613
return
610-
with open_ex(oliveFile, "r") as file:
611-
oliveFileJson = json.load(file)
612614
else:
613615
raise Exception("Internal error: _file is not set")
616+
with open_ex(oliveFile, "r") as file:
617+
oliveFileJson = json.load(file)
614618

615619
diff = DeepDiff(
616620
oliveFileJson[OlivePropertyNames.Passes],

.aitk/scripts/sanitize/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
class GlobalVars:
1818
errorList = []
1919
verbose = False
20+
olivePath = None
2021
# Initialize checks
2122
pathCheck = 0
2223
configCheck = []
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Generate plain cpu version
2+
3+
`python -m pip install -r requirements-common.txt`
4+
5+
`python stable_diffusion.py --model_id stabilityai/stable-diffusion-2-1 --provider cpu --format qdq --optimize --only_conversion`
6+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Convert to Intel CPU/NPU/GPU",
3-
"oliveFile": "bert/openvino/bert_base_multilingual_cased/bert-base-multilingual-cased_context_ov_static.json",
3+
"oliveFile": "o:bert/openvino/bert_base_multilingual_cased/bert-base-multilingual-cased_context_ov_static.json",
44
"isIntel": true,
55
"debugInfo": {
66
"autoGenerated": true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Convert to AMD NPU",
3-
"oliveFile": "bert/google_bert_qdq_vitis_ai.json",
3+
"oliveFile": "o:bert/google_bert_qdq_vitis_ai.json",
44
"addCpu": true,
55
"runtime": {
66
"autoGenerated": true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Convert to Qualcomm NPU",
3-
"oliveFile": "bert/qnn/google_bert_qnn_qdq.json",
3+
"oliveFile": "o:bert/qnn/google_bert_qnn_qdq.json",
44
"addCpu": true,
55
"runtime": {
66
"autoGenerated": true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Convert to NVIDIA TRT for RTX",
3-
"oliveFile": "bert/google_bert_trtrtx.json",
3+
"oliveFile": "o:bert/google_bert_trtrtx.json",
44
"addCpu": true,
55
"runtime": {
66
"autoGenerated": true,

google-vit-base-patch16-224/aitk/vit-base-patch16-224_qdq_amd.json.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Convert to AMD NPU",
3-
"oliveFile": "vit/vit_qdq_vitis_ai.json",
3+
"oliveFile": "o:vit/vit_qdq_vitis_ai.json",
44
"addCpu": true,
55
"runtime": {
66
"autoGenerated": true,

google-vit-base-patch16-224/aitk/vit-base-patch16-224_qdq_qnn.json.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Convert to Qualcomm NPU",
3-
"oliveFile": "vit/qnn/vit_qnn_qdq.json",
3+
"oliveFile": "o:vit/qnn/vit_qnn_qdq.json",
44
"addCpu": true,
55
"runtime": {
66
"autoGenerated": true,

0 commit comments

Comments
 (0)