--input format update in MO docs (#14272)
* Updated input param in docs. * Updated input param in docs.
This commit is contained in:
1 parent
9d954c7920
commit
af49e51b54
12 files changed
+33
-34
No files matched your search
@@ -38,7 +38,7 @@ mo --input_model ocr.onnx --input data,seq_len --input_shape [3,150,200,1],[3]
|
||||
Alternatively, specify input shapes, using the `--input` parameter as follows:
|
||||
|
||||
```sh
|
||||
mo --input_model ocr.onnx --input data[3 150 200 1],seq_len[3]
|
||||
mo --input_model ocr.onnx --input data[3,150,200,1],seq_len[3]
|
||||
```
|
||||
|
||||
The `--input_shape` parameter allows overriding original input shapes to ones compatible with a given model.
|
||||
@@ -71,7 +71,7 @@ It is worth noting that the `--input_shape` parameter does not affect reshapeabi
|
||||
For example, launch Model Optimizer for the ONNX OCR model using `--static_shape`:
|
||||
|
||||
```sh
|
||||
mo --input_model ocr.onnx --input data[3 150 200 1],seq_len[3] --static_shape
|
||||
mo --input_model ocr.onnx --input data[3,150,200,1],seq_len[3] --static_shape
|
||||
```
|
||||
|
||||
## Additional Resources
|
||||
|
||||
@@ -52,7 +52,7 @@ The script generates ONNX model file `bert-ner.onnx`.
|
||||
## Converting an ONNX BERT-NER model to IR
|
||||
|
||||
```bash
|
||||
mo --input_model bert-ner.onnx --input "input_mask[1 128],segment_ids[1 128],input_ids[1 128]"
|
||||
mo --input_model bert-ner.onnx --input "input_mask[1,128],segment_ids[1,128],input_ids[1,128]"
|
||||
```
|
||||
|
||||
where `1` is `batch_size` and `128` is `sequence_length`.
|
||||
@@ -99,8 +99,8 @@ After completing this step, the files `rnnt_encoder.onnx`, `rnnt_prediction.onnx
|
||||
**Step 6**. Run the conversion commands:
|
||||
|
||||
```sh
|
||||
mo --input_model rnnt_encoder.onnx --input "input[157 1 240],feature_length->157"
|
||||
mo --input_model rnnt_prediction.onnx --input "symbol[1 1],hidden_in_1[2 1 320],hidden_in_2[2 1 320]"
|
||||
mo --input_model rnnt_joint.onnx --input "0[1 1 1024],1[1 1 320]"
|
||||
mo --input_model rnnt_encoder.onnx --input "input[157,1,240],feature_length->157"
|
||||
mo --input_model rnnt_prediction.onnx --input "symbol[1,1],hidden_in_1[2,1,320],hidden_in_2[2,1,320]"
|
||||
mo --input_model rnnt_joint.onnx --input "0[1,1,1024],1[1,1,320]"
|
||||
```
|
||||
> **NOTE**: The hardcoded value for sequence length = 157 was taken from the MLCommons, but conversion to IR preserves network [reshapeability](@ref openvino_docs_OV_UG_ShapeInference). Therefore, input shapes can be changed manually to any value during either conversion or inference.
|
||||
+1
-1
@@ -24,7 +24,7 @@ The resized image is sent to the convolution neural network (CNN). Because Model
|
||||
```sh
|
||||
mo \
|
||||
--input_model=model/path/frozen_graph.pb \
|
||||
--input="map/TensorArrayStack/TensorArrayGatherV3:0[1 32 86 1]" \
|
||||
--input="map/TensorArrayStack/TensorArrayGatherV3:0[1,32,86,1]" \
|
||||
--output "transpose_1,transpose_2" \
|
||||
--output_dir path/to/ir/
|
||||
```
|
||||
|
||||
@@ -112,7 +112,7 @@ Run Model Optimizer with the following command line parameters to generate resha
|
||||
```sh
|
||||
mo \
|
||||
--input_model inference_graph.pb \
|
||||
--input "IteratorGetNext:0{i32}[1 128],IteratorGetNext:1{i32}[1 128],IteratorGetNext:4{i32}[1 128]"
|
||||
--input "IteratorGetNext:0{i32}[1,128],IteratorGetNext:1{i32}[1,128],IteratorGetNext:4{i32}[1,128]"
|
||||
```
|
||||
For other applicable parameters, refer to the [Convert Model from TensorFlow](../Convert_Model_From_TensorFlow.md) guide.
|
||||
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ To generate the IR, run Model Optimizer with the following parameters:
|
||||
```sh
|
||||
mo \
|
||||
--input_model output_graph.pb \
|
||||
--input "input_lengths->[16],input_node[1 16 19 26],previous_state_h[1 2048],previous_state_c[1 2048]" \
|
||||
--input "input_lengths->[16],input_node[1,16,19,26],previous_state_h[1,2048],previous_state_c[1,2048]" \
|
||||
--output "cudnn_lstm/rnn/multi_rnn_cell/cell_0/cudnn_compatible_lstm_cell/GatherNd_1,cudnn_lstm/rnn/multi_rnn_cell/cell_0/cudnn_compatible_lstm_cell/GatherNd,logits"
|
||||
```
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ tgt_vocab_size -= 1
|
||||
```sh
|
||||
mo
|
||||
--input_model /path/to/dump/model/frozen_GNMT_inference_graph.pb
|
||||
--input "IteratorGetNext:1{i32}[1],IteratorGetNext:0{i32}[1 50],dynamic_seq2seq/hash_table_Lookup_1:0[1]->[2],dynamic_seq2seq/hash_table_Lookup:0[1]->[1]"
|
||||
--input "IteratorGetNext:1{i32}[1],IteratorGetNext:0{i32}[1,50],dynamic_seq2seq/hash_table_Lookup_1:0[1]->[2],dynamic_seq2seq/hash_table_Lookup:0[1]->[1]"
|
||||
--output dynamic_seq2seq/decoder/decoder/GatherTree
|
||||
--output_dir /path/to/output/IR/
|
||||
```
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ To convert this model to the TensorFlow format, follow the [Reproduce Keras to T
|
||||
|
||||
After converting the model to TensorFlow format, run the Model Optimizer command below:
|
||||
```sh
|
||||
mo --input "input_1[1 1333 1333 3]" --input_model retinanet_resnet50_coco_best_v2.1.0.pb --transformations_config front/tf/retinanet.json
|
||||
mo --input "input_1[1,1333,1333,3]" --input_model retinanet_resnet50_coco_best_v2.1.0.pb --transformations_config front/tf/retinanet.json
|
||||
```
|
||||
|
||||
Where `transformations_config` command-line parameter specifies the configuration json file containing model conversion hints for the Model Optimizer.
|
||||
|
||||
+16
-16
@@ -99,30 +99,30 @@ Use the following command line to convert the saved model file with the checkpoi
|
||||
IteratorGetNext:2[2],
|
||||
IteratorGetNext:4[2],
|
||||
IteratorGetNext:7[2],
|
||||
linear/linear_model/linear_model/linear_model/education/to_sparse_input/indices:0[10 2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/education/to_sparse_input/indices:0[10,2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/education/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
linear/linear_model/linear_model/linear_model/education/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
linear/linear_model/linear_model/linear_model/marital_status/to_sparse_input/indices:0[10 2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/education/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
linear/linear_model/linear_model/linear_model/marital_status/to_sparse_input/indices:0[10,2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/marital_status/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
linear/linear_model/linear_model/linear_model/marital_status/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
linear/l inear_model/linear_model/linear_model/relationship/to_sparse_input/indices:0[10 2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/marital_status/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
linear/linear_model/linear_model/linear_model/relationship/to_sparse_input/indices:0[10,2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/relationship/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
linear/linear_model/linear_model/linear_model/relationship/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
linear/linear_model/linear_model/linear_model/workclass/to_sparse_input/indices:0[10 2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/relationship/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
linear/linear_model/linear_model/linear_model/workclass/to_sparse_input/indices:0[10,2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/workclass/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
linear/linear_model/linear_model/linear_model/workclass/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
dnn/input_from_feature_columns/input_layer/education_indicator/to_sparse_input/indices:0[10 2]{i64},
|
||||
linear/linear_model/linear_model/linear_model/workclass/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
dnn/input_from_feature_columns/input_layer/education_indicator/to_sparse_input/indices:0[10,2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/education_indicator/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/education_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
dnn/input_from_feature_columns/input_layer/marital_status_indicator/to_sparse_input/indices:0[10 2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/education_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
dnn/input_from_feature_columns/input_layer/marital_status_indicator/to_sparse_input/indices:0[10,2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/marital_status_indicator/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/marital_status_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
dnn/input_from_feature_columns/input_layer/relationship_indicator/to_sparse_input/indices:0[10 2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/marital_status_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
dnn/input_from_feature_columns/input_layer/relationship_indicator/to_sparse_input/indices:0[10,2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/relationship_indicator/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/relationship_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2 50],
|
||||
dnn/input_from_feature_columns/input_layer/workclass_indicator/to_sparse_input/indices:0[10 2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/relationship_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2,50],
|
||||
dnn/input_from_feature_columns/input_layer/workclass_indicator/to_sparse_input/indices:0[10,2]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/workclass_indicator/hash_table_Lookup/LookupTableFindV2:0[10]{i64},
|
||||
dnn/input_from_feature_columns/input_layer/workclass_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2 50]"
|
||||
dnn/input_from_feature_columns/input_layer/workclass_indicator/to_sparse_input/dense_shape:0[2]{i64}->[2,50]"
|
||||
--output head/predictions/probabilities
|
||||
```
|
||||
|
||||
|
||||
@@ -184,6 +184,6 @@ To generate the XLNet Intermediate Representation (IR) of the model, run Model O
|
||||
|
||||
```sh
|
||||
mo --input_model path-to-model/model_frozen.pb \
|
||||
--input "input_mask[50 1],input_ids[50 1],seg_ids[50 1]"
|
||||
--input "input_mask[50,1],input_ids[50,1],seg_ids[50,1]"
|
||||
```
|
||||
|
||||
@@ -32,7 +32,7 @@ For example, the most common problem of non-reshape-able models is a `Reshape` o
|
||||
You can cut-off the hard-coded second input of `Reshape` and fill it in with relaxed values.
|
||||
For the following example in the diagram below, the Model Optimizer CLI should read:
|
||||
```sh
|
||||
mo --input_model path/to/model --input data[8,3,224,224],1:reshaped[2]->[0 -1]`
|
||||
mo --input_model path/to/model --input data[8,3,224,224],1:reshaped[2]->[0,-1]`
|
||||
```
|
||||
|
||||
With `1:reshaped[2]`, it is required to cut the second input (counting from zero, so `1:` means the second input) of the operation named `reshaped` and replace it with a `Parameter` with shape `[2]`.
|
||||
|
||||
@@ -8,6 +8,7 @@ from collections import defaultdict
|
||||
from copy import copy
|
||||
|
||||
import numpy as np
|
||||
from openvino.runtime import PartialShape, Dimension
|
||||
|
||||
from openvino.tools.mo.front.common.partial_infer.utils import dynamic_dimension_value, shape_array
|
||||
from openvino.tools.mo.front.onnx.extractors.utils import get_backend_pad
|
||||
@@ -18,8 +19,6 @@ from openvino.tools.mo.utils.error import Error
|
||||
from openvino.tools.mo.utils.unsupported_ops import UnsupportedOps
|
||||
from openvino.tools.mo.utils.utils import refer_to_faq_msg
|
||||
|
||||
from openvino.runtime import PartialShape, Dimension
|
||||
|
||||
|
||||
def restore_edges(graph: Graph, get_edges: callable):
|
||||
"""
|
||||
@@ -1024,15 +1023,15 @@ def add_input_ops(graph: Graph, user_defined_inputs: dict, before_infer: bool):
|
||||
"""
|
||||
This function add user defined input operations.
|
||||
For cutting without port:
|
||||
Op_1 -> Op_2 -> output, user_defined_inputs = {'Op_2': {'shape':[1, 2]}} =>
|
||||
Op_1 -> Op_2 -> output, user_defined_inputs = {'Op_2': {'shape': PartialShape([1, 2])}} =>
|
||||
Op_1, New_input (op=Parameter, shape=[1, 2]) -> Op_2 -> output
|
||||
|
||||
For cutting with input port:
|
||||
Op_1 -> Op_2 -> output, user_defined_inputs = {'Op_2': {'shape':[1, 2], 'in': 0}} =>
|
||||
Op_1 -> Op_2 -> output, user_defined_inputs = {'Op_2': {'shape':PartialShape([1, 2]), 'in': 0}} =>
|
||||
Op_1, New_input (op=Parameter, shape=[1, 2]) -> Op_2 -> output
|
||||
|
||||
For cutting with output port:
|
||||
Op_1 -> Op_2 -> output, user_defined_inputs = {'Op_2': {'shape':[1, 2], 'out': 0}} =>
|
||||
Op_1 -> Op_2 -> output, user_defined_inputs = {'Op_2': {'shape':PartialShape([1, 2]), 'out': 0}} =>
|
||||
Op_1 -> Op_2, New_input (op=Parameter, shape=[1, 2]) -> output
|
||||
|
||||
For case with before_infer=False data nodes are added to this schemes.
|
||||
|
||||
Reference in new issue
Block a user