Skip to content

Add high-level task inference pipelines #7736

Description

@svick

Is your feature request related to a problem? Please describe.
Hugging Face task pipelines provide a high-level path from application input to model result: preprocessing and tokenization, batched model invocation, and task-specific post-processing. In .NET, users migrating custom models generally have to compose these stages themselves and understand the different tokenizer, tensor, and inference-runtime APIs involved.

This makes otherwise common inference scenarios substantially harder to implement correctly and efficiently, especially for teams migrating from Python. #7384 can document how to assemble a pipeline, but it does not track providing a reusable product abstraction.

Describe the solution you'd like
Provide reusable, backend-aware inference pipeline abstractions for common tasks, beginning with a narrowly scoped task such as text classification. A pipeline should be able to:

  • Accept single inputs and batches.
  • Apply the configured tokenizer and produce the model's required inputs, including masks and token-type IDs where applicable.
  • Invoke a supported model backend without unnecessary conversions or copies.
  • Apply task-specific post-processing such as softmax, score selection, and label mapping.
  • Expose configuration and lower-level results for callers that need to customize individual stages.
  • Permit alternative tokenizer and model-runner implementations rather than coupling the abstraction to one model format.

The initial design could establish composable preprocessing, model-execution, and post-processing contracts before adding more task-specific pipelines.

Describe alternatives you've considered
Applications can implement their own pipeline for each model and task. Samples and migration documentation reduce the discovery cost, but they do not provide shared behavior, extension points, validation, or a consistent performance-oriented implementation.

Additional context
This request was identified while splitting the feedback in #7383, which originated in microsoft/semantic-kernel#9793. The original example was equivalent functionality to Hugging Face's TextClassificationPipeline, not necessarily API compatibility with that Python type.

Note

This issue was drafted with AI assistance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-MetaProject planning, governance, and repository-wide coordinationenhancementNew feature or requestuntriagedNew issue has not been triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions