[MO] turn on bom_tests (#13721)
* turn on bom_tests * fixed root directories to search * leftovers fix * removed requirements from package_BOM.txt; corrected error messages to install via pip * removed extract_release_version.py from package_BOM.txt, added requirements files to skip * removed redundant commented line * mentioned CustomLayersMapping.xml.example in docs Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
This commit is contained in:
@@ -53,7 +53,7 @@ Caffe-specific parameters:
|
||||
```
|
||||
* Launching Model Optimizer for [bvlc_alexnet.caffemodel](https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet) with a specified `CustomLayersMapping` file.
|
||||
This is the legacy method of quickly enabling model conversion if your model has custom layers. This requires the Caffe system on the computer.
|
||||
The optional parameters without default values and not specified by the user in the `.prototxt` file are removed from the Intermediate Representation, and nested parameters are flattened:
|
||||
Example of `CustomLayersMapping.xml` can be found in `<OPENVINO_INSTALLATION_DIR>/mo/front/caffe/CustomLayersMapping.xml.example`. The optional parameters without default values and not specified by the user in the `.prototxt` file are removed from the Intermediate Representation, and nested parameters are flattened:
|
||||
```sh
|
||||
mo --input_model bvlc_alexnet.caffemodel -k CustomLayersMapping.xml --disable_omitting_optional --enable_flattening_nested_params
|
||||
```
|
||||
|
||||
@@ -1,17 +1,4 @@
|
||||
install_prerequisites/install_prerequisites.bat
|
||||
install_prerequisites/install_prerequisites.sh
|
||||
install_prerequisites/install_prerequisites_caffe.bat
|
||||
install_prerequisites/install_prerequisites_caffe.sh
|
||||
install_prerequisites/install_prerequisites_kaldi.bat
|
||||
install_prerequisites/install_prerequisites_kaldi.sh
|
||||
install_prerequisites/install_prerequisites_mxnet.bat
|
||||
install_prerequisites/install_prerequisites_mxnet.sh
|
||||
install_prerequisites/install_prerequisites_onnx.bat
|
||||
install_prerequisites/install_prerequisites_onnx.sh
|
||||
install_prerequisites/install_prerequisites_tf.bat
|
||||
install_prerequisites/install_prerequisites_tf.sh
|
||||
install_prerequisites/install_prerequisites_tf2.bat
|
||||
install_prerequisites/install_prerequisites_tf2.sh
|
||||
openvino/tools/__init__.py
|
||||
openvino/tools/mo/__init__.py
|
||||
openvino/tools/mo/__main__.py
|
||||
openvino/tools/mo/analysis/__init__.py
|
||||
@@ -82,6 +69,7 @@ openvino/tools/mo/back/TransposeDFT.py
|
||||
openvino/tools/mo/back/TransposeReduceFusing.py
|
||||
openvino/tools/mo/back/UselessConcatRemoval.py
|
||||
openvino/tools/mo/convert.py
|
||||
openvino/tools/mo/convert_impl.py
|
||||
openvino/tools/mo/front/__init__.py
|
||||
openvino/tools/mo/front/ArgOpsSqueeze.py
|
||||
openvino/tools/mo/front/ATenToEmbeddingBag.py
|
||||
@@ -252,6 +240,7 @@ openvino/tools/mo/front/kaldi/replace_eltwise_nin1.py
|
||||
openvino/tools/mo/front/kaldi/replace_lstm_node_pattern.py
|
||||
openvino/tools/mo/front/kaldi/replace_lstm_nonlinearity.py
|
||||
openvino/tools/mo/front/kaldi/replace_timeheightconvolution.py
|
||||
openvino/tools/mo/front/kaldi/restrictedattentioncomponent_replacer.py
|
||||
openvino/tools/mo/front/kaldi/set_ports.py
|
||||
openvino/tools/mo/front/kaldi/sigmoid_ext.py
|
||||
openvino/tools/mo/front/kaldi/split_recurrent_memoryoffset.py
|
||||
@@ -303,8 +292,8 @@ openvino/tools/mo/front/mxnet/extractors/relu.py
|
||||
openvino/tools/mo/front/mxnet/extractors/scaleshift.py
|
||||
openvino/tools/mo/front/mxnet/extractors/slice_axis.py
|
||||
openvino/tools/mo/front/mxnet/extractors/utils.py
|
||||
openvino/tools/mo/front/mxnet/exp_ext.py
|
||||
openvino/tools/mo/front/mxnet/exp_mx_to_eye.py
|
||||
openvino/tools/mo/front/mxnet/eye_ext.py
|
||||
openvino/tools/mo/front/mxnet/eye_mx_to_eye.py
|
||||
openvino/tools/mo/front/mxnet/fft_ext.py
|
||||
openvino/tools/mo/front/mxnet/flatten_ext.py
|
||||
openvino/tools/mo/front/mxnet/fully_connected_ext.py
|
||||
@@ -546,8 +535,8 @@ openvino/tools/mo/front/tf/extractors/pack.py
|
||||
openvino/tools/mo/front/tf/extractors/strided_slice.py
|
||||
openvino/tools/mo/front/tf/extractors/subgraph_utils.py
|
||||
openvino/tools/mo/front/tf/extractors/utils.py
|
||||
openvino/tools/mo/front/tf/exp_ext.py
|
||||
openvino/tools/mo/front/tf/exp_mx_to_eye.py
|
||||
openvino/tools/mo/front/tf/eye_ext.py
|
||||
openvino/tools/mo/front/tf/eye_tf_to_eye.py
|
||||
openvino/tools/mo/front/tf/fake_const_ext.py
|
||||
openvino/tools/mo/front/tf/FakeQuantWithMinMaxVars.py
|
||||
openvino/tools/mo/front/tf/FakeQuantWithMinMaxVars_ext.py
|
||||
@@ -571,6 +560,8 @@ openvino/tools/mo/front/tf/gathernd_ext.py
|
||||
openvino/tools/mo/front/tf/GatherTree_ext.py
|
||||
openvino/tools/mo/front/tf/GNMT_DynamicSequenceLengths.py
|
||||
openvino/tools/mo/front/tf/graph_utils.py
|
||||
openvino/tools/mo/front/tf/GRUBlockCell_ext.py
|
||||
openvino/tools/mo/front/tf/GRUBlockCellReplacement.py
|
||||
openvino/tools/mo/front/tf/identity_ext.py
|
||||
openvino/tools/mo/front/tf/identityN_to_identity.py
|
||||
openvino/tools/mo/front/tf/if_ext.py
|
||||
@@ -899,6 +890,7 @@ openvino/tools/mo/ops/Enter.py
|
||||
openvino/tools/mo/ops/Exit.py
|
||||
openvino/tools/mo/ops/expand_dims.py
|
||||
openvino/tools/mo/ops/ExtractImagePatches.py
|
||||
openvino/tools/mo/ops/eye.py
|
||||
openvino/tools/mo/ops/fake_output.py
|
||||
openvino/tools/mo/ops/fakequantize.py
|
||||
openvino/tools/mo/ops/fill.py
|
||||
@@ -911,6 +903,7 @@ openvino/tools/mo/ops/gelu.py
|
||||
openvino/tools/mo/ops/grn.py
|
||||
openvino/tools/mo/ops/group_norm.py
|
||||
openvino/tools/mo/ops/GRU.py
|
||||
openvino/tools/mo/ops/GRUBlockCell.py
|
||||
openvino/tools/mo/ops/GRUCell.py
|
||||
openvino/tools/mo/ops/hard_sigmoid.py
|
||||
openvino/tools/mo/ops/identity.py
|
||||
@@ -1036,7 +1029,6 @@ openvino/tools/mo/utils/cli_parser.py
|
||||
openvino/tools/mo/utils/custom_replacement_config.py
|
||||
openvino/tools/mo/utils/dsu.py
|
||||
openvino/tools/mo/utils/error.py
|
||||
openvino/tools/mo/utils/extract_release_version.py
|
||||
openvino/tools/mo/utils/find_ie_version.py
|
||||
openvino/tools/mo/utils/find_inputs.py
|
||||
openvino/tools/mo/utils/get_ov_update_message.py
|
||||
@@ -1104,11 +1096,4 @@ openvino/tools/mo/utils/type_utils.py
|
||||
openvino/tools/mo/utils/unsupported_ops.py
|
||||
openvino/tools/mo/utils/utils.py
|
||||
openvino/tools/mo/utils/version.py
|
||||
openvino/tools/mo/utils/versions_checker.py
|
||||
requirements.txt
|
||||
requirements_caffe.txt
|
||||
requirements_kaldi.txt
|
||||
requirements_mxnet.txt
|
||||
requirements_onnx.txt
|
||||
requirements_tf.txt
|
||||
requirements_tf2.txt
|
||||
openvino/tools/mo/utils/versions_checker.py
|
||||
@@ -1,184 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
:: Check if Python is installed
|
||||
setlocal
|
||||
|
||||
set ROOT_DIR=%~dp0
|
||||
|
||||
python --version 2>NUL
|
||||
if errorlevel 1 (
|
||||
echo Error^: Python is not installed. Please install Python 3.7 ^(64-bit^) or higher from https://www.python.org/downloads/
|
||||
goto error
|
||||
)
|
||||
|
||||
:: Check if Python version is equal or higher 3.7
|
||||
for /F "tokens=* USEBACKQ" %%F IN (`python --version 2^>^&1`) DO (
|
||||
set version=%%F
|
||||
)
|
||||
echo %var%
|
||||
|
||||
for /F "tokens=1,2,3 delims=. " %%a in ("%version%") do (
|
||||
set Major=%%b
|
||||
set Minor=%%c
|
||||
)
|
||||
|
||||
if "%Major%" geq "3" (
|
||||
if "%Minor%" geq "7" (
|
||||
set python_ver=okay
|
||||
)
|
||||
)
|
||||
if not "%python_ver%"=="okay" (
|
||||
echo Unsupported Python version. Please install Python 3.7 ^(64-bit^) or higher from https://www.python.org/downloads/
|
||||
goto error
|
||||
)
|
||||
|
||||
:: install Python modules
|
||||
|
||||
set USE_VENV="false"
|
||||
set VENV_DIR=%USERPROFILE%\Documents\Intel\OpenVINO\venv_openvino
|
||||
|
||||
IF /I "%1%" EQU "" (
|
||||
set postfix=
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "venv" (
|
||||
set postfix=
|
||||
set USE_VENV="true"
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "caffe" (
|
||||
set postfix=_caffe
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "tf" (
|
||||
set postfix=_tf
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "tf2" (
|
||||
set postfix=_tf2
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "mxnet" (
|
||||
set postfix=_mxnet
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "kaldi" (
|
||||
set postfix=_kaldi
|
||||
) ELSE (
|
||||
IF /I "%1%" EQU "onnx" (
|
||||
set postfix=_onnx
|
||||
) ELSE (
|
||||
echo Unsupported framework
|
||||
goto error
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
IF /I "%2%" EQU "venv" (
|
||||
set USE_VENV="true"
|
||||
)
|
||||
|
||||
IF %USE_VENV% == "true" (
|
||||
python -m venv "%VENV_DIR%"
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
)
|
||||
|
||||
python -m pip install -U pip
|
||||
python -m pip install -r "%ROOT_DIR%..\requirements%postfix%.txt"
|
||||
|
||||
:: Chek MO version
|
||||
set python_command='python "%ROOT_DIR%..\openvino\tools\mo\utils\extract_release_version.py"'
|
||||
FOR /F "delims=" %%i IN (%python_command%) DO set mo_release_version=%%i
|
||||
IF "%mo_release_version%" == "None.None" (
|
||||
set mo_is_custom="true"
|
||||
) ELSE (
|
||||
set mo_is_custom="false"
|
||||
)
|
||||
|
||||
:: Check if existing IE Python bindings satisfy requirements
|
||||
set errorlevel=
|
||||
python "%ROOT_DIR%..\openvino\tools\mo\utils\find_ie_version.py"
|
||||
IF %errorlevel% EQU 0 goto ie_search_end
|
||||
|
||||
:: Check if OV already installed via pip
|
||||
set errorlevel=
|
||||
python -m pip show openvino
|
||||
IF %errorlevel% EQU 0 (
|
||||
IF %mo_is_custom% == "true" (
|
||||
echo [ WARNING ] OpenVINO ^(TM^) Toolkit version installed in pip is incompatible with the Model Optimizer
|
||||
echo [ WARNING ] For the custom Model Optimizer version consider building Inference Engine Python API from sources ^(preferable^) or install the highest OpenVINO ^(TM^) toolkit version using "pip install openvino"
|
||||
goto ie_search_end
|
||||
)
|
||||
IF %mo_is_custom% == "false" (
|
||||
echo [ WARNING ] OpenVINO ^(TM^) Toolkit version installed in pip is incompatible with the Model Optimizer
|
||||
echo [ WARNING ] For the release Model Optimizer version which is %mo_release_version% please install OpenVINO ^(TM^) toolkit using pip install openvino==%mo_release_version% or build Inference Engine Python API from sources
|
||||
goto ie_search_end
|
||||
)
|
||||
)
|
||||
|
||||
echo [ WARNING ] Could not find the Inference Engine Python API. Installing OpenVINO ^(TM^) toolkit using pip
|
||||
|
||||
IF %mo_is_custom% == "true" (
|
||||
echo [ WARNING ] Detected a custom Model Optimizer version
|
||||
echo [ WARNING ] The desired version of the Inference Engine can be installed only for the release Model Optimizer version
|
||||
echo [ WARNING ] The highest OpenVINO ^(TM^) toolkit version will be installed ^(may be incompatible with current Model Optimizer version^)
|
||||
echo [ WARNING ] It is recommended to build the Inference Engine from sources even if the current installation is successful
|
||||
goto install_last_ov
|
||||
)
|
||||
|
||||
set errorlevel=
|
||||
python -m pip install openvino==%mo_release_version%
|
||||
IF %errorlevel% NEQ 0 (
|
||||
echo [ WARNING ] Could not find the OpenVINO ^(TM^) toolkit version %mo_release_version% in pip
|
||||
echo [ WARNING ] The highest OpenVINO ^(TM^) toolkit version will be installed ^(may be incompatible with current Model Optimizer version^)
|
||||
echo [ WARNING ] It is recommended to build the Inference Engine from sources even if the current installation is successful
|
||||
goto install_last_ov
|
||||
)
|
||||
|
||||
set errorlevel=
|
||||
python "%ROOT_DIR%..\openvino\tools\mo\utils\find_ie_version.py"
|
||||
IF %errorlevel% EQU 0 goto ie_search_end
|
||||
|
||||
echo [ WARNING ] The installed OpenVINO ^(TM^) toolkit version %mo_release_version% does not work as expected. Uninstalling...
|
||||
python -m pip uninstall -y openvino
|
||||
echo [ WARNING ] Consider building the Inference Engine Python API from sources
|
||||
goto ie_search_end
|
||||
|
||||
:install_last_ov
|
||||
set errorlevel=
|
||||
python -m pip install openvino
|
||||
IF %errorlevel% NEQ 0 (
|
||||
echo [ WARNING ] Could not find OpenVINO ^(TM^) toolkit version available in pip for installation
|
||||
echo [ WARNING ] Consider building the Inference Engine Python API from sources
|
||||
goto ie_search_end
|
||||
)
|
||||
|
||||
set errorlevel=
|
||||
python "%ROOT_DIR%..\openvino\tools\mo\utils\find_ie_version.py"
|
||||
IF %errorlevel% EQU 0 goto ie_search_end
|
||||
|
||||
echo [ WARNING ] The installed highest OpenVINO ^(TM^) toolkit version doesn't work as expected. Uninstalling...
|
||||
python -m pip uninstall -y openvino
|
||||
echo [ WARNING ] Consider building the Inference Engine Python API from sources
|
||||
goto ie_search_end
|
||||
|
||||
:ie_search_end
|
||||
|
||||
IF %USE_VENV% == "true" (
|
||||
echo.
|
||||
echo Before running the Model Optimizer, please activate virtualenv environment by running "%VENV_DIR%\Scripts\activate.bat"
|
||||
) ELSE (
|
||||
echo.
|
||||
echo [ WARNING ] All Model Optimizer dependencies are installed globally.
|
||||
echo [ WARNING ] If you want to keep Model Optimizer in separate sandbox
|
||||
echo [ WARNING ] run install_prerequisites.bat "{caffe|tf|tf2|mxnet|kaldi|onnx}" venv
|
||||
)
|
||||
|
||||
goto:eof
|
||||
|
||||
:error
|
||||
echo.
|
||||
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
error() {
|
||||
local code="${3:-1}"
|
||||
if [[ -n "$2" ]];then
|
||||
echo "Error on or near line $1: $2; exiting with status ${code}"
|
||||
else
|
||||
echo "Error on or near line $1; exiting with status ${code}"
|
||||
fi
|
||||
exit "${code}"
|
||||
}
|
||||
trap 'error ${LINENO}' ERR
|
||||
|
||||
|
||||
V_ENV=0
|
||||
|
||||
for ((i=1;i <= $#;i++)) {
|
||||
case "${!i}" in
|
||||
caffe|tf|tf2|mxnet|kaldi|onnx)
|
||||
postfix="_$1"
|
||||
;;
|
||||
"venv")
|
||||
V_ENV=1
|
||||
;;
|
||||
*)
|
||||
if [[ "$1" != "" ]]; then
|
||||
echo "\"${!i}\" is unsupported parameter"
|
||||
echo $"Usage: $0 {caffe|tf|tf2|mxnet|kaldi|onnx} {venv}"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
VENV_DIR="$HOME/venv_openvino"
|
||||
SCRIPTDIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" && pwd )"
|
||||
|
||||
if [[ -f /etc/centos-release ]]; then
|
||||
DISTRO="centos"
|
||||
elif [[ -f /etc/lsb-release ]]; then
|
||||
DISTRO="ubuntu"
|
||||
fi
|
||||
|
||||
if [[ $DISTRO == "centos" ]]; then
|
||||
if command -v python3.8 >/dev/null 2>&1; then
|
||||
python_binary=python3.8
|
||||
elif command -v python3.7 >/dev/null 2>&1; then
|
||||
python_binary=python3.7
|
||||
fi
|
||||
else
|
||||
python_binary=python3
|
||||
fi
|
||||
|
||||
install_latest_ov() {
|
||||
if $2; then
|
||||
sudo -E "$1" -m pip install openvino
|
||||
else
|
||||
"$1" -m pip install openvino
|
||||
fi
|
||||
}
|
||||
|
||||
install_ov() {
|
||||
if $2; then
|
||||
sudo -E "$1" -m pip install openvino=="$3"
|
||||
else
|
||||
"$1" -m pip install openvino=="$3"
|
||||
fi
|
||||
}
|
||||
|
||||
uninstall_ov() {
|
||||
if $2; then
|
||||
sudo -E "$1" -m pip uninstall -y openvino
|
||||
else
|
||||
"$1" -m pip uninstall -y openvino
|
||||
fi
|
||||
}
|
||||
|
||||
check_ie() {
|
||||
$1 "$SCRIPTDIR/../openvino/tools/mo/utils/find_ie_version.py"
|
||||
}
|
||||
|
||||
check_ov_package() {
|
||||
if $2; then
|
||||
sudo -E "$1" -m pip show openvino
|
||||
else
|
||||
"$1" -m pip show openvino
|
||||
fi
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
printf "${YELLOW}[ WARNING ] %s ${NC}\n" "$1"
|
||||
}
|
||||
|
||||
find_ie_bindings() {
|
||||
python_executable="$1"
|
||||
requires_sudo="$2"
|
||||
|
||||
mo_release_version="$("$python_executable" "$SCRIPTDIR"/../openvino/tools/mo/utils/extract_release_version.py)"
|
||||
if [[ $mo_release_version == "None.None" ]]; then
|
||||
mo_is_custom=true
|
||||
else
|
||||
mo_is_custom=false
|
||||
fi
|
||||
|
||||
if ! check_ie "$python_executable"; then
|
||||
# Check if OpenVINO version was installed using pip
|
||||
if check_ov_package "$python_executable" "$requires_sudo"; then
|
||||
if $mo_is_custom; then
|
||||
print_warning "OpenVINO (TM) Toolkit version installed in pip is incompatible with the Model Optimizer."
|
||||
print_warning "For the custom Model Optimizer version consider building Inference Engine Python API from sources (preferable) or install the highest OpenVINO (TM) toolkit version using \"pip install openvino\""
|
||||
else
|
||||
print_warning "OpenVINO (TM) Toolkit version installed in pip is incompatible with the Model Optimizer."
|
||||
print_warning "For the release version of the Model Optimizer, which is $mo_release_version, install the OpenVINO (TM) toolkit using \"pip install openvino==$mo_release_version\" or build the Inference Engine Python API from sources."
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
print_warning "Could not find the Inference Engine Python API. Installing OpenVINO (TM) toolkit using pip."
|
||||
|
||||
if $mo_is_custom; then
|
||||
print_warning "Detected a custom Model Optimizer version."
|
||||
print_warning "The desired version of the Inference Engine can be installed only for the release Model Optimizer version."
|
||||
print_warning "The highest OpenVINO (TM) toolkit version will be installed, which might be incompatible with the current Model Optimizer version."
|
||||
print_warning "It is recommended to build the Inference Engine from sources even if the current installation is successful."
|
||||
elif install_ov "$python_executable" "$requires_sudo" "$mo_release_version"; then
|
||||
if check_ie "$python_executable"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
print_warning "The installed OpenVINO (TM) toolkit version $mo_release_version does not work as expected. Uninstalling..."
|
||||
uninstall_ov "$python_executable" "$requires_sudo"
|
||||
print_warning "Consider building the Inference Engine Python API from sources."
|
||||
return 0
|
||||
else
|
||||
print_warning "Could not find the OpenVINO (TM) toolkit version $mo_release_version in pip."
|
||||
print_warning "The highest OpenVINO (TM) toolkit version will be installed, which might be incompatible with the current Model Optimizer version."
|
||||
print_warning "It is recommended to build the Inference Engine from sources even if the current installation is successful."
|
||||
fi
|
||||
|
||||
# Install the highest OpenVINO pip version
|
||||
if install_latest_ov "$python_executable" "$requires_sudo"; then
|
||||
if check_ie "$python_executable"; then
|
||||
return 0
|
||||
else
|
||||
print_warning "The installed highest OpenVINO (TM) toolkit version doesn't work as expected. Uninstalling..."
|
||||
uninstall_ov "$python_executable" "$requires_sudo"
|
||||
print_warning "Consider building the Inference Engine Python API from sources."
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
print_warning "Could not find OpenVINO (TM) toolkit version available in pip for installation."
|
||||
print_warning "Consider building the Inference Engine Python API from sources."
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if [[ $V_ENV -eq 1 ]]; then
|
||||
"$python_binary" -m venv "$VENV_DIR"
|
||||
source "$VENV_DIR/bin/activate"
|
||||
venv_python_binary="$VENV_DIR/bin/$python_binary"
|
||||
# latest pip is needed to install tensorflow
|
||||
"$venv_python_binary" -m pip install --upgrade pip
|
||||
"$venv_python_binary" -m pip install -r "$SCRIPTDIR/../requirements${postfix}.txt"
|
||||
find_ie_bindings "$venv_python_binary" false
|
||||
echo
|
||||
echo "Before running the Model Optimizer, please activate virtualenv environment by running \"source $VENV_DIR/bin/activate\""
|
||||
else
|
||||
# latest pip is needed to install tensorflow
|
||||
"$python_binary" -m pip install --upgrade pip
|
||||
"$python_binary" -m pip install -r "$SCRIPTDIR/../requirements${postfix}.txt"
|
||||
find_ie_bindings "$python_binary" false
|
||||
echo
|
||||
echo "[WARNING] All Model Optimizer dependencies are installed globally."
|
||||
echo "[WARNING] If you want to keep Model Optimizer in separate sandbox"
|
||||
echo "[WARNING] run install_prerequisites.sh \"{caffe|tf|tf2|mxnet|kaldi|onnx}\" venv"
|
||||
fi
|
||||
@@ -1,6 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
CALL install_prerequisites.bat caffe
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source install_prerequisites.sh caffe
|
||||
@@ -1,7 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
:: Check if Python is installed
|
||||
CALL install_prerequisites.bat kaldi
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source install_prerequisites.sh kaldi
|
||||
@@ -1,7 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
:: Check if Python is installed
|
||||
CALL install_prerequisites.bat mxnet
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source install_prerequisites.sh mxnet
|
||||
@@ -1,6 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
CALL install_prerequisites.bat onnx
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source install_prerequisites.sh onnx
|
||||
@@ -1,7 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
:: Check if Python is installed
|
||||
CALL install_prerequisites.bat tf
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source install_prerequisites.sh tf
|
||||
@@ -1,8 +0,0 @@
|
||||
@echo off
|
||||
|
||||
:: Copyright (C) 2018-2022 Intel Corporation
|
||||
:: SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
:: Check if Python is installed
|
||||
CALL install_prerequisites.bat tf2
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
source install_prerequisites.sh tf2
|
||||
|
||||
@@ -202,8 +202,7 @@ def arguments_post_parsing(argv: argparse.Namespace):
|
||||
def raise_ie_not_found():
|
||||
raise Error("Could not find the Inference Engine or nGraph Python API.\n"
|
||||
"Consider building the Inference Engine and nGraph Python APIs from sources or "
|
||||
"try to install OpenVINO (TM) Toolkit using \"install_prerequisites.{}\"".format(
|
||||
"bat" if sys.platform == "windows" else "sh"))
|
||||
"try to install OpenVINO (TM) Toolkit using pip \npip install openvino")
|
||||
|
||||
try:
|
||||
if not find_ie_version(silent=argv.silent):
|
||||
|
||||
@@ -7,8 +7,8 @@ from openvino.tools.mo.utils.utils import refer_to_faq_msg
|
||||
try:
|
||||
import mxnet
|
||||
except ImportError:
|
||||
raise Error('Module mxnet was not found. Please install appropriate version of mxnet via install_prerequisites '
|
||||
'script.' + refer_to_faq_msg(52))
|
||||
raise Error('Module mxnet was not found. Please install appropriate version of mxnet with requirements via \n'
|
||||
'pip install openvino-dev[mxnet]')
|
||||
|
||||
from openvino.tools.mo.load.loader import Loader
|
||||
from openvino.tools.mo.front.common.register_custom_ops import update_extractors_with_extensions
|
||||
|
||||
@@ -20,8 +20,7 @@ def check_python_version():
|
||||
def log_ie_not_found():
|
||||
log.error("Could not find the Inference Engine or nGraph Python API.\n"
|
||||
"Consider building the Inference Engine and nGraph Python APIs"
|
||||
" from sources or try to install OpenVINO (TM) Toolkit using \"install_prerequisites.{}\""
|
||||
.format("bat" if sys.platform == "windows" else "sh"))
|
||||
" from sources or try to install OpenVINO (TM) Toolkit using pip \npip install openvino")
|
||||
|
||||
|
||||
def log_mo_root_dir_not_found():
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
try:
|
||||
# needed by install_prerequisites which call extract_release_version as python script
|
||||
from version import extract_release_version, get_version
|
||||
except ImportError:
|
||||
from openvino.tools.mo.utils.version import extract_release_version, get_version
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("{}.{}".format(*extract_release_version(get_version())))
|
||||
@@ -31,7 +31,7 @@ def read_text(path):
|
||||
requirements_txt = []
|
||||
py_modules = []
|
||||
for item in os.listdir():
|
||||
if re.match(r'requirements(.*)\.txt', item):
|
||||
if re.match(r'requirements_?(tf|tf2|onnx|mxnet|kaldi|caffe)?\.txt', item):
|
||||
requirements_txt.append(item)
|
||||
for item in os.listdir(prefix):
|
||||
if re.match(r'mo(.*)\.py|main(.*)\.py', item):
|
||||
@@ -102,6 +102,7 @@ setup(
|
||||
'openvino.tools.mo.front.mxnet': ['*.json'],
|
||||
'openvino.tools.mo.front.onnx': ['*.json'],
|
||||
'openvino.tools.mo.front.tf': ['*.json'],
|
||||
'openvino.tools.mo.front.caffe': ['CustomLayersMapping.xml*']
|
||||
},
|
||||
extras_require={
|
||||
'caffe': read_text('requirements_caffe.txt'),
|
||||
|
||||
@@ -7,16 +7,19 @@ import re
|
||||
import unittest
|
||||
from itertools import islice
|
||||
|
||||
from openvino.tools.mo.utils.utils import get_mo_root_dir
|
||||
|
||||
dir_patterns_to_skip = ['.*__pycache__.*']
|
||||
file_patterns_to_skip = ['.*\\.DS_Store$',
|
||||
'.*\\.swp',
|
||||
'.*\\.pyc$']
|
||||
'.*\\.pyc$',
|
||||
'requirements.*\.txt',
|
||||
'version.txt']
|
||||
full_name_patterns_to_skip = ['^openvino/tools/mo/utils/convert.py$',
|
||||
'^openvino/tools/mo/front/caffe/CustomLayersMapping.xml$',
|
||||
]
|
||||
if platform.system() == 'Windows':
|
||||
full_name_patterns_to_skip = [i.replace('/', '\\\\') for i in full_name_patterns_to_skip]
|
||||
dirs_to_search = ['openvino/tools/mo']
|
||||
|
||||
|
||||
def is_match(name: str, patterns: ()):
|
||||
@@ -35,18 +38,17 @@ class TestBOMFile(unittest.TestCase):
|
||||
else:
|
||||
cls.existing_files = [name.rstrip() for name in bom_file.readlines()]
|
||||
|
||||
# output_dir is the model_optimizer directory that is located in 'pkg/tools'
|
||||
cls.output_dir = mo_path.replace('tests', 'tools')
|
||||
# dirs_to_search is the root directory where MO is located, 'openvino_project_root/tools/mo/openvino/tools'
|
||||
cls.dirs_to_search = os.path.normpath(get_mo_root_dir() + '/mo/')
|
||||
cls.prefix = os.path.normpath(get_mo_root_dir() + '../../../') # prefix which is used in BOM file
|
||||
cls.expected_header = [re.compile(pattern) for pattern in [
|
||||
r'^# Copyright \([cC]\) [0-9\-]+ Intel Corporation$',
|
||||
r'^# SPDX-License-Identifier: Apache-2.0$',
|
||||
]]
|
||||
|
||||
@unittest.skip("83076 - test infra change affects bom tests")
|
||||
def test_bom_file(self):
|
||||
missing_files = list()
|
||||
for src_dir in dirs_to_search:
|
||||
src_dir = os.path.join(self.output_dir, src_dir)
|
||||
for src_dir in [self.dirs_to_search]:
|
||||
if not os.path.isdir(src_dir):
|
||||
continue
|
||||
for root, dirs, files in os.walk(src_dir):
|
||||
@@ -54,7 +56,7 @@ class TestBOMFile(unittest.TestCase):
|
||||
continue
|
||||
for f in files:
|
||||
full_name = os.path.join(root, f)
|
||||
full_name = full_name[len(self.output_dir) + 1:]
|
||||
full_name = full_name[len(self.prefix) + 1:]
|
||||
if is_match(f, file_patterns_to_skip):
|
||||
continue
|
||||
if is_match(full_name, full_name_patterns_to_skip):
|
||||
@@ -68,16 +70,14 @@ class TestBOMFile(unittest.TestCase):
|
||||
print(f.replace('\\', '/'))
|
||||
self.assertTrue(not len(missing_files), '{} files missed in BOM'.format(len(missing_files)))
|
||||
|
||||
@unittest.skip("83076 - test infra change affects bom tests")
|
||||
def test_bom_does_not_contain_unittest_files(self):
|
||||
for file_name in self.existing_files:
|
||||
self.assertFalse(file_name.endswith('_test.py'), 'BOM file contains test file {}'.format(file_name))
|
||||
|
||||
@unittest.skip("83076 - test infra change affects bom tests")
|
||||
def test_deleted_files_still_stored_in_bom(self):
|
||||
deleted = list()
|
||||
for file in self.existing_files:
|
||||
if not os.path.isfile(os.path.join(self.output_dir, file)):
|
||||
if not os.path.isfile(os.path.join(self.prefix, file)):
|
||||
deleted.append(file)
|
||||
if len(deleted) != 0:
|
||||
print("Deleted files still stored in BOM file:")
|
||||
@@ -85,7 +85,6 @@ class TestBOMFile(unittest.TestCase):
|
||||
print(f)
|
||||
self.assertTrue(not len(deleted), '{} files deleted but still stored in BOM'.format(len(deleted)))
|
||||
|
||||
@unittest.skip("83076 - test infra change affects bom tests")
|
||||
def test_alphabetical_order_and_duplicates(self):
|
||||
sorted_bom = sorted([x for x in self.existing_files if self.existing_files.count(x) == 1], key=str.lower)
|
||||
if self.existing_files != sorted_bom:
|
||||
@@ -93,11 +92,9 @@ class TestBOMFile(unittest.TestCase):
|
||||
print(*sorted_bom, sep='\n')
|
||||
self.assertTrue(False)
|
||||
|
||||
@unittest.skip("83076 - test infra change affects bom tests")
|
||||
def test_missed_intel_header(self):
|
||||
missing_files = list()
|
||||
for src_dir in dirs_to_search:
|
||||
src_dir = os.path.join(self.output_dir, src_dir)
|
||||
for src_dir in [self.dirs_to_search]:
|
||||
if not os.path.isdir(src_dir):
|
||||
continue
|
||||
for root, dirs, files in os.walk(src_dir):
|
||||
|
||||
Reference in New Issue
Block a user