Skip to content

Commit

Permalink
Update UnifiedPredictor to handle feature dimensions consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-ai-integration[bot] committed Nov 14, 2024
1 parent 5bfcdf8 commit 2e7620f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions models/analysis/multimodal_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ def __init__(self, hidden_size: int):
)

self.integration_network = nn.Sequential(
nn.Linear(2304, 1536), # 3 * 768-dim features
nn.Linear(768 * 3, 1536), # Concatenated features from all three modalities
nn.LayerNorm(1536), # Normalize combined features
nn.ReLU(),
nn.Dropout(0.1),
nn.Linear(1536, 768) # Match ESM2 dimensions
nn.Linear(1536, 768) # Final output dimension
)

self.confidence_estimator = nn.Sequential(
Expand All @@ -164,6 +165,13 @@ def forward(
# Transform function features to match dimensions
function_features = self.function_encoder(function_results['go_terms'])

# Ensure all features have the same dimensions before combining
batch_size = sequence_features.size(0)
seq_len = sequence_features.size(1)

# Reshape function features if needed
function_features = function_features.view(batch_size, seq_len, -1)

# Combine all features
combined_features = torch.cat([
sequence_features,
Expand Down

0 comments on commit 2e7620f

Please sign in to comment.