Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] import intel-tensorflow >=2.8.0 will cause unexpected error #12747

Closed
3 tasks done
zhentaocc opened this issue Aug 25, 2022 · 9 comments
Closed
3 tasks done

[Bug] import intel-tensorflow >=2.8.0 will cause unexpected error #12747

zhentaocc opened this issue Aug 25, 2022 · 9 comments
Assignees
Labels
bug Something isn't working category: Core OpenVINO Core (aka ngraph) category: Python API OpenVINO Python bindings PSE

Comments

@zhentaocc
Copy link

zhentaocc commented Aug 25, 2022

System information (version)
  • OpenVINO=> 2022.1
  • Operating System / Platform => Linux
  • Compiler => ❔
  • Problem classification => ❔
Detailed description

intel-tensorflow >=2.8.0 will cause unexpected error.

Steps to reproduce

install requirements

pip install intel-tensorflow==2.8.0 
pip install keras==2.8.0
pip install openvino-dev
pip install numpy==1.21

Run following script:

import os
from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2
model = MobileNetV2(weights=None, input_shape=[40, 40, 3], classes=10)
model.save('mobilenet_v2')
mo_cmd = "mo --saved_model_dir mobilenet_v2 -n mobilenet_v2 -o mobilenet_v2"
os.system(mo_cmd)

from openvino.runtime import Core
core= Core()
core.read_model('mobilenet_v2/mobilenet_v2.xml')

Error:

Traceback (most recent call last):
  File "tmp.py", line 10, in <module>
    core.read_model('mobilenet_v2/mobilenet_v2.xml')
RuntimeError: dimension (-1) in node dim must be greater or equal to -1: at offset 
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, Stack Overflow, etc and have not found solution
  • There is reproducer code and related data files: images, videos, models, etc.
@zhentaocc zhentaocc added bug Something isn't working support_request labels Aug 25, 2022
@jgespino jgespino added category: Core OpenVINO Core (aka ngraph) category: Python API OpenVINO Python bindings and removed bug Something isn't working labels Aug 25, 2022
@zhentaocc zhentaocc changed the title [Bug] [Bug] import Tensorflow >=2.8.0 will cause unexpected error Aug 26, 2022
@zhentaocc
Copy link
Author

If I set the IR batch as 1, the error msg:

RuntimeError: dimension (1) in node dim must be greater or equal to -1: at offset

The source code seems not to raise error:

int64_t dim = 0;
const pugi::char_t* dimVal = node.child_value();
std::stringstream ss(dimVal);
if (!(ss >> dim) || dim < -1) {
    IE_THROW() << "dimension (" << dimVal << ") in node " << node.name()
               << " must be greater or equal to -1: at offset " << node.offset_debug();
}

No idea why.

@zhentaocc
Copy link
Author

zhentaocc commented Aug 26, 2022

intel-tensorflow2.8+OpenVINO 2022.1+tcmalloc works.

@zhentaocc zhentaocc changed the title [Bug] import Tensorflow >=2.8.0 will cause unexpected error [Bug] import intel-tensorflow >=2.8.0 will cause unexpected error Aug 26, 2022
@jgespino
Copy link
Contributor

@zhentaocc Do you see this issue when using OpenVINO 2022.1 release and tensorflow 2.5.3? This version is installed together with openvino when running pip install openvino-dev[tensorflow2]. Also, there is a pre-release 2022.2 available, could you try on this version as well?

https://pypi.org/project/openvino-dev/2022.2.0.dev20220829/

@jgespino jgespino self-assigned this Sep 15, 2022
@jgespino jgespino added the PSE label Sep 15, 2022
@zhentaocc
Copy link
Author

zhentaocc commented Sep 19, 2022

@zhentaocc Do you see this issue when using OpenVINO 2022.1 release and tensorflow 2.5.3? This version is installed together with openvino when running pip install openvino-dev[tensorflow2].

No issue.

Also, there is a pre-release 2022.2 available, could you try on this version as well?

https://pypi.org/project/openvino-dev/2022.2.0.dev20220829/

show error:

Traceback (most recent call last):
  File "test.py", line 10, in <module>
    core.read_model('mobilenet_v2/mobilenet_v2.xml')
RuntimeError: Check 'false' failed at frontends/common/src/frontend.cpp:

@jgespino
Copy link
Contributor

@zhentaocc Glad it's working with Tensorflow version 2.5.3.

Regarding this error: RuntimeError: Check 'false' failed at frontends/common/src/frontend.cpp

I didn't see this error when setting up a virtual environment as follows. Are your step similar to mine?

python -m venv openvino_env
openvino_env\Scripts\activate
python -m pip install --upgrade pip
pip install openvino-dev[tensorflow2]==2022.2.0.dev20220829

python main.py:

2022-09-20 14:33:37.799649: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-09-20 14:33:37.801674: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-09-20 14:33:42.348937: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-09-20 14:33:42.349558: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2022-09-20 14:33:42.364638: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: 
2022-09-20 14:33:42.365357: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: 
2022-09-20 14:33:42.366429: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING:tensorflow:Compiled the loaded model, but the compiled metrics have yet to be built. `model.compile_metrics` will be empty until you train or evaluate the model.
WARNING:absl:Found untraced functions such as _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op, _jit_compiled_convolution_op while saving (showing 5 of 52). These functions will not be directly callable after loading.
Model Optimizer arguments:
Common parameters:
        - Path to the Input Model:      None
        - Path for generated IR:        C:\Users\user\cases\12747\mobilenet_v2
        - IR output name:       mobilenet_v2
        - Log level:    ERROR
        - Batch:        Not specified, inherited from the model
        - Input layers:         Not specified, inherited from the model
        - Output layers:        Not specified, inherited from the model
        - Input shapes:         Not specified, inherited from the model
        - Source layout:        Not specified
        - Target layout:        Not specified
        - Layout:       Not specified
        - Mean values:  Not specified
        - Scale values:         Not specified
        - Scale factor:         Not specified
        - Precision of IR:      FP32
        - Enable fusing:        True
        - User transformations:         Not specified
        - Reverse input channels:       False
        - Enable IR generation for fixed input shape:   False
        - Use the transformations config file:  None
Advanced parameters:
        - Force the usage of legacy Frontend of Model Optimizer for model conversion into IR:   False
        - Force the usage of new Frontend of Model Optimizer for model conversion into IR:      False
TensorFlow specific parameters:
        - Input model in text protobuf format:  False
        - Path to model dump for TensorBoard:   None
        - List of shared libraries with TensorFlow custom layers implementation:        None
        - Update the configuration file with input/output node names:   None
        - Use configuration file used to generate the model with Object Detection API:  None
        - Use the config file:  None
OpenVINO runtime found in:      c:\users\user\cases\12747\openvino_env\lib\site-packages\openvino
OpenVINO runtime version:       2022.2.0-7690-940e927a22b-refs/pull/1296/head
Model Optimizer version:        2022.2.0-7690-940e927a22b-refs/pull/1296/head
[ WARNING ]  The model contains input(s) with partially defined shapes: name="input_1" shape="[-1, 40, 40, 3]". Starting from the 2022.1 release the Model Optimizer can generate an IR with partially defined input shapes ("-1" dimension in the TensorFlow model or dimension with string value in the ONNX model). Some of the OpenVINO plugins require model input shapes to be static, so you should call "reshape" method in the Inference Engine and specify static input shapes. For optimal performance, it is still recommended to update input shapes with fixed ones using "--input" or "--input_shape" command-line parameters.
[ SUCCESS ] Generated IR version 11 model.
[ SUCCESS ] XML file: C:\Users\user\cases\12747\mobilenet_v2\mobilenet_v2.xml
[ SUCCESS ] BIN file: C:\Users\user\cases\12747\mobilenet_v2\mobilenet_v2.bin
[ SUCCESS ] Total execution time: 31.28 seconds.
[ INFO ] The model was converted to IR v11, the latest model format that corresponds to the source DL framework input/output format. While IR v11 is backwards compatible with OpenVINO Inference Engine API v1.0, please use API v2.0 (as of 2022.1) to take advantage of the latest improvements in IR v11.
Find more information about API v2.0 and IR v11 at https://docs.openvino.ai

@zhentaocc
Copy link
Author

@jgespino pls install intel-tensorflow 2.8.0.
Official tensorflow is working well always. But it doesn't make sense to fail on intel-tensorflow.
Even though intel-tensorflow might be the root cause, which I am not sure about, but OpenVINO seems vulnerable in this case.

@jgespino
Copy link
Contributor

@zhentaocc Let me check with the development team, I will keep you posted.

Ref: 90155

@jgespino jgespino added the bug Something isn't working label Sep 21, 2022
@andrei-kochin
Copy link
Contributor

@zhentaocc the issue was confirmed to be on intel-tensoflow side as Stringstream becomes broken after importing intel-tensorfow

We have internal ticket: 5531 to track it

@andrei-kochin
Copy link
Contributor

Closing this one as it was confirmed that model works fine with just OpenVINO without intel-tensorflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working category: Core OpenVINO Core (aka ngraph) category: Python API OpenVINO Python bindings PSE
Projects
None yet
Development

No branches or pull requests

5 participants