pipeline¶
pipeline ¶
Attributes¶
Classes¶
Pipeline ¶
Abstract inference pipeline (async version).
A pipeline combines: - Preprocessing: Convert raw input to model-ready format - Inference: Run model inference via runtime - Postprocessing: Convert raw output to structured result
Example
Initialize pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
runtime | Runtime[P, R] | Inference runtime. | required |
batch_strategy | BatchStrategy[P, R] | None | Optional batching strategy for improved throughput. | None |
Source code in inferflow/asyncio/pipeline/__init__.py
Attributes¶
Functions¶
preprocess abstractmethod async ¶
preprocess(input: ImageInput) -> P
Preprocess raw input into model-ready format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input | ImageInput | Raw input (image bytes, numpy array, PIL Image, etc.) | required |
Returns:
| Type | Description |
|---|---|
P | Preprocessed input ready for inference. |
Source code in inferflow/asyncio/pipeline/__init__.py
postprocess abstractmethod async ¶
infer async ¶
Run inference on preprocessed input.
This method automatically uses batching if a batch strategy is configured.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preprocessed | P | Preprocessed input. | required |
Returns:
| Type | Description |
|---|---|
R | Raw inference result. |
Source code in inferflow/asyncio/pipeline/__init__.py
__call__ async ¶
__call__(input: ImageInput) -> O
End-to-end inference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input | ImageInput | Raw input. | required |
Returns:
| Type | Description |
|---|---|
O | Structured output. |
Source code in inferflow/asyncio/pipeline/__init__.py
serve async ¶
Start serving pipeline with automatic lifecycle management.
This method
- Loads the runtime
- Starts batch processing (if enabled)
- Yields the pipeline for inference
- Cleans up resources on exit