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

【Hackathon 5th No.113】Support paddle 2.5.1 #20161

Merged
merged 86 commits into from
Dec 6, 2023

Conversation

AndSonder
Copy link
Contributor

@AndSonder AndSonder commented Sep 29, 2023

Details:

Overview

1. Background

Currently, OpenVINO supports PaddlePaddle version 2.4.1. However, PaddlePaddle version 2.5 introduced many new operators that are not compatible with OpenVINO. Additionally, PaddlePaddle 2.4 does not support Python 3.11. Therefore, it is necessary to upgrade OpenVINO to support PaddlePaddle version 2.5.1.

2. Default Lack of PaddlePaddle Support in OpenVINO

OpenVINO does not natively support PaddlePaddle 2.5 and requires manual activation. Enabling PaddlePaddle support in OpenVINO can lead to compilation errors due to issues with compiling PaddlePaddle-related components.

Related Issue for Discussion: #20069

3. Significance

PaddlePaddle 2.5.1 introduces many new operators that are not compatible with OpenVINO. Upgrading OpenVINO to support PaddlePaddle 2.5.1 will provide better support for PaddlePaddle models.

Problem Analysis

OpenVINO does not natively support PaddlePaddle 2.5, and enabling it manually can lead to compilation errors. This is because the PaddlePaddle-related code in OpenVINO is currently based on PaddlePaddle 2.4, and PaddlePaddle 2.5 has introduced changes to many API interfaces, causing compilation issues in OpenVINO.

The reasons for compilation errors can be categorized as follows:

  • Compilation errors caused by changes in API names, e.g., paddle.fluid.layers.elementwise_add -> paddle.add
  • Compilation errors caused by changes in C++ operator names/attributes, e.g., elementwise_no_equal -> no_equal

Solution Design

To make OpenVINO compatible with PaddlePaddle 2.5, we need to address the two issues mentioned above. The specific solutions are as follows:

1. Mapping Old API Names to New API Names

We need to establish mappings between the old and new API names so that the OpenVINO code can use the new API names, thus resolving compilation errors caused by changes in API names. This mapping can be referenced from the PaddlePaddle official API mapping table.

This part mainly involves the following tasks:

  1. Establishing the mapping relationship between old and new API names.
  2. Making necessary modifications in the generate_xxx.py files for changes in API input parameters.
  3. Removing the code related to deprecated APIs in PaddlePaddle 2.5.1.
2. Modifying Operators with Name/Attribute Changes

For certain C++ operators, such as elementwise_no_equal -> no_equal and elementwise_equal -> equal, we need to modify the operator names in OpenVINO to resolve compilation errors caused by changes in C++ operator names and attributes.

This part mainly involves the following tasks:

  1. Modifying operator names (on the C++ side).
  2. Modifying operator attribute names (on the C++ side).
  3. Adapting C++ operator logic for cases where the output shape has changed (e.g., argmax).
3. Fixing Errors Due to API Changes

Some APIs have undergone logic changes before and after migration, leading to test errors in OpenVINO. Addressing this requires making specific modifications based on the nature of the error.

Attachments and References

Results

./paddle_tests --gtest_filter=PaddleFuzzyOpTest/FrontEndFuzzyOpTest.testOpFuzzy/paddle_*

Can pass all of the tests in the PaddleFuzzyOpTest.

image

Tickets:

@AndSonder AndSonder requested review from a team as code owners September 29, 2023 14:38
@AndSonder AndSonder requested review from AlexKoff88 and artanokhov and removed request for a team September 29, 2023 14:38
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: build OpenVINO cmake script / infra category: Python API OpenVINO Python bindings category: CI OpenVINO public CI category: dependency_changes Pull requests that update a dependency file category: PDPD FE OpenVINO PaddlePaddle FrontEnd github_actions Pull requests that update GitHub Actions code labels Sep 29, 2023
@AndSonder
Copy link
Contributor Author

@ilya-lavrenov We can talk about paddle2.5 support here.

@github-actions github-actions bot removed category: Python API OpenVINO Python bindings category: CI OpenVINO public CI category: dependency_changes Pull requests that update a dependency file github_actions Pull requests that update GitHub Actions code labels Sep 29, 2023
@AndSonder AndSonder requested a review from a team as a code owner September 29, 2023 14:45
@AndSonder
Copy link
Contributor Author

It looks like there was a compilation error after merging the master branch.

image

@AndSonder
Copy link
Contributor Author

It looks like there was a compilation error after merging the master branch.

image

never mind, it was fixed in #21473

@github-actions github-actions bot added the category: IE Tests OpenVINO Test: plugins and common label Dec 5, 2023
@AndSonder
Copy link
Contributor Author

AndSonder commented Dec 5, 2023

Please help to approve the workflows ~ @meiyang-intel

@github-actions github-actions bot removed the category: IE Tests OpenVINO Test: plugins and common label Dec 5, 2023
@AndSonder
Copy link
Contributor Author

There is one error about TensorFlow's test:

image

@AndSonder
Copy link
Contributor Author

Any other suggestions?

@meiyang-intel
Copy link
Contributor

Any other suggestions?

I have no other concerns. Let's wait for the CI. Thanks for your effort.

@AndSonder
Copy link
Contributor Author

Any other suggestions?

I have no other concerns. Let's wait for the CI. Thanks for your effort.

ok~

@ilya-lavrenov ilya-lavrenov merged commit 6d3fbf4 into openvinotoolkit:master Dec 6, 2023
42 checks passed
akuporos pushed a commit to akuporos/openvino that referenced this pull request Dec 8, 2023
* Fixed comments for linux-riscv64 GHA workflow

* Try to enable PDPD tests back

* support paddle 2.5

* fix op test errors

* fix op test errors

* recover openvino/src/core/src/op/swish.cpp

* recover thirdparty open_model_zoo

* update cmakelist

* disable some tests

* fix code style

* enable paddle ci tests

* disable some tests

* fix np.long error

* recover reverse op

* update ci config

* recover set_value test codes

* rm linux_debian.yml

* Compatible with cases where different paddle versions have different output shapes

* remove set_value tests

* recover save_model.py

* Added ctest labels for FE tests only if FW is found

* recover thirdparty

* Update CMakeLists.txt

Fixed creation of paddle_tests target two times

* update paddle v2.5.1 proto file

* recover thirdparty

* fix Paddle_Reader_Tests.LoadModelMemoryToCore error

* fix Paddle_Places test issue in v2.5.1

* support some tests for low version paddle

* fix paddle FrontEndCutModelTest issue

* fix

* support all other tests for low version paddle

* fix codestyle

* fix codestyle

* Update generate_multi_tensor_split.py

* fix build error

* add testUnloadLibBeforeDeletingDependentObject into paddle skip tests config

* remove PROTOBUF_LITE from paddle CmakeList.txt

* fix path error

* add debug info

* add debug codes

* use make_model_path

* recover

* add option optimize_for

* use FrontEndTestUtils in read_paddle_model_test.cpp

* use FrontEndTestUtils in read_paddle_model_test.cpp

* fix grid_sample error when using dynamic shape

* fix error tests for 2.4 version

* add paddle version judge for floor_div

* fix grid_sample and add tests

* fix

* fix

* recover

* recover grid_sampler

* Apply suggestions from code review

* fix

* Apply suggestions from code review

* Apply suggestions from code review

* fix build error

---------

Co-authored-by: Ilya Lavrenov <[email protected]>
Co-authored-by: meiyang-intel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: build OpenVINO cmake script / infra category: CI OpenVINO public CI category: CPP API OpenVINO CPP API bindings category: PDPD FE OpenVINO PaddlePaddle FrontEnd ExternalPR External contributor github_actions Pull requests that update GitHub Actions code PaddlePaddle Hackathon a Intel and Baidu joint Hackathon event
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Build]: Can't get the test files for paddle
8 participants