onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

[WIP] Csharp bindings for on-device training APIs

Open ashbhandare opened this issue 3 years ago • 1 comments

DO NOT REVIEW. This PR adds support for csharp bindings for on-device training APIs

ashbhandare avatar Aug 01 '22 17:08 ashbhandare

Would you like to move training source code into a subfolder?


In reply to: 1201722117

yuslepukhin avatar Aug 01 '22 21:08 yuslepukhin

      "retrieve the training APIs.\n");

We would like to make sure no exception propagates across C API boundaries. No one will see this message, nullptr will be returned and the process would crash without any meaningful explanation. It will be a GH issue. Also, it is not clear how a ptr can eever be returned across the language boundaries. These structures should always be return by value and its structure should match the C# structure. We need either an alternative error reporting mechanism OR, better yet, make sure this is never called from C# in inference builds.


In reply to: 1216921870


Refers to: onnxruntime/core/session/onnxruntime_c_api.cc:2258 in 60576e8. [](commit_id = 60576e806629c0423f9fe78e2d89c7b53a7fbbc1, deletion_comment = False)

yuslepukhin avatar Aug 16 '22 17:08 yuslepukhin

execution_providers.emplace_back(std::move(factory->CreateProvider()));

move is not necessary here


In reply to: 1228928558


Refers to: orttraining/orttraining/training_api/onnxruntime_training_c_api.cc:19 in 0168f52. [](commit_id = 0168f527559a116201e06ef9e59fb2355e2b5767, deletion_comment = False)

yuslepukhin avatar Aug 26 '22 20:08 yuslepukhin

@ashbhandare : Can you add the details around how to enable these bindings in the build to the PR description. Basically, build flag etc info + what to expect in an inference build? will the user get a descriptive error message or whether ort will crash? Also have you tested this scenario?

askhade avatar Aug 29 '22 18:08 askhade

  printf("Error message :%s\n", msg);                      \

I suspect no one will ever see these.


In reply to: 1230695997


In reply to: 1230695997


Refers to: orttraining/orttraining/test/training_api/common/synthetic_data_loader.cc:103 in 0168f52. [](commit_id = 0168f527559a116201e06ef9e59fb2355e2b5767, deletion_comment = False)

yuslepukhin avatar Aug 29 '22 18:08 yuslepukhin

#include <onnxruntime_cxx_api.h>

Please, remove


Refers to: orttraining/orttraining/test/training_api/common/synthetic_data_loader.h:16 in 0168f52. [](commit_id = 0168f527559a116201e06ef9e59fb2355e2b5767, deletion_comment = False)

yuslepukhin avatar Aug 29 '22 20:08 yuslepukhin

#include <onnxruntime_cxx_api.h>

Please, remove

Refers to: orttraining/orttraining/test/training_api/common/synthetic_data_loader.h:16 in 0168f52. [](commit_id = 0168f52, deletion_comment = False)

As discussed offline, will be taken care of in a separate PR


In reply to: 1232252550

ashbhandare avatar Aug 30 '22 22:08 ashbhandare

@ashbhandare : Can you add the details around how to enable these bindings in the build to the PR description. Basically, build flag etc info + what to expect in an inference build? will the user get a descriptive error message or whether ort will crash? Also have you tested this scenario?

I have added description of how to enable the bindings and the tests. In the Inference native build, while trying to use the APIs, user will get an error message like "System.InvalidOperationException : Training is disabled in the current build".

ashbhandare avatar Aug 31 '22 00:08 ashbhandare

Has this been abandoned? Any news of c# training roadmap?

Are there any builds with c# training?

elephantpanda avatar Aug 06 '23 22:08 elephantpanda