Files
openvino/tools/mo
Przemyslaw Wysocki 84a3aab115 [PyOV] Backport of wheel building fix (#19013)
* Add upper bound

* backport flake fix

* Support of protobuf >= 21 (#18351)

* Corrected typo

* Ability to compile with newer protobuf versions

* Limit numpy (#18406)

* Revert "[PyOV] Pin version of Cython for API 1.0 (#18604)" (#18681)

* Revert "[PyOV] Pin version of Cython for API 1.0 (#18604)"

This reverts commit 787796d88f.

* Suppressed clang warning

* Restrict scipy module version for POT (#18237)

* Restrict scipy module version for POT

Latest release https://pypi.org/project/scipy/1.11.0 causes dependency conflicts

* Bump OMZ to include scipy restriction

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
Co-authored-by: Alina Kladieva <alina.kladieva@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-08-07 18:23:05 +04:00
..
2023-05-24 22:07:50 +04:00
2021-12-08 08:53:53 +03:00
2021-12-08 08:53:53 +03:00

Installation

Installing from PyPi

  1. Create a virtual environment and activate it, e.g.:
virtualenv -p /usr/bin/python3.7 .env3
source .env3/bin/activate
  1. Install openvino-dev package, it contains model conversion API:
pip install openvino-dev

This will download all requirements and will install MO in your current virtual environment. If you need only particular frameworks you can specify them manually as optional dependencies in square brackets. E.g. the command below will install dependencies to support ONNX* and TensorFlow2* models:

pip install openvino-dev[onnx,tensorflow2]

To enable support of MxNet* models run:

pip install openvino-dev[mxnet]

To enable support of all frameworks:

pip install openvino-dev[all]

By default, if no frameworks are specified, dependencies to support ONNX* and TensorFlow2* are installed.

Converting models

Setup development environment

If you want to contribute to model conversion API you will need to deploy developer environment. You can do that by following the steps below:

  1. Create virtual environment and activate it, e.g.:
virtualenv -p /usr/bin/python3.7 .env3
source .env3/bin/activate
  1. Clone the OpenVINO™ repository and change dir to model-optimizer
git clone https://github.com/openvinotoolkit/openvino
cd openvino/tools/mo/
  1. Install openvino-mo package for development:
pip install -e .

or run setup.py develop, result will be the same:

python setup.py develop

This will download all requirements and deploy model conversion API for development in your virtual environment: specifically will create *.egg-link into the current directory in your site-packages. As previously noted, you can also manually specify to support only selected frameworks :

pip install -e ".[onnx,tensorflow2]"

How to run unit-tests

  1. Run tests with:
    python -m unittest discover -p "*_test.py" [-s PATH_TO_DIR]

How to capture unit-tests coverage

  1. Run tests with:
    coverage run -m unittest discover -p "*_test.py" [-s PATH_TO_DIR]
  1. Build html report:
    coverage html

How to run code linting

  1. Run the following command:
    pylint openvino/tools/mo/ mo.py