Skip to content

Commit

Permalink
Paddle FrontEnd Refactoring (openvinotoolkit#9157)
Browse files Browse the repository at this point in the history
* Refactor PaddlePaddle FrontEnd

* Codestyle

* FrontEnd,InputModel,Place base classes -> abstract, renamed model file

* Fix unit tests

* fix unit tests

* ngraph:: to ov::

* Rename frontends dir to frontend

* Rename paddlepaddle to paddle; pdpd to paddle

* add missing file

* codestyle

* Remove local change

* paddlepaddle -> paddle for azure configs and .md files

* fix package name, fix config files

* Fix win build

* Revert Broadcast/AutoBroadcast changes

* codestyle

* fix FronEnd class

* fix ngraph_cpp_api.config

* codestyle

* merge master

* fix build

* refactoring; revert broadcast/autobroadcast changes

* codestyle

* fix MacOS config
  • Loading branch information
itikhono authored Dec 22, 2021
1 parent 2daafec commit 0bbda24
Show file tree
Hide file tree
Showing 182 changed files with 1,786 additions and 1,738 deletions.
8 changes: 4 additions & 4 deletions .ci/azure/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ jobs:
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/wheel/requirements-dev.txt
# For running Python API tests
python3 -m pip install -r $(REPO_DIR)/inference-engine/ie_bridges/python/src/requirements-dev.txt
# For running PaddlePaddle frontend unit tests
python3 -m pip install -r $(REPO_DIR)/src/core/tests/frontend/paddlepaddle/requirements_dev.txt
# For running Paddle frontend unit tests
python3 -m pip install -r $(REPO_DIR)/src/core/tests/frontend/paddle/requirements_dev.txt
# For running ONNX frontend unit tests
python3 -m pip install -r $(REPO_DIR)/src/core/tests/requirements_test_onnx.txt
# For MO unit tests
Expand Down Expand Up @@ -248,8 +248,8 @@ jobs:
displayName: 'OV Core UT'
continueOnError: false

- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/paddlepaddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-PaddlePaddle.xml
displayName: 'PaddlePaddle Frontend UT'
- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/paddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml
displayName: 'Paddle Frontend UT'
continueOnError: false

- script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
Expand Down
8 changes: 4 additions & 4 deletions .ci/azure/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ jobs:
python -m pip install --upgrade pip
rem For running Python API tests
python -m pip install -r $(REPO_DIR)\inference-engine\ie_bridges\python\src\requirements-dev.txt
rem For running PaddlePaddle frontend unit tests
python -m pip install -r $(REPO_DIR)\src\core\tests\frontend\paddlepaddle\requirements_dev.txt
rem For running Paddle frontend unit tests
python -m pip install -r $(REPO_DIR)\src\core\tests\frontend\paddle\requirements_dev.txt
rem For running ONNX frontend unit tests
python -m pip install -r $(REPO_DIR)\src\core\tests\requirements_test_onnx.txt
rem For MO unit tests
Expand Down Expand Up @@ -207,8 +207,8 @@ jobs:
displayName: 'OV Core UT'
continueOnError: false

- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddlepaddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-PaddlePaddle.xml
displayName: 'PaddlePaddle Frontend UT'
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-Paddle.xml
displayName: 'Paddle Frontend UT'
continueOnError: false

- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
Expand Down
4 changes: 2 additions & 2 deletions cmake/developer_package/plugins/plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ function(ie_add_plugin)
if(TARGET ov_onnx_frontend)
add_dependencies(${IE_PLUGIN_NAME} ov_onnx_frontend)
endif()
if(TARGET ov_paddlepaddle_frontend)
add_dependencies(${IE_PLUGIN_NAME} ov_paddlepaddle_frontend)
if(TARGET ov_paddle_frontend)
add_dependencies(${IE_PLUGIN_NAME} ov_paddle_frontend)
endif()
if(TARGET ov_tensorflow_frontend)
add_dependencies(${IE_PLUGIN_NAME} ov_tensorflow_frontend)
Expand Down
4 changes: 2 additions & 2 deletions cmake/features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ else()
endif()

ie_dependent_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ON "protoc_available" OFF)
ie_dependent_option(ENABLE_OV_PDPD_FRONTEND "Enable PaddlePaddle FrontEnd" ON "protoc_available" OFF)
ie_dependent_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON "protoc_available" OFF)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_dependent_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON "protoc_available" OFF)
ie_dependent_option(ENABLE_SYSTEM_PROTOBUF "Use system protobuf" OFF
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PDPD_FRONTEND OR ENABLE_OV_TF_FRONTEND;BUILD_SHARED_LIBS" OFF)
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND;BUILD_SHARED_LIBS" OFF)
ie_dependent_option(ENABLE_OV_CORE_UNIT_TESTS "Enables OpenVINO core unit tests" ON "ENABLE_TESTS;NOT ANDROID" OFF)
ie_dependent_option(ENABLE_OV_CORE_BACKEND_UNIT_TESTS "Control the building of unit tests using backends" ON
"ENABLE_OV_CORE_UNIT_TESTS" OFF)
Expand Down
18 changes: 9 additions & 9 deletions cmake/templates/OpenVINOConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# * `Runtime`: OpenVINO C++ and C Core & Inference Runtime, frontend common
# * `ONNX`: OpenVINO ONNX frontend
# * `PaddlePaddle`: OpenVINO PaddlePaddle frontend
# * `Paddle`: OpenVINO Paddle frontend
#
# If no components are specified, `Runtime` component is provided:
#
Expand Down Expand Up @@ -43,8 +43,8 @@
# `openvino::frontend::onnx`
# ONNX FrontEnd target (optional)
#
# `openvino::frontend::paddlepaddle`
# PaddlePaddle FrontEnd target (optional)
# `openvino::frontend::paddle`
# Paddle FrontEnd target (optional)
#
# `openvino::frontend::tensorflow`
# TensorFlow FrontEnd target (optional)
Expand All @@ -63,8 +63,8 @@
# `OpenVINO_Frontend_ONNX_FOUND`
# OpenVINO ONNX frontend is available
#
# `OpenVINO_Frontend_PaddlePaddle_FOUND`
# OpenVINO PaddlePaddle frontend is available
# `OpenVINO_Frontend_Paddle_FOUND`
# OpenVINO Paddle frontend is available
#
# `OpenVINO_Frontend_TensorFlow_FOUND`
# OpenVINO TensorFlow frontend is available
Expand Down Expand Up @@ -193,12 +193,12 @@ endif()
set(${CMAKE_FIND_PACKAGE_NAME}_Runtime_FOUND ON)

set(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND @ENABLE_OV_ONNX_FRONTEND@)
set(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND @ENABLE_OV_PDPD_FRONTEND@)
set(${CMAKE_FIND_PACKAGE_NAME}_Paddle_FOUND @ENABLE_OV_PADDLE_FRONTEND@)
set(${CMAKE_FIND_PACKAGE_NAME}_TensorFlow_FOUND @ENABLE_OV_TF_FRONTEND@)
set(${CMAKE_FIND_PACKAGE_NAME}_IR_FOUND @ENABLE_OV_IR_FRONTEND@)

set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_ONNX_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND})
set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_PaddlePaddle_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND})
set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_Paddle_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_Paddle_FOUND})
set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_TensorFlow_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_TensorFlow_FOUND})
set(${CMAKE_FIND_PACKAGE_NAME}_Frontend_IR_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_IR_FOUND})

Expand All @@ -212,7 +212,7 @@ endif()
#

foreach(target openvino::runtime openvino::runtime::c
openvino::frontend::onnx openvino::frontend::paddlepaddle openvino::frontend::tensorflow)
openvino::frontend::onnx openvino::frontend::paddle openvino::frontend::tensorflow)
if(TARGET ${target} AND _ov_as_external_package)
_ov_target_no_deprecation_error(${target})
endif()
Expand All @@ -230,6 +230,6 @@ if(_need_package_name_reset)
unset(_need_package_name_reset)
endif()

unset(${CMAKE_FIND_PACKAGE_NAME}_PaddlePaddle_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_Paddle_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_TensorFlow_FOUND)
14 changes: 7 additions & 7 deletions cmake/templates/ngraphConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
# ngraph_ov_onnx_frontend_FOUND - True if the system has ov_onnx_frontend library
# ngraph::ov_onnx_frontend - ONNX FrontEnd target (optional)
#
# ngraph_paddlepaddle_frontend_FOUND - True if the system has PDPD frontend
# ngraph::ov_paddlepaddle_frontend - nGraph PDPD frontend (optional)
# ngraph_paddle_frontend_FOUND - True if the system has Paddle frontend
# ngraph::ov_paddle_frontend - nGraph Paddle frontend (optional)
#

@PACKAGE_INIT@
Expand All @@ -56,10 +56,10 @@ if(TARGET openvino::frontend::onnx AND NOT TARGET ngraph::ov_onnx_frontend)
INTERFACE_LINK_LIBRARIES openvino::frontend::onnx)
endif()

if(TARGET openvino::frontend::paddlepaddle AND NOT TARGET ngraph::ov_paddlepaddle_frontend)
add_library(ngraph::ov_paddlepaddle_frontend INTERFACE IMPORTED)
set_target_properties(ngraph::ov_paddlepaddle_frontend PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::frontend::paddlepaddle)
if(TARGET openvino::frontend::paddle AND NOT TARGET ngraph::ov_paddle_frontend)
add_library(ngraph::ov_paddle_frontend INTERFACE IMPORTED)
set_target_properties(ngraph::ov_paddle_frontend PROPERTIES
INTERFACE_LINK_LIBRARIES openvino::frontend::paddle)
endif()

if(TARGET openvino::frontend::tensorflow AND NOT TARGET ngraph::ov_tensorflow_frontend)
Expand All @@ -85,7 +85,7 @@ if(ngraph_onnx_importer_FOUND)
endif()
endif()

set(ngraph_paddlepaddle_frontend_FOUND ${OpenVINO_Frontend_PaddlePaddle_FOUND})
set(ngraph_paddle_frontend_FOUND ${OpenVINO_Frontend_Paddle_FOUND})
set(ngraph_tensorflow_frontend_FOUND ${OpenVINO_Frontend_TensorFlow_FOUND})
set(ngraph_ir_frontend_FOUND ${OpenVINO_Frontend_IR_FOUND})

Expand Down
4 changes: 2 additions & 2 deletions cmake/test_model_zoo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ if(ENABLE_TESTS)
add_dependencies(test_model_zoo test_pip_prerequsites)
endif()

if (ENABLE_OV_PDPD_FRONTEND AND ENABLE_OV_CORE_UNIT_TESTS)
add_dependencies(test_model_zoo paddlepaddle_test_models)
if (ENABLE_OV_PADDLE_FRONTEND AND ENABLE_OV_CORE_UNIT_TESTS)
add_dependencies(test_model_zoo paddle_test_models)
endif()

install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo"
Expand Down
4 changes: 2 additions & 2 deletions docs/IE_DG/inference_engine_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ This library contains the classes to:
Starting from 2022.1 release, OpenVINO Runtime introduced a concept of frontend plugins. Such plugins can be automatically dynamically loaded by OpenVINO Runtime dynamically depending on file format:
* Unix* OS:
- `libov_ir_frontend.so` to read a network from IR
- `libov_paddlepaddle_frontend.so` to read a network from PaddlePaddle model format
- `libov_paddle_frontend.so` to read a network from PaddlePaddle model format
- `libov_onnx_frontend.so` to read a network from ONNX model format
* Windows* OS:
- `ov_ir_frontend.dll` to read a network from IR
- `ov_paddlepaddle_frontend.dll` to read a network from PaddlePaddle model format
- `ov_paddle_frontend.dll` to read a network from PaddlePaddle model format
- `ov_onnx_frontend.dll` to read a network from ONNX model format

### Device-specific Plugin Libraries ###
Expand Down
39 changes: 39 additions & 0 deletions docs/doxygen/ngraph_cpp_api.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Doxyfile 1.8.18

# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists, items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").

@INCLUDE = "@IE_CONFIG_BUILD@"

EXCLUDE_SYMBOLS =

PREDEFINED =

EXCLUDE_PATTERNS = */python/*

FILE_PATTERNS = *.cpp \
*.c \
*.hpp \
*.h

LAYOUT_FILE = "@NGRAPH_CPP_LAYOUT_BUILD@"

INPUT = "@CORE_DIR@/core/include/" \
"@FRONTENDS_DIR@/onnx/frontend/include/" \
"@FRONTENDS_DIR@/paddle/frontend/include/"

HTML_OUTPUT = "@NGRAPH_CPP_OUTPUT@"

GENERATE_TAGFILE = "@DOCS_BUILD_DIR@/ngraph_cpp_api.tag"

WARN_LOGFILE = "@DOCS_BUILD_DIR@/ngraph_cpp_api.log"
4 changes: 2 additions & 2 deletions src/core/tests/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
add_subdirectory(shared)

if (ENABLE_OV_PDPD_FRONTEND)
add_subdirectory(paddlepaddle)
if (ENABLE_OV_PADDLE_FRONTEND)
add_subdirectory(paddle)
endif()

if (ENABLE_OV_ONNX_FRONTEND)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
#

set(TARGET_NAME "paddlepaddle_tests")
set(TARGET_NAME "paddle_tests")

file(GLOB_RECURSE SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

Expand All @@ -18,7 +18,7 @@ install(TARGETS ${TARGET_NAME}
EXCLUDE_FROM_ALL)

# Test model generating
ie_check_pip_package(paddlepaddle WARNING)
ie_check_pip_package(paddlepaddle WARNING paddle)

set(TEST_PADDLE_MODELS_DIRNAME test_model_zoo/paddle_test_models)
target_compile_definitions(${TARGET_NAME} PRIVATE -D TEST_PADDLE_MODELS_DIRNAME=\"${TEST_PADDLE_MODELS_DIRNAME}/\")
Expand All @@ -39,7 +39,7 @@ if (paddlepaddle_FOUND)
${TEST_PADDLE_MODELS}
DEPENDS ${PADDLE_ALL_SCRIPTS}
)
add_custom_target(paddlepaddle_test_models DEPENDS ${OUT_FILE})
add_custom_target(paddle_test_models DEPENDS ${OUT_FILE})

install(DIRECTORY ${TEST_PADDLE_MODELS}
DESTINATION tests/${TEST_PADDLE_MODELS_DIRNAME}
Expand All @@ -51,11 +51,11 @@ else()
COMMAND ${CMAKE_COMMAND}
-E cmake_echo_color --red "Warning: Unable to generate PaddlePaddle test models. Running '${TARGET_NAME}' will likely fail"
)
add_custom_target(paddlepaddle_test_models DEPENDS unable_build_paddle_models.txt)
add_custom_target(paddle_test_models DEPENDS unable_build_paddle_models.txt)
endif()

add_dependencies(${TARGET_NAME} paddlepaddle_test_models)
add_dependencies(${TARGET_NAME} ov_paddlepaddle_frontend)
add_dependencies(${TARGET_NAME} paddle_test_models)
add_dependencies(${TARGET_NAME} ov_paddle_frontend)

# Fuzzy tests for PaddlePaddle use IE_CPU engine
if (ENABLE_MKL_DNN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using namespace ngraph;
using namespace ov::frontend;

using PDPDBasicTest = FrontEndBasicTest;
using PaddleBasicTest = FrontEndBasicTest;

static const std::vector<std::string> models{
std::string("conv2d"),
Expand All @@ -20,7 +20,7 @@ static const std::vector<std::string> models{
std::string("2in_2out_dynbatch/2in_2out_dynbatch.pdmodel"),
};

INSTANTIATE_TEST_SUITE_P(PDPDBasicTest,
INSTANTIATE_TEST_SUITE_P(PaddleBasicTest,
FrontEndBasicTest,
::testing::Combine(::testing::Values(PADDLE_FE),
::testing::Values(std::string(TEST_PADDLE_MODELS_DIRNAME)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using namespace ov;
using namespace ov::frontend;

using PDPDConvertModelTest = FrontEndConvertModelTest;
using PaddleConvertModelTest = FrontEndConvertModelTest;

static const std::vector<std::string> models{
std::string("conv2d"),
Expand All @@ -21,7 +21,7 @@ static const std::vector<std::string> models{
std::string("pool2d_dyn_hw/pool2d_dyn_hw.pdmodel"),
};

INSTANTIATE_TEST_SUITE_P(PDPDConvertModelTest,
INSTANTIATE_TEST_SUITE_P(PaddleConvertModelTest,
FrontEndConvertModelTest,
::testing::Combine(::testing::Values(PADDLE_FE),
::testing::Values(std::string(TEST_PADDLE_MODELS_DIRNAME)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using namespace ngraph;
using namespace ov::frontend;

using PDPDCutTest = FrontEndCutModelTest;
using PaddleCutTest = FrontEndCutModelTest;

static CutModelParam getTestData_2in_2out() {
CutModelParam res;
Expand All @@ -26,7 +26,7 @@ static CutModelParam getTestData_2in_2out() {
return res;
}

INSTANTIATE_TEST_SUITE_P(PDPDCutTest,
INSTANTIATE_TEST_SUITE_P(PaddleCutTest,
FrontEndCutModelTest,
::testing::Values(getTestData_2in_2out()),
FrontEndCutModelTest::getTestCaseName);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace ov::frontend;

using PDPDJsonConfigTest = FrontEndJsonConfigTest;
using PaddleJsonConfigTest = FrontEndJsonConfigTest;

static JsonConfigFEParam getTestData() {
JsonConfigFEParam res;
Expand All @@ -17,7 +17,7 @@ static JsonConfigFEParam getTestData() {
return res;
}

INSTANTIATE_TEST_SUITE_P(PDPDJsonConfigTest,
INSTANTIATE_TEST_SUITE_P(PaddleJsonConfigTest,
FrontEndJsonConfigTest,
::testing::Values(getTestData()),
FrontEndJsonConfigTest::getTestCaseName);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using namespace ngraph;
using namespace ov::frontend;

using PDPDCutTest = FrontEndLoadFromTest;
using PaddleCutTest = FrontEndLoadFromTest;

static LoadFromFEParam getTestData() {
LoadFromFEParam res;
Expand All @@ -22,7 +22,7 @@ static LoadFromFEParam getTestData() {
return res;
}

INSTANTIATE_TEST_SUITE_P(PDPDCutTest,
INSTANTIATE_TEST_SUITE_P(PaddleCutTest,
FrontEndLoadFromTest,
::testing::Values(getTestData()),
FrontEndLoadFromTest::getTestCaseName);
File renamed without changes.
Loading

0 comments on commit 0bbda24

Please sign in to comment.