openvino/tools/mo
Jan Iwaszkiewicz a19c34a0f7
[PyOV] Limit numpy to major version (#24103)
### Details:

Numpy started preparation to release 2.0 version.
It brings many breaking changes listed below.
Align with these changes it's a plan for further development
(CVS-138766), for today we want to secure users against unintentional
installation of 2.x version of numpy with OV.

This PR has to be ported for 2024/1 branch

- Preparing to restrict OV to not use release of Numpy 2.0 which may
introduce many breaking changes including:
     - required bump of `pybind` to 2.12+
     - API and namespaces clean-ups and deprecations
     - behavior changes of keywords such as `copy`
- changes to existing and introduction of new dtypes (such as
`StringDType` and possibility of adding custom ones)
- more can be found here:
https://numpy.org/devdocs/release/2.0.0-notes.html
- and here:
https://numpy.org/devdocs/numpy_2_0_migration_guide.html#numpy-2-migration-guide
 
### Tickets:
 - CVS-138838

---------

Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com>
2024-04-22 13:47:49 +00:00
..
automation copyright year update (#23370) 2024-03-14 09:37:02 +00:00
openvino Exposes ov::Symbol and new methods of ov::Dimension (#23688) 2024-03-27 06:14:03 +00:00
unit_tests Improved cross-compilation with python (#24160) 2024-04-22 18:33:05 +04: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 Get rid of distutils (#22281) 2024-01-24 21:22:57 +01:00
CMakeLists.txt Tensorflow Lite frontend (#14977) 2023-01-27 06:27:59 +04:00
README.md [DOCS] `convert_model()` as a default conversion path (#17454) 2023-05-31 17:53:22 +02:00
requirements.txt [PyOV] Limit numpy to major version (#24103) 2024-04-22 13:47:49 +00:00
requirements_caffe.txt Update labeler and numpy (#18136) 2023-06-19 14:21:10 +00:00
requirements_dev.txt [PyOV] Simplify requirement files (#15343) 2023-03-29 14:27:27 +04:00
requirements_kaldi.txt Update labeler and numpy (#18136) 2023-06-19 14:21:10 +00:00
requirements_mxnet.txt Limit numpy (#18406) 2023-07-06 14:59:27 +02:00
requirements_onnx.txt Update labeler and numpy (#18136) 2023-06-19 14:21:10 +00:00
requirements_tf.txt [TF FE] Support TensorFlow 2.16 (#23562) 2024-03-21 20:39:39 +00:00
requirements_tf2.txt [TF FE] Support TensorFlow 2.16 (#23562) 2024-03-21 20:39:39 +00:00
setup.py copyright year update (#23370) 2024-03-14 09:37:02 +00: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 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