Skip to content

steps.base.model.builder

builder

Functions:

Name Description
build_model

Instantiate and initialize a model for training or inference.

build_model(model_cls=Model, pretrained_weights_name=None, trained_weights_name=None, config_name=None, exported_weights_name=None)

Instantiate and initialize a model for training or inference.

This step constructs a Model object using the provided model class and the currently active pipeline context. It supports initializing the model with various types of weights, such as pretrained, trained, or exported weights, and optionally includes a configuration file.

The method also ensures that any required weight files are downloaded to the appropriate local directory as defined by the context.

Parameters:

Name Type Description Default

model_cls

type[TModel]

The model class to instantiate. Defaults to the base Model class.

Model

pretrained_weights_name

str

The name of pretrained weights to load into the model.

None

trained_weights_name

str

The name of previously trained weights to resume training or evaluate.

None

config_name

str

The name of the configuration file to initialize the model.

None

exported_weights_name

str

The name of exported weights used for inference or deployment.

None

Returns:

Name Type Description
TModel TModel

An initialized model instance with the appropriate weights loaded.