microsoft / microsoft/onnxruntime

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

Open
#16,148 2 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Start with the linked .NET TPL Dataflow documentation and System.Threading.Tasks.Dataflow source, then compare its TaskScheduler behavior with ONNX Runtime's .NET model-loading and threading APIs. Done would be a documented, working example showing how to use an ONNX-exported model in the pipeline, including the intended model lifetime and per-thread behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.