pixano_inference.models.base
Shared base class for deployed inference models.
InferenceModel(config)
Bases: ABC
Abstract base class for all inference models deployed on Ray Serve.
Subclass this to implement custom inference models that can be deployed on Ray Serve.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
ModelDeploymentConfig
|
Model deployment configuration. |
required |
Source code in pixano_inference/models/base.py
capability
property
Capability handled by this model.
config
property
Model deployment configuration.
metadata
property
Model metadata. Override for custom metadata.
model_name
property
Unique model name.
load_model()
abstractmethod
Load model artifacts.
Called once in the Ray actor __init__. Implement this to load
weights, initialize processors, etc.
predict(input)
abstractmethod
Run inference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
BaseModel
|
Task-specific Input object (subclasses narrow this type). |
required |
Returns:
| Type | Description |
|---|---|
BaseModel
|
Task-specific Output object (subclasses narrow this type). |
Source code in pixano_inference/models/base.py
predict_batch(inputs)
Run inference on a batch of inputs.
Only used when the deployment sets max_batch_size > 1. The default runs
:meth:predict sequentially; override it to exploit true batched execution
(e.g. a single padded forward pass).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
list[BaseModel]
|
A list of task-specific Input objects. |
required |
Returns:
| Type | Description |
|---|---|
list[BaseModel]
|
A list of task-specific Output objects, one per input, in order. |