Api - BioNeMo Framework (original) (raw)

ModelOutput = TypeVar('ModelOutput', Tensor, list[Tensor], tuple[Tensor], dict[str, Tensor], covariant=True) module-attribute

A Model's forward pass may produce a tensor, multiple tensors, or named tensors.

BionemoModelConfig

Bases: `Generic[[ModelType](../model/config/#bionemo.core.model.config.ModelType "ModelType = TypeVar('ModelType', bound=Model)

  module-attribute

(bionemo.core.model.config.ModelType)")], ABC`

An abstract class for model configuration.

Source code in bionemo/core/model/config.py

class BionemoModelConfig(Generic[ModelType], ABC): """An abstract class for model configuration.""" @abstractmethod def configure_model(self, *args, **kwargs) -> Model: """Configures the model.""" raise NotImplementedError()

configure_model(*args, **kwargs) abstractmethod

Configures the model.

Source code in bionemo/core/model/config.py

@abstractmethod def configure_model(self, *args, **kwargs) -> Model: """Configures the model.""" raise NotImplementedError()

BionemoTrainableModelConfig

Bases: `Generic[[ModelType](../model/config/#bionemo.core.model.config.ModelType "ModelType = TypeVar('ModelType', bound=Model)

  module-attribute

(bionemo.core.model.config.ModelType)"), [LossType](../model/config/#bionemo.core.model.config.LossType "LossType = TypeVar('LossType')

  module-attribute

(bionemo.core.model.config.LossType)")], BionemoModelConfig[[ModelType](../model/config/#bionemo.core.model.config.ModelType "ModelType = TypeVar('ModelType', bound=Model)

  module-attribute

(bionemo.core.model.config.ModelType)")]`

An abstract class for trainable model configuration.

Source code in bionemo/core/model/config.py

class BionemoTrainableModelConfig(Generic[ModelType, LossType], BionemoModelConfig[ModelType]): """An abstract class for trainable model configuration.""" @abstractmethod def get_loss_reduction_class(self) -> Type[LossType]: """Returns the loss reduction class.""" raise NotImplementedError()

get_loss_reduction_class() abstractmethod

Returns the loss reduction class.

Source code in bionemo/core/model/config.py

@abstractmethod def get_loss_reduction_class(self) -> Type[LossType]: """Returns the loss reduction class.""" raise NotImplementedError()

Model

Bases: `Protocol[[ModelOutput](../model/config/#bionemo.core.model.config.ModelOutput "ModelOutput = TypeVar('ModelOutput', Tensor, list[Tensor], tuple[Tensor], dict[str, Tensor], covariant=True)

  module-attribute

(bionemo.core.model.config.ModelOutput)")]`

Lightweight interface for a model: must have a forward method.

Source code in bionemo/core/model/config.py

class Model(Protocol[ModelOutput]): """Lightweight interface for a model: must have a forward method.""" def forward(self, *args, **kwargs) -> ModelOutput: """Prediction / forward-step for a model.""" ...

forward(*args, **kwargs)

Prediction / forward-step for a model.

Source code in bionemo/core/model/config.py

def forward(self, *args, **kwargs) -> ModelOutput: """Prediction / forward-step for a model.""" ...