Skip to main content

ModelFamilyProvider

Trait ModelFamilyProvider 

Source
pub trait ModelFamilyProvider:
    Send
    + Sync
    + 'static {
    type Config: Clone + Send + Sync + Serialize + DeserializeOwned + 'static;

    // Required methods
    fn family_id(&self) -> &ModelFamilyId;
    fn external_metadata_ids(&self) -> BTreeSet<ExternalModelMetadataId>;
    fn validate_config_identity(
        &self,
        raw: &Value,
        config: &Self::Config,
    ) -> Result<(), VNextError>;
    fn validated_external_metadata_id(
        &self,
        raw: &Value,
        config: &Self::Config,
    ) -> Result<ExternalModelMetadataId, VNextError>;
    fn parse_config(&self, raw: &Value) -> Result<Self::Config, VNextError>;
    fn weight_schema(
        &self,
        config: &Self::Config,
    ) -> Result<WeightSchema, VNextError>;
    fn numerical_profiles(
        &self,
        config: &Self::Config,
    ) -> Result<FamilyNumericalProfiles, VNextError>;
    fn semantic_program(
        &self,
        config: &Self::Config,
        profile: &NumericalExecutionProfile,
    ) -> Result<ModelProgram, VNextError>;
    fn semantic_metadata(
        &self,
        config: &Self::Config,
    ) -> Result<ModelSemanticMetadata, VNextError>;

    // Provided method
    fn specialize_weight_schema(
        &self,
        _config: &Self::Config,
        source: &WeightSchema,
        _profile: &NumericalExecutionProfile,
    ) -> Result<WeightSchema, VNextError> { ... }
}
Expand description

Compile-time model family provider with a typed, validated configuration.

Required Associated Types§

Required Methods§

Source

fn family_id(&self) -> &ModelFamilyId

Source

fn external_metadata_ids(&self) -> BTreeSet<ExternalModelMetadataId>

Source

fn validate_config_identity( &self, raw: &Value, config: &Self::Config, ) -> Result<(), VNextError>

Source

fn validated_external_metadata_id( &self, raw: &Value, config: &Self::Config, ) -> Result<ExternalModelMetadataId, VNextError>

Returns the exact external metadata identity represented by config. Every provider must make this selection explicit; core never assumes a singleton catalog row is the intended typed identity.

Source

fn parse_config(&self, raw: &Value) -> Result<Self::Config, VNextError>

Source

fn weight_schema( &self, config: &Self::Config, ) -> Result<WeightSchema, VNextError>

Source

fn numerical_profiles( &self, config: &Self::Config, ) -> Result<FamilyNumericalProfiles, VNextError>

Source

fn semantic_program( &self, config: &Self::Config, profile: &NumericalExecutionProfile, ) -> Result<ModelProgram, VNextError>

Source

fn semantic_metadata( &self, config: &Self::Config, ) -> Result<ModelSemanticMetadata, VNextError>

Provided Methods§

Source

fn specialize_weight_schema( &self, _config: &Self::Config, source: &WeightSchema, _profile: &NumericalExecutionProfile, ) -> Result<WeightSchema, VNextError>

Specialization may change logical decoding dtype, never the source’s physical components, layouts, dimensions or tensor identities.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§