openvino/tools/mo
Przemyslaw Wysocki d5a274b0e4
[PyOV] Drop Python 3.6 support (#12280)
* Drop Python 3.6

* Test dropping Python to 3.6 in py_checks.yml

* Allow Python 3.6 for open source

* Add docs on upgrading Python
2022-09-22 11:58:12 +02:00
..
automation [MO][Kaldi] RestrictedAttention component support in MO (#12582) 2022-08-22 09:10:20 +02:00
install_prerequisites [PyOV] Drop Python 3.6 support (#12280) 2022-09-22 11:58:12 +02:00
openvino Describe pruning transformation in MO help (#13121) 2022-09-21 16:05:48 +04:00
unit_tests [MO] Extend support for TF BlockLSTM with the single output, concatenated hidden states (#13095) 2022-09-20 15:18:49 +03:00
.coveragerc [MO] Align MO namespaces (#7708) 2021-12-08 08:53:53 +03:00
.pylintdict [MO] Align MO namespaces (#7708) 2021-12-08 08:53:53 +03:00
.pylintrc [MO] Align MO namespaces (#7708) 2021-12-08 08:53:53 +03:00
CMakeLists.txt Enable mock fe tests in python api 2.0 tests (#12978) 2022-09-20 11:56:46 +03:00
README.md [MO] Align MO namespaces (#7708) 2021-12-08 08:53:53 +03:00
requirements.txt MO uses the same version of protobuf like other packages (#12713) 2022-08-25 13:09:03 +02:00
requirements_caffe.txt MO uses the same version of protobuf like other packages (#12713) 2022-08-25 13:09:03 +02:00
requirements_dev.txt Update module version to remove vulnerability (#12054) 2022-07-08 08:28:48 +02:00
requirements_kaldi.txt [MO, POT] Top up upper bounds for TensorFlow and NumPy modules in all requirement files (#12191) 2022-08-03 16:18:41 +04:00
requirements_mxnet.txt [MO, POT] Top up upper bounds for TensorFlow and NumPy modules in all requirement files (#12191) 2022-08-03 16:18:41 +04:00
requirements_onnx.txt MO uses the same version of protobuf like other packages (#12713) 2022-08-25 13:09:03 +02:00
requirements_tf.txt [MO, POT] Top up upper bounds for TensorFlow and NumPy modules in all requirement files (#12191) 2022-08-03 16:18:41 +04:00
requirements_tf2.txt [MO, POT] Top up upper bounds for TensorFlow and NumPy modules in all requirement files (#12191) 2022-08-03 16:18:41 +04:00
setup.py [MO] move importlib-metadata into setup.py (#10319) 2022-02-15 15:01:27 +03:00

README.md

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 Optimizer:
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 Optimizer 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 Optimizer 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