cursus.steps.hyperparams.hyperparameters_bimodal

class BimodalModelHyperparameters(*, full_field_list, cat_field_list, tab_field_list, id_name, label_name, multiclass_categories, categorical_features_to_encode=<factory>, model_class='multimodal_bert', device=-1, header=0, lr=3e-05, batch_size=2, eval_batch_size_multiplier=2.0, max_epochs=3, metric_choices=['f1_score', 'auroc'], optimizer='SGD', class_weights=None, tokenizer, text_name, lr_decay=0.05, momentum=0.9, weight_decay=0.0, adam_epsilon=1e-08, warmup_steps=300, run_scheduler=True, val_check_interval=0.25, gradient_clip_val=1.0, fp16=False, use_gradient_checkpointing=False, early_stop_metric='val_loss', early_stop_patience=3, load_ckpt=False, smooth_factor=0.0, count_threshold=0, text_field_overwrite=False, chunk_trancate=True, max_total_chunks=3, max_sen_len=512, fixed_tokenizer_length=True, text_input_ids_key='input_ids', text_attention_mask_key='attention_mask', text_processing_steps=['dialogue_splitter', 'html_normalizer', 'emoji_remover', 'text_normalizer', 'dialogue_chunker', 'tokenizer'], num_channels=[100, 100], num_layers=2, dropout_keep=0.1, kernel_size=[3, 5, 7], is_embeddings_trainable=True, pretrained_embedding=True, reinit_layers=2, reinit_pooler=True, hidden_common_dim=100)[source]

Bases: ModelHyperparameters

Hyperparameters for bimodal model training (text + tabular), extending the base ModelHyperparameters.

Fields are organized into three tiers: 1. Tier 1: Essential User Inputs - fields that users must explicitly provide 2. Tier 2: System Inputs with Defaults - fields with reasonable defaults that can be overridden 3. Tier 3: Derived Fields - fields calculated from other fields (private attributes with properties)

tokenizer: str
text_name: str
model_class: str
lr_decay: float
momentum: float
weight_decay: float
adam_epsilon: float
warmup_steps: int
run_scheduler: bool
val_check_interval: float
gradient_clip_val: float
fp16: bool
use_gradient_checkpointing: bool
early_stop_metric: str
early_stop_patience: int
load_ckpt: bool
smooth_factor: float
count_threshold: int
text_field_overwrite: bool
chunk_trancate: bool
max_total_chunks: int
max_sen_len: int
fixed_tokenizer_length: bool
text_input_ids_key: str
text_attention_mask_key: str
text_processing_steps: List[str]
num_channels: List[int]
num_layers: int
dropout_keep: float
kernel_size: List[int]
is_embeddings_trainable: bool
pretrained_embedding: bool
reinit_layers: int
reinit_pooler: bool
hidden_common_dim: int
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'protected_namespaces': (), 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property model_config_dict: Dict[str, Any]

Get complete model configuration dictionary derived from hyperparameters.

property tokenizer_config: Dict[str, Any]

Get tokenizer configuration dictionary derived from hyperparameters.

validate_bimodal_hyperparameters()[source]

Validate bimodal model-specific hyperparameters and initialize derived fields.

get_public_init_fields()[source]

Override get_public_init_fields to include bimodal-specific derived fields. Gets a dictionary of public fields suitable for initializing a child config.

get_trainer_config()[source]

Get trainer configuration dictionary for PyTorch Lightning. This combines various trainer-related settings.

Returns:

Configuration dictionary for trainer

Return type:

Dict[str, Any]

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

full_field_list: List[str]
cat_field_list: List[str]
tab_field_list: List[str]
id_name: str
label_name: str
multiclass_categories: List[int | str]
categorical_features_to_encode: List[str]
device: int
header: int
lr: float
batch_size: int
eval_batch_size_multiplier: float
max_epochs: int
metric_choices: List[str]
optimizer: str
class_weights: List[float] | None