Skip to content

Commit 1d975c7

Browse files
authored
Update README.md
1 parent 4263a12 commit 1d975c7

File tree

1 file changed

+20
-69
lines changed

1 file changed

+20
-69
lines changed

examples/openvino/README.md

Lines changed: 20 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ python aot_openvino_compiler.py --suite <MODEL_SUITE> --model <MODEL_NAME> --inp
6969
- **`--dataset`** (optional):
7070
Path to the imagenet-like calibration dataset.
7171

72+
- **`--infer`** (optional):
73+
Execute inference with the compiled model and report average inference timing.
74+
75+
- **`--num_iter`** (optional):
76+
Number of iterations to execute inference. Default value for the number of iterations is `1`.
77+
78+
- **`--warmup_iter`** (optional):
79+
Number of warmup iterations to execute inference before timing begins. Default value for the warmup iterations is `0`.
80+
81+
- **`--input_tensor_path`** (optional):
82+
Path to the raw tensor file to be used as input for inference. If this argument is not provided, a random input tensor will be generated.
83+
84+
- **`--output_tensor_path`** (optional):
85+
Path to the raw tensor file which the output of the inference to be saved.
86+
7287
- **`--device`** (optional)
7388
Target device for the compiled model. Default is `CPU`.
7489
Examples: `CPU`, `GPU`
@@ -100,6 +115,11 @@ python aot_openvino_compiler.py --suite timm --model vgg16 --input_shape [1, 3,
100115
python aot_openvino_compiler.py --suite timm --model vgg16 --input_shape [1, 3, 224, 224] --device CPU --validate --dataset /path/to/dataset --quantize
101116
```
102117

118+
#### Export a Torchvision Inception V3 model for the CPU and Execute Inference
119+
```bash
120+
python aot_openvino_compiler.py --suite torchvision --model inception_v3 --infer --warmup_iter 10 --num_iter 100 --input_shape "(1, 3, 256, 256)" --device CPU
121+
```
122+
103123
### **Notes**
104124
1. **Input Shape in Zsh**:
105125
If you are using Zsh, wrap `--input_shape` in quotes or use a tuple:
@@ -168,72 +188,3 @@ Run inference with a given model for 10 iterations:
168188
--model_path=model.pte \
169189
--num_executions=10
170190
```
171-
172-
## Running Python Example with Pybinding:
173-
174-
You can use the `export_and_infer_openvino.py` script to run models with the OpenVINO backend through the Python bindings.
175-
176-
### **Usage**
177-
178-
#### **Command Structure**
179-
```bash
180-
python export_and_infer_openvino.py <ARGUMENTS>
181-
```
182-
183-
#### **Arguments**
184-
- **`--suite`** (required if `--model_path` argument is not used):
185-
Specifies the model suite to use. Needs to be used with `--model` argument.
186-
Supported values:
187-
- `timm` (e.g., VGG16, ResNet50)
188-
- `torchvision` (e.g., resnet18, mobilenet_v2)
189-
- `huggingface` (e.g., bert-base-uncased). NB: Quantization and validation is not supported yet.
190-
191-
- **`--model`** (required if `--model_path` argument is not used):
192-
Name of the model to export. Needs to be used with `--suite` argument.
193-
Examples:
194-
- For `timm`: `vgg16`, `resnet50`
195-
- For `torchvision`: `resnet18`, `mobilenet_v2`
196-
- For `huggingface`: `bert-base-uncased`, `distilbert-base-uncased`
197-
198-
- **`--model_path`** (required if `--suite` and `--model` arguments are not used):
199-
Path to the saved model file. This argument allows you to load the compiled model from a file, instead of downloading it from the model suites using the `--suite` and `--model` arguments.
200-
Example: `<path to model foler>/resnet50_fp32.pte`
201-
202-
- **`--input_shape`**(required for random inputs):
203-
Input shape for the model. Provide this as a **list** or **tuple**.
204-
Examples:
205-
- `[1, 3, 224, 224]` (Zsh users: wrap in quotes)
206-
- `(1, 3, 224, 224)`
207-
208-
- **`--input_tensor_path`**(optional):
209-
Path to the raw input tensor file. If this argument is not provided, a random input tensor will be generated with the input shape provided with `--input_shape` argument.
210-
Example: `<path to the input tensor foler>/input_tensor.pt`
211-
212-
- **`--output_tensor_path`**(optional):
213-
Path to the file where the output raw tensor will be saved.
214-
Example: `<path to the output tensor foler>/output_tensor.pt`
215-
216-
- **`--device`** (optional)
217-
Target device for the compiled model. Default is `CPU`.
218-
Examples: `CPU`, `GPU`
219-
220-
- **`--num_iter`** (optional)
221-
Number of iterations to execute inference for evaluation. The default value is `1`.
222-
Examples: `100`, `1000`
223-
224-
- **`--warmup_iter`** (optional)
225-
Number of warmup iterations to execute inference before evaluation. The default value is `0`.
226-
Examples: `5`, `10`
227-
228-
229-
### **Examples**
230-
231-
#### Execute Torchvision ResNet50 model for the GPU with Random Inputs
232-
```bash
233-
python export_and_infer_openvino.py --suite torchvision --model resnet50 --input_shape "(1, 3, 256, 256)" --device GPU
234-
```
235-
236-
#### Run a Precompiled Model for the CPU Using an Existing Input Tensor File and Save the Output.
237-
```bash
238-
python export_and_infer_openvino.py --model_path /path/to/model/folder/resnet50_fp32.pte --input_tensor_file /path/to/input/folder/input.pt --output_tensor_file /path/to/output/folder/output.pt --device CPU
239-
```

0 commit comments

Comments
 (0)