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

Add Onnx2NeoML executable #507

Merged
merged 9 commits into from
Dec 22, 2021
Merged

Add Onnx2NeoML executable #507

merged 9 commits into from
Dec 22, 2021

Conversation

zimka
Copy link
Contributor

@zimka zimka commented Dec 20, 2021

В PR добавляется простейшая исполняемая обертка вокруг NeoOnnx::LoadFromOnnx.

Сейчас NeoOnnx предоставляет программное api для конвертации Onnx в CDnn (NeoOnnx::LoadFromOnnx).
Т.к. NeoOnnx нельзя собрать вместе с FineObjects, использовать это api в проектах на основе FineObj сложно. Для конвертации onnx-сети приходится создавать новое временное приложение, что не очень удобно.
С другой стороны, в процессе конвертации нет никаких параметров/флагов/настроек, и, например, в tf2onnx можно конвертировать и через cli, и через программный api.
Здесь по аналогии добавлен executable, который выполняет конвертацию.
Протестировано на нейронке с одним Dense слоем.

@zimka zimka marked this pull request as draft December 20, 2021 15:43
@zimka zimka marked this pull request as ready for review December 20, 2021 16:25
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
@@ -82,7 +82,7 @@ endif()
if(NeoML_INSTALL)
set(INSTALLED_TARGETS NeoML NeoMathEngine)
if(NeoOnnx_BUILD)
list(APPEND INSTALLED_TARGETS NeoOnnx)
list(APPEND INSTALLED_TARGETS NeoOnnx )
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. (мелочь) надо убрать пробел
  2. (не мелочь) надо добавить эту утилиту в install. Как пример:
        if(TARGET Onnx2NeoML)
            list(APPEND INSTALLED_TARGETS Onnx2NeoML)
        endif()

или NOT IOS NOT ANDROID

@@ -88,6 +88,9 @@ target_sources( ${PROJECT_NAME} PRIVATE
TensorLayout.h
TensorUtils.h
)
if(NOT ANDROID AND NOT IOS)
add_subdirectory(Onnx2NeoML)
Copy link
Contributor

@FedyuninV FedyuninV Dec 20, 2021

Choose a reason for hiding this comment

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

(мелочь) Я бы перенес либо в выше (где-нибудь сразу после add_library) либо в самый низ. Иначе как-то неочевидно, что посередине CMake который описывает сборку NeoOnnx внезапно затесалась доп. утилита.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ой, вообще лучше всю утилиту вынести в отдельную поддиректорию на уровень выше! А этот if перенести NeoML/NeoOnnx/CMakeLists.txt

Copy link
Contributor

@FedyuninV FedyuninV left a comment

Choose a reason for hiding this comment

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

Надо добавить утилиту в install.
Надо её расположить не внутри src а сбоку от src директории, на уровень выше.

Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
@zimka
Copy link
Contributor Author

zimka commented Dec 21, 2021

Перенес утилиту на уровень выше (в NeoOnnx из NeoOnnx/src), добавил в install кроме мобилок

@zimka zimka requested a review from FedyuninV December 21, 2021 14:03
@FedyuninV FedyuninV merged commit 2d0e109 into neoml-lib:master Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants