Skip to main content

hub_model_resource

Concrete ModelResourceProtocol backed by the Bitfount Hub.

This module provides HubModelResource, a lightweight adapter that satisfies ModelResourceProtocol by downloading model code (and optionally weights) from the Bitfount Hub at inference time.

Classes

HubModelResource

class HubModelResource(hub: BitfountHub, project_id: str | None = None):

Loads models from the Bitfount Hub for inference.

Implements ModelResourceProtocol.

Arguments

  • hub: An authenticated BitfountHub instance.
  • project_id: The project ID gating model access (may be None for publicly accessible models).

Methods


load_model

def load_model(    self,    model_ref: ModelInferenceConfig,    *,    datastructure: DataStructure,    schema: BitfountSchema,    batch_size: int | None,)> ModelProtocol:

Download and instantiate a model from the Hub.

Arguments

  • model_ref: The ModelInferenceConfig identifying the model (its model_ref, model_version and model_username).
  • datastructure: DataStructure for model initialisation.
  • schema: BitfountSchema for model initialisation.
  • batch_size: Batch size hint (passed to model constructor if supported).

Returns An instantiated model ready for inference.