epbd_bert.dnabert2_epbd_crossattn package#

Submodules#

epbd_bert.dnabert2_epbd_crossattn.configs module#

class epbd_bert.dnabert2_epbd_crossattn.configs.EPBDConfigs(*, batch_size: int = 32, num_workers: int = 1, learning_rate: float = 1e-05, weight_decay: float = 0.01, max_epochs: int = 5, d_model: int = 256, epbd_feature_channels: int = 1, epbd_embedder_kernel_size: int = 11, num_heads: int = 8, d_ff: int = 768, p_dropout: float = 0.1, need_weights: bool = False, n_classes: int = 690, best_model_monitor: str = 'val_loss', best_model_monitor_mode: str = 'min')[source]#

Bases: TrainingConfigs

best_model_monitor: str = 'val_loss'#
best_model_monitor_mode: str = 'min'#
d_ff: int = 768#
d_model: int = 256#
epbd_embedder_kernel_size: int = 11#
epbd_feature_channels: int = 1#
n_classes: int = 690#
need_weights: bool = False#
num_heads: int = 8#
p_dropout: float = 0.1#
class epbd_bert.dnabert2_epbd_crossattn.configs.TrainingConfigs(*, batch_size: int = 32, num_workers: int = 1, learning_rate: float = 1e-05, weight_decay: float = 0.01, max_epochs: int = 5)[source]#

Bases: object

batch_size: int = 32#
learning_rate: float = 1e-05#
max_epochs: int = 5#
num_workers: int = 1#
weight_decay: float = 0.01#

epbd_bert.dnabert2_epbd_crossattn.model module#

class epbd_bert.dnabert2_epbd_crossattn.model.EPBDDnabert2Model(configs: EPBDConfigs)[source]#

Bases: LightningModule

_summary_

Parameters:

configs (EPBDConfigs) – _description_

calculate_loss(logits: Tensor, targets: Tensor) float[source]#

_summary_

Parameters:
  • logits (torch.Tensor) – _description_

  • targets (torch.Tensor) – _description_

Returns:

_description_

Return type:

float

configure_optimizers()[source]#

_summary_

Returns:

_description_

Return type:

_type_

forward(inputs)[source]#

_summary_

Parameters:

inputs (_type_) – _description_

Returns:

_description_

Return type:

_type_

classmethod load_pretrained_model(checkpoint_path, mode='eval')[source]#

_summary_

Parameters:
  • checkpoint_path (_type_) – _description_

  • mode (str, optional) – _description_. Defaults to “eval”.

Returns:

_description_

Return type:

_type_

on_validation_epoch_end()[source]#

_summary_

training_step(batch, batch_idx) float[source]#

_summary_

Parameters:
  • batch (_type_) – _description_

  • batch_idx (_type_) – _description_

Returns:

_description_

Return type:

float

validation_step(batch, batch_idx) float[source]#

_summary_

Parameters:
  • batch (_type_) – _description_

  • batch_idx (_type_) – _description_

Returns:

_description_

Return type:

float

class epbd_bert.dnabert2_epbd_crossattn.model.EPBDEmbedder(in_channels, d_model, kernel_size=9)[source]#

Bases: Module

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class epbd_bert.dnabert2_epbd_crossattn.model.MultiModalLayer(d_model, num_heads, d_ff, p_dropout=0.3)[source]#

Bases: Module

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(epbd_embedding, seq_embedding, key_padding_mask=None)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class epbd_bert.dnabert2_epbd_crossattn.model.PoolingLayer(d_model: int, dropout: float = 0.3)[source]#

Bases: Module

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class epbd_bert.dnabert2_epbd_crossattn.model.PositionWiseFeedForward(d_model, d_ff)[source]#

Bases: Module

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

epbd_bert.dnabert2_epbd_crossattn.test module#

epbd_bert.dnabert2_epbd_crossattn.test.compute_predictions(model, dl: DataLoader, output_preds_path: str, compute_again=False)[source]#

epbd_bert.dnabert2_epbd_crossattn.train_lightning module#

Module contents#