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

Rework model loading in FE manager, implement PDPD probing #6358

Merged
merged 52 commits into from
Jul 19, 2021

Conversation

mvafin
Copy link
Contributor

@mvafin mvafin commented Jun 24, 2021

Details:

  • Implement probing methods for FrontEndPDPD
  • Support reading PDPD model in ReadNetwork
  • Capabilities removed. It is expected that Frontend will do lazy initialization if called to do something
  • FrontEnds are now loaded relative to frontend_manager library, not "."

Tickets:

  • 52258

@mvafin mvafin requested a review from nosovmik July 1, 2021 12:56
@mvafin mvafin marked this pull request as ready for review July 1, 2021 22:52
@mvafin mvafin requested review from a team, ilyachur and slyalin July 1, 2021 22:52
@mvafin mvafin force-pushed the frontend/reader_master branch from 5f4b211 to 29d2367 Compare July 12, 2021 11:34
@mvafin mvafin requested a review from nosovmik July 12, 2021 13:43
@ilya-lavrenov ilya-lavrenov added this to the 2022.1 milestone Jul 12, 2021
@ilya-lavrenov ilya-lavrenov added the category: inference OpenVINO Runtime library - Inference label Jul 12, 2021
Comment on lines 43 to 44
virtual bool
supported_by_variants(const std::vector<std::shared_ptr<Variant>>& variants) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is a service method, and I agree with @rkazants it shouldn't be a part of public API.

Or if it is a public method, why don't we have a documentation for it? I am a little bit confused, how should I implement this method in my own framework

#else
typedef std::string path_type;
#endif

class PDPD_API InputModelPDPD : public InputModel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make public API more clear and remove classes which won't be used by end user?

@mvafin
Copy link
Contributor Author

mvafin commented Jul 13, 2021

public/developer API issue will be covered separately.

@mvafin mvafin requested a review from ilyachur July 13, 2021 15:47
Comment on lines 43 to 44
virtual bool
supported_by_variants(const std::vector<std::shared_ptr<Variant>>& variants) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slyalin Do we have a plan to refactor API? Now it looks strange that we add service methods to public API

ngraph/frontend/frontend_manager/src/frontend_manager.cpp Outdated Show resolved Hide resolved
ngraph/frontend/paddlepaddle/src/frontend.cpp Show resolved Hide resolved
ngraph/frontend/paddlepaddle/src/frontend.cpp Show resolved Hide resolved
#endif

template <typename T>
bool endsWith(const std::basic_string<T>& str, const std::basic_string<T>& suffix)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a common util. should each frontend implement it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean to create static util library?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that. Moreover if I remember right we have the same methods in the Inference Engine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I access methods from IE? I thought we don't link IE to ngraph

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it looks like it should be a common library. Could you add TODO to move such utility methods to common library and create a task?

mvafin added 3 commits July 15, 2021 15:56
* Remove supported_by_arguments from public api
@mvafin mvafin requested a review from ilyachur July 15, 2021 13:52
@mvafin mvafin requested a review from tomdol July 16, 2021 07:34
@mvafin
Copy link
Contributor Author

mvafin commented Jul 16, 2021

Ticket for further optimizing FrontendManager dependency is created: 60517.

Copy link
Contributor

@ilya-lavrenov ilya-lavrenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with the assumption that FEM will be split into 2 parts:

  • static library with base implementation for FEs
  • static / dynamic versions for FEM itself
  • static version of FEM is used in IE, dynamic is used by MO / end users

#endif

template <typename T>
bool endsWith(const std::basic_string<T>& str, const std::basic_string<T>& suffix)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it looks like it should be a common library. Could you add TODO to move such utility methods to common library and create a task?

@slyalin slyalin merged commit 960ba48 into openvinotoolkit:master Jul 19, 2021
FRONT_END_GENERAL_CHECK(m_fw_ptr->ParseFromIstream(&pb_stream),
"Model can't be parsed");

loadPlaces();
loadConsts(weights_stream ? "" : path, weights_stream.get());
loadConsts(weights_stream && weights_stream.is_open() ? std::basic_string<T>{} : path,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nosovmik @mvafin This code only works with pdmodel & pdiparam files. However, there are legacy __model__ model files. If using __model__ The weights_stream is actually not valid.

Suggested change
loadConsts(weights_stream && weights_stream.is_open() ? std::basic_string<T>{} : path,
loadConsts(weights_stream && weights_stream.is_open() ? std::basic_string<T>{} : path,
weights_stream && weights_stream.is_open() ? &weights_stream : nullptr);

rnugmanx pushed a commit to rnugmanx/openvino that referenced this pull request Aug 26, 2021
…oolkit#6358)

* Rework model loading in FE manager, implement PDPD probing

* Fix build

* Fix build

* Fix build

* Fix unicode

* Fix merge issues

* Fix codestyle

* Read frontends path from frontend_manager library location

* Fix codestyle

* Fix FE dependency

* Fix dependencies

* Fix codestyle

* Check if model file exists

* Revert adding model to lfs

* Add test model

* Fix cmake dependencies

* Apply review feedback

* Revert pugixml

* make getFrontendLibraryPath not public API

* Fix codestyle

* Apply fix from Ilya Lavrenov

* Add FE dependency in legacy tests

* Remove not needed dependency

* Better support Unicode

* Fix build

* Fix build

* Fix build

* Add dependency foe deprecated tests

* Fix dependency

* Fix typo

* Revert adding FE dependency to IESharedTests

* Remove relative paths from frontend unit tests

* Apply review feedback

* Fix typo

* Return allow-undefined, since kmb dependecies fail to link

* Fix merge conflict

* Compare functions in reader tests

* Simplify code to load from variants

* Remove supported_by_arguments from public api

* Fix codestyle

* Fix build

* Compare names in reader tests

* Fix wchar in variant

Co-authored-by: Ilya Churaev <[email protected]>
andrei-cv pushed a commit to andrei-cv/openvino that referenced this pull request Aug 30, 2021
…oolkit#6358)

* Rework model loading in FE manager, implement PDPD probing

* Fix build

* Fix build

* Fix build

* Fix unicode

* Fix merge issues

* Fix codestyle

* Read frontends path from frontend_manager library location

* Fix codestyle

* Fix FE dependency

* Fix dependencies

* Fix codestyle

* Check if model file exists

* Revert adding model to lfs

* Add test model

* Fix cmake dependencies

* Apply review feedback

* Revert pugixml

* make getFrontendLibraryPath not public API

* Fix codestyle

* Apply fix from Ilya Lavrenov

* Add FE dependency in legacy tests

* Remove not needed dependency

* Better support Unicode

* Fix build

* Fix build

* Fix build

* Add dependency foe deprecated tests

* Fix dependency

* Fix typo

* Revert adding FE dependency to IESharedTests

* Remove relative paths from frontend unit tests

* Apply review feedback

* Fix typo

* Return allow-undefined, since kmb dependecies fail to link

* Fix merge conflict

* Compare functions in reader tests

* Simplify code to load from variants

* Remove supported_by_arguments from public api

* Fix codestyle

* Fix build

* Compare names in reader tests

* Fix wchar in variant

Co-authored-by: Ilya Churaev <[email protected]>
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
…oolkit#6358)

* Rework model loading in FE manager, implement PDPD probing

* Fix build

* Fix build

* Fix build

* Fix unicode

* Fix merge issues

* Fix codestyle

* Read frontends path from frontend_manager library location

* Fix codestyle

* Fix FE dependency

* Fix dependencies

* Fix codestyle

* Check if model file exists

* Revert adding model to lfs

* Add test model

* Fix cmake dependencies

* Apply review feedback

* Revert pugixml

* make getFrontendLibraryPath not public API

* Fix codestyle

* Apply fix from Ilya Lavrenov

* Add FE dependency in legacy tests

* Remove not needed dependency

* Better support Unicode

* Fix build

* Fix build

* Fix build

* Add dependency foe deprecated tests

* Fix dependency

* Fix typo

* Revert adding FE dependency to IESharedTests

* Remove relative paths from frontend unit tests

* Apply review feedback

* Fix typo

* Return allow-undefined, since kmb dependecies fail to link

* Fix merge conflict

* Compare functions in reader tests

* Simplify code to load from variants

* Remove supported_by_arguments from public api

* Fix codestyle

* Fix build

* Compare names in reader tests

* Fix wchar in variant

Co-authored-by: Ilya Churaev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: inference OpenVINO Runtime library - Inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants