pub trait ModelLoadingBackend: BackendProvider {
type LoadOptions;
type SelectedPreparation;
type ConfigurationResolver: ModelConfigurationResolver;
// Required methods
fn configuration_resolver(&self) -> &Self::ConfigurationResolver;
fn preparation_policy(
&self,
options: &Self::LoadOptions,
) -> Result<PreparationPolicy, Self::Error>;
fn select_preparation(
&self,
inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
options: &Self::LoadOptions,
policy: PreparationPolicy,
) -> Result<Self::SelectedPreparation, Self::Error>;
fn session_capabilities(
&self,
inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
policy: PreparationPolicy,
) -> Result<SessionCapabilities, Self::Error>;
fn model_config(
&self,
plan: ModelPreparationPlan<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
selected: Self::SelectedPreparation,
) -> 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§
Sourcetype LoadOptions
type LoadOptions
Backend load policy exposed to a generic caller.
Sourcetype SelectedPreparation
type SelectedPreparation
Exact pre-materialization realization selected from the inspected artifact, caller request, and backend mechanisms.
Sourcetype ConfigurationResolver: ModelConfigurationResolver
type ConfigurationResolver: ModelConfigurationResolver
Architecture registry selected by this backend adapter.
Required Methods§
Sourcefn configuration_resolver(&self) -> &Self::ConfigurationResolver
fn configuration_resolver(&self) -> &Self::ConfigurationResolver
Returns the architecture-owned model configuration registry.
Sourcefn preparation_policy(
&self,
options: &Self::LoadOptions,
) -> Result<PreparationPolicy, Self::Error>
fn preparation_policy( &self, options: &Self::LoadOptions, ) -> Result<PreparationPolicy, Self::Error>
Resolves backend options into the policy used during neutral planning.
Sourcefn select_preparation(
&self,
inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
options: &Self::LoadOptions,
policy: PreparationPolicy,
) -> Result<Self::SelectedPreparation, Self::Error>
fn select_preparation( &self, inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>, options: &Self::LoadOptions, policy: PreparationPolicy, ) -> 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.
Sourcefn session_capabilities(
&self,
inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
policy: PreparationPolicy,
) -> Result<SessionCapabilities, Self::Error>
fn session_capabilities( &self, inspection: &ArtifactInspection<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>, policy: PreparationPolicy, ) -> Result<SessionCapabilities, Self::Error>
Derives exact session capabilities from header/configuration state only.
Sourcefn model_config(
&self,
plan: ModelPreparationPlan<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>,
selected: Self::SelectedPreparation,
) -> Result<Self::ModelConfig, Self::Error>
fn model_config( &self, plan: ModelPreparationPlan<<Self::ConfigurationResolver as ModelConfigurationResolver>::ArtifactPlan>, selected: Self::SelectedPreparation, ) -> 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".