Skip to main content

ModelLoadingBackend

Trait ModelLoadingBackend 

Source
pub trait ModelLoadingBackend: BackendProvider {
    type LoadOptions;
    type SelectedPreparation;
    type ConfigurationResolver: ModelConfigurationResolver;

    // Required methods
    fn configuration_resolver(&self) -> &Self::ConfigurationResolver;
    fn select_preparation(
        &self,
        inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
        options: &Self::LoadOptions,
    ) -> Result<Self::SelectedPreparation, Self::Error>;
    fn selected_preparation_admission(
        &self,
        selected: &Self::SelectedPreparation,
    ) -> PreparationAdmission;
    fn model_config(
        &self,
        selected: SelectedModelPreparation<Self>,
    ) -> Result<Self::ModelConfig, Self::Error>;
}
Expand description

Artifact-loading extension for a selected whole-model backend.

Core owns checkpoint inspection and preparation planning. Implementations translate the resulting neutral plan and their associated load options into the backend’s concrete BackendProvider::ModelConfig. Tensor materialization remains entirely inside BackendProvider::prepare_model.

Required Associated Types§

Source

type LoadOptions

Backend load policy exposed to a generic caller.

Source

type SelectedPreparation

Exact pre-materialization realization selected from the inspected artifact, caller request, and backend mechanisms.

Source

type ConfigurationResolver: ModelConfigurationResolver

Architecture registry selected by this backend adapter.

Required Methods§

Source

fn configuration_resolver(&self) -> &Self::ConfigurationResolver

Returns the architecture-owned model configuration registry.

Source

fn select_preparation( &self, inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>, options: &Self::LoadOptions, ) -> Result<Self::SelectedPreparation, Self::Error>

Intersects normalized architecture requirements and the caller request with backend support, returning the sole construction-policy handoff.

Core deliberately does not infer architecture capabilities from a coarse model-family identity. Implementations must fail closed for requested routes that the exact normalized architecture or backend cannot realize.

Source

fn selected_preparation_admission( &self, selected: &Self::SelectedPreparation, ) -> PreparationAdmission

Returns the exact portable admission retained by the authoritative selection.

Source

fn model_config( &self, selected: SelectedModelPreparation<Self>, ) -> Result<Self::ModelConfig, Self::Error>

Binds a neutral preparation plan and its authoritative selected realization to backend-owned materialization input.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§