pixano_inference.configs.base
Core typed config classes and model params registry.
BaseModelParams(**data)
Bases: BaseModel
Base class for typed model parameters.
All models require at least a path (HuggingFace model ID or local checkpoint).
Extra fields are forbidden so that typos are caught at config-creation time.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
HuggingFace model ID or local checkpoint path. |
Source code in pydantic/main.py
DeploymentConfig(**data)
Bases: BaseModel
User-facing deployment settings.
Merges resource, autoscaling, and batch settings into a single flat class for convenience in Python config files.
Attributes:
| Name | Type | Description |
|---|---|---|
num_gpus |
float
|
Number of GPUs per replica. |
num_cpus |
float
|
Number of CPUs per replica. |
memory_mb |
int | None
|
Memory limit in MB. |
min_replicas |
int
|
Minimum number of replicas (0 for scale-to-zero). |
max_replicas |
int
|
Maximum number of replicas. |
target_num_ongoing_requests_per_replica |
int
|
Target ongoing requests per replica before scaling up. |
downscale_delay_s |
float
|
Delay in seconds before scaling down. |
upscale_delay_s |
float
|
Delay in seconds before scaling up. |
max_batch_size |
int
|
Maximum batch size for inference. |
batch_wait_timeout_s |
float
|
Timeout for waiting to fill batch. |
Source code in pydantic/main.py
ModelConfig(**data)
Bases: BaseModel
Full model configuration with typed validation.
This class resolves the model capability from the configured model class and
resolves model_params through the ModelParamsRegistry when a schema is
registered for the given model_class.
Accepts both strings and typed Python objects so config files can keep IDE support while still allowing concise string-based declarations.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Unique model name. Optional for HuggingFace models (auto-derived from path). |
model_class |
str | type
|
Registered model class name or class type (e.g. |
model_module |
str | None
|
Python module path to import before resolving model_class. |
model_params |
dict[str, Any] | BaseModelParams
|
Typed params or raw dict, auto-resolved via registry. |
deployment |
DeploymentConfig
|
Deployment settings. |
Source code in pydantic/main.py
capability
property
Capability derived from the configured model class.
model_class_name
property
Registered name of the configured model class.
resolved_name
property
Resolved deployment name for the configured model.
model_post_init(__context)
Resolve and validate the configured model class.
to_deployment_config()
Convert to the internal ModelDeploymentConfig used by Ray Serve.
Returns:
| Type | Description |
|---|---|
ModelDeploymentConfig
|
A |
Source code in pixano_inference/configs/base.py
ModelParamsRegistry
Registry mapping model class names to their params Pydantic schemas.
This lightweight registry allows validation of model_params without
importing heavy ML dependencies.
get(name)
classmethod
Get the params schema for a model class, or None if not registered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The model class name. |
required |
Returns:
| Type | Description |
|---|---|
type[BaseModelParams] | None
|
The params Pydantic model class, or None. |
Source code in pixano_inference/configs/base.py
has(name)
classmethod
Check if a params schema is registered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The model class name. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if registered. |
list_all()
classmethod
List all registered params schemas.
Returns:
| Type | Description |
|---|---|
dict[str, type[BaseModelParams]]
|
Dictionary of model class name to params schema. |
register(name)
classmethod
Decorator to register a params schema for a model class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The model class name (e.g. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[type[BaseModelParams]], type[BaseModelParams]]
|
The decorator function. |
Source code in pixano_inference/configs/base.py
ServerConfig(**data)
Bases: BaseModel
Top-level typed server configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
Host to bind to. |
port |
int
|
Port to serve on. |
num_cpus |
int | None
|
Total CPUs available to Ray. None means auto-detect. |
num_gpus |
int | None
|
Total GPUs available to Ray. None means auto-detect. |
pip_packages |
list[str] | None
|
Pip packages for Ray workers runtime environment. |
working_dir |
str | None
|
Working directory for Ray workers. |
models |
list[ModelConfig]
|
List of model configurations. |
Source code in pydantic/main.py
to_ray_serve_config()
Convert to the internal RayServeConfig.
Returns:
| Type | Description |
|---|---|
RayServeConfig
|
A |
Source code in pixano_inference/configs/base.py
register_model_params(name)
Convenience decorator for registering model params schemas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The model class name to register under. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[type[BaseModelParams]], type[BaseModelParams]]
|
The decorator function. |