Skip to content

Commit eaa57f6

Browse files
authored
Fix model preparation step failure in ONNXRT examples (#1423)
Signed-off-by: yuwenzho <[email protected]>
1 parent 2627d33 commit eaa57f6

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed

examples/onnxrt/image_recognition/resnet50_mlperf/quantization/ptq_static/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pip install -r requirements.txt
1919
python prepare_model.py --input_model='resnet50_v1.pb' --output_model='resnet50_v1.onnx'
2020
```
2121

22+
> Note: For now, use "onnx==1.14.1" in this step in case you get an error `ValueError: Could not infer attribute explicit_paddings type from empty iterator`. Refer to this [link](https://github.com/onnx/tensorflow-onnx/issues/2262) for more details of this error.
23+
2224
## 3. Prepare Dataset
2325

2426
Download dataset [ILSVR2012 validation Imagenet dataset](http://www.image-net.org/challenges/LSVRC/2012/downloads).

examples/onnxrt/image_recognition/resnet50_mlperf/quantization/ptq_static/prepare_model.py

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
MAX_TIMES_RETRY_DOWNLOAD = 5
99

1010

11+
def reinstall_onnx():
12+
# For now, use "onnx==1.14.1" in this step in case you get an error
13+
# `ValueError: Could not infer attribute explicit_paddings type from empty iterator`.
14+
# Refer to https://github.com/onnx/tensorflow-onnx/issues/2262 for more details of this error.
15+
subprocess.call(['pip', 'install', 'onnx==1.14.1'])
16+
1117
def parse_arguments():
1218
parser = argparse.ArgumentParser()
1319
parser.add_argument("--input_model", type=str, required=False, default="resnet50_v1.pb")
@@ -91,4 +97,5 @@ def prepare_model(input_model, output_model):
9197

9298
if __name__ == "__main__":
9399
args = parse_arguments()
100+
reinstall_onnx()
94101
prepare_model(args.input_model, args.output_model)

examples/onnxrt/object_detection/ssd_mobilenet_v1/quantization/ptq_static/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pip install -r requirements.txt
1919
python prepare_model.py --output_model='ssd_mobilenet_v1_coco_2018_01_28.onnx'
2020
```
2121

22+
> Note: For now, use "onnx==1.14.1" in this step in case you get an error `ValueError: Could not infer attribute explicit_paddings type from empty iterator`. Refer to this [link](https://github.com/onnx/tensorflow-onnx/issues/2262) for more details of this error.
23+
2224
## 3. Prepare Dataset
2325

2426
Download [MS COCO 2017 dataset](https://cocodataset.org/#download).

examples/onnxrt/object_detection/ssd_mobilenet_v1/quantization/ptq_static/prepare_model.py

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
MAX_TIMES_RETRY_DOWNLOAD = 5
1111

1212

13+
def reinstall_onnx():
14+
# For now, use "onnx==1.14.1" in this step in case you get an error
15+
# `ValueError: Could not infer attribute explicit_paddings type from empty iterator`.
16+
# Refer to https://github.com/onnx/tensorflow-onnx/issues/2262 for more details of this error.
17+
subprocess.call(['pip', 'install', 'onnx==1.14.1'])
18+
1319
def parse_arguments():
1420
parser = argparse.ArgumentParser()
1521
parser.add_argument("--input_model",
@@ -105,4 +111,5 @@ def prepare_model(input_model, output_model):
105111

106112
if __name__ == "__main__":
107113
args = parse_arguments()
114+
reinstall_onnx()
108115
prepare_model(args.input_model, args.output_model)

examples/onnxrt/object_detection/ssd_mobilenet_v2/quantization/ptq_static/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pip install -r requirements.txt
1919
python prepare_model.py --output_model='ssd_mobilenet_v2_coco_2018_03_29.onnx'
2020
```
2121

22+
> Note: For now, use "onnx==1.14.1" in this step in case you get an error `ValueError: Could not infer attribute explicit_paddings type from empty iterator`. Refer to this [link](https://github.com/onnx/tensorflow-onnx/issues/2262) for more details of this error.
23+
2224
## 3. Prepare Dataset
2325

2426
Download [MS COCO 2017 dataset](https://cocodataset.org/#download).

examples/onnxrt/object_detection/ssd_mobilenet_v2/quantization/ptq_static/prepare_model.py

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
MAX_TIMES_RETRY_DOWNLOAD = 5
1010

1111

12+
def reinstall_onnx():
13+
# For now, use "onnx==1.14.1" in this step in case you get an error
14+
# `ValueError: Could not infer attribute explicit_paddings type from empty iterator`.
15+
# Refer to https://github.com/onnx/tensorflow-onnx/issues/2262 for more details of this error.
16+
subprocess.call(['pip', 'install', 'onnx==1.14.1'])
17+
1218
def parse_arguments():
1319
parser = argparse.ArgumentParser()
1420
parser.add_argument("--input_model",
@@ -105,4 +111,5 @@ def prepare_model(input_model, output_model):
105111

106112
if __name__ == "__main__":
107113
args = parse_arguments()
114+
reinstall_onnx()
108115
prepare_model(args.input_model, args.output_model)

0 commit comments

Comments
 (0)