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

[Feature Request] Example of using onnxruntime models within .net TPL data pipelines #16148

Open
vadimkantorov opened this issue May 29, 2023 · 2 comments
Labels
feature request request for unsupported feature or enhancement

Comments

@vadimkantorov
Copy link

vadimkantorov commented May 29, 2023

Describe the feature request

I have an existing TPL pipeline (https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.dataflow.dataflowblockoptions.taskscheduler?view=net-7.0 https://github.com/dotnet/runtime/tree/main/src/libraries/System.Threading.Tasks.Dataflow). I'd like to use CPU-backed ONNX models in its threads.

How can I do it properly?

I guess there should be some custom ThreadPool threads init function that loads the ONNX model?

If the functions are lightweight, then it's critical that every thread has its own loaded ONNX model and loads it only once

Describe scenario use case

Migrating existing TPL pipeline to using python/ONNX-exported graphs in its components

@vadimkantorov vadimkantorov added the feature request request for unsupported feature or enhancement label May 29, 2023
@vadimkantorov
Copy link
Author

Another question is whether onnxrt python package supports the imminent sub-interpreters / per-interpreter GIL: python/cpython#104210 (I guess mostly a question of managing global state / op registrations and so on)

@vadimkantorov
Copy link
Author

And one more question is that it would really be great to have an example of producer-consumer patterns of ONNXRT and TPL.

One pattern can be single-threaded ONNXRT GPU worker consuming inputs from a TPL queue (and putting outputs to another TPL queue). Another pattern can be multi-threaded ONNXRT CPU workers consuming inputs from a TPL queue (and putting outputs to another TPL queue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request request for unsupported feature or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant