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

[Good First Issue][TF FE]: Fix IndexError list index out of range for Squeeze #22078

Closed
rkazants opened this issue Jan 10, 2024 · 13 comments · Fixed by #22326
Closed

[Good First Issue][TF FE]: Fix IndexError list index out of range for Squeeze #22078

rkazants opened this issue Jan 10, 2024 · 13 comments · Fixed by #22326
Assignees
Labels
category: TF FE OpenVINO TensorFlow FrontEnd good first issue Good for newcomers no_stale Do not mark as stale
Milestone

Comments

@rkazants
Copy link
Contributor

rkazants commented Jan 10, 2024

Context

OpenVINO component responsible for support of TensorFlow models is called as TensorFlow Frontend (TF FE). TF FE converts a model represented in TensorFlow opset to a model in OpenVINO opset.

We have 23 models from TensorFlow Hub that are failing due to issue IndexError list index out of range for Squeeze. Your fix greatly helps to make OpenVINO better.

What needs to be done?

The task is to fix a problem IndexError list index out of range for Squeeze.

How to reproduce the issue:

  1. Build OpenVINO following How to Build OpenVINO document
  2. Install built openvino-*.whl package using pip. You can find the package in openvino/build/wheels directory. Do not install openvino-dev-*.whl package. Also, it is recommended to use new virtual environment to avoid mess with previously installed OV packages in the system.
  3. Run the model conversion as follows:
import tensorflow_hub as hub
import openvino as ov

model_link='https://www.kaggle.com/models/google/delf/frameworks/tensorFlow1/variations/delf/versions/1'
model = hub.load(model_link)

ov.convert_model(model)

Received error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "openvino/tools/ovc/convert.py", line 101, in convert_model
    ov_model, _ = _convert(cli_parser, params, True)
  File "openvino/tools/ovc/convert_impl.py", line 534, in _convert
    raise e
  File "openvino/tools/ovc/convert_impl.py", line 476, in _convert
    ov_model = driver(argv, {"conversion_parameters": non_default_params})
  File "openvino/tools/ovc/convert_impl.py", line 227, in driver
    ov_model = moc_emit_ir(prepare_ir(argv), argv)
  File "openvino/tools/ovc/convert_impl.py", line 177, in prepare_ir
    ov_model = moc_pipeline(argv, moc_front_end)
  File "openvino/tools/ovc/moc_frontend/pipeline.py", line 244, in moc_pipeline
    ov_model = moc_front_end.convert(input_model)
  File "openvino/frontend/frontend.py", line 18, in convert
    converted_model = super().convert(model)
openvino._pyopenvino.OpConversionFailure: Check 'is_conversion_successful' failed at src/frontends/tensorflow/src/frontend.cpp:428:
FrontEnd API failed with OpConversionFailure:
[TensorFlow Frontend] Internal error, conversion is failed for Squeeze operation with a message:
IndexError: list index out of range

At:
  openvino/frontend/tensorflow/node_decoder.py(39): tf_attr_to_numpy
  openvino/frontend/tensorflow/node_decoder.py(46): tf_attr_to_ov
  openvino/frontend/tensorflow/node_decoder.py(167): get_attribute
  openvino/frontend/frontend.py(18): convert
  openvino/tools/ovc/moc_frontend/pipeline.py(244): moc_pipeline
  openvino/tools/ovc/convert_impl.py(177): prepare_ir
  openvino/tools/ovc/convert_impl.py(227): driver
  openvino/tools/ovc/convert_impl.py(476): _convert
  openvino/tools/ovc/convert.py(101): convert_model
  <stdin>(1): <module>

Resources

Contact points

@openvinotoolkit/openvino-tf-frontend-maintainers

@rkazants rkazants added good first issue Good for newcomers no_stale Do not mark as stale category: TF FE OpenVINO TensorFlow FrontEnd labels Jan 10, 2024
@abhinav231-valisetti
Copy link
Contributor

@rkazants If no one has been assigned yet, could I work on this issue?

@rkazants
Copy link
Contributor Author

Hi @abhinav231-valisetti, sure. The task is yours.

Best regards,
Roman

@vikasgrewal16
Copy link

Can i also work on this issue? I think i have an probable solution

@abhinav231-valisetti
Copy link
Contributor

Hi @vikasgrewal16 it will be great help for me to get your inputs on this issue.

@rkazants
Copy link
Contributor Author

Fyi, please use new link to join Intel DevHub Discord server, if you have not yet joined. The previous one is outdated.

Best regards,
Roman

@rkazants
Copy link
Contributor Author

Hi @abhinav231-valisetti, do you have any update on this task? Please let me know in case questions and you can create a preliminary PR to discuss.

Best regards,
Roman

@abhinav231-valisetti
Copy link
Contributor

abhinav231-valisetti commented Jan 16, 2024

Hello @rkazants, I have addressed the current issue, and the bug fix seems to be effective for the tensorflow Model link provided in the example. Could you please share links for other models so I can verify the accuracy of the fix?

@rkazants
Copy link
Contributor Author

rkazants commented Jan 17, 2024

Hello @rkazants, I have addressed the current issue, and the bug fix seems to be effective for the tensorflow Model link provided in the example. Could you please share links for other models so I can verify the accuracy of the fix?

Hi @abhinav231-valisetti, sounds great. Take a look at this list of models https://github.com/openvinotoolkit/openvino/blob/master/tests/model_hub_tests/tf_hub_tests/nightly_models, where you can find models failing due to "IndexError list index out of range for Squeeze". Of course, some of them can start to fail due to different reason after your fix and it is a separate story to fix:)

Best regards,
Roman

@abhinav231-valisetti
Copy link
Contributor

Hi @rkazants Thank you for the resource, I will run the tests and create a PR asap.

@abhinav231-valisetti
Copy link
Contributor

abhinav231-valisetti commented Jan 21, 2024

Hi @rkazants , To fix this bug, I have modified the code in the openvino-*.whl file, which is a Python library. However, this wheel file was generated after building it using CMake. I am looking for guidance to locate the exact files that need to be modified, so that when I rebuild the project, the updated code is included in the openvino-*.whl file.

This where i made changes to fix the bug,
openvino/frontend/tensorflow/node_decoder.py(39): tf_attr_to_numpy

@rkazants
Copy link
Contributor Author

Hi @abhinav231-valisetti, you can find this file here: https://github.com/openvinotoolkit/openvino/tree/master/src/bindings/python/src/openvino/frontend/tensorflow. Please create PR with your changes.

Best regards,
Roman

@rkazants
Copy link
Contributor Author

@abhinav231-valisetti, congratulations, your PR was merged.

Best regards,
Roman

@abhinav231-valisetti
Copy link
Contributor

Thank you, @rkazants, for all the guidance throughout the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: TF FE OpenVINO TensorFlow FrontEnd good first issue Good for newcomers no_stale Do not mark as stale
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants