Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt config for normalization layer in rnn #152

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mambular/base_models/tabularnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ..arch_utils.layer_utils.embedding_layer import EmbeddingLayer
from ..arch_utils.rnn_utils import ConvRNN
from ..arch_utils.get_norm_fn import get_normalization_layer
from dataclasses import replace


class TabulaRNN(BaseModel):
Expand All @@ -28,8 +29,6 @@ def __init__(
self.cat_feature_info = cat_feature_info
self.num_feature_info = num_feature_info

self.norm_f = get_normalization_layer(config)

self.rnn = ConvRNN(
model_type=self.hparams.get("model_type", config.model_type),
input_size=self.hparams.get("d_model", config.d_model),
Expand Down Expand Up @@ -82,6 +81,9 @@ def __init__(
self.hparams.get("dim_feedforward", config.dim_feedforward),
)

temp_config = replace(config, d_model=config.dim_feedforward)
self.norm_f = get_normalization_layer(temp_config)

def forward(self, num_features, cat_features):
"""
Defines the forward pass of the model.
Expand Down