Skip to content

Commit

Permalink
Add structure encoder to transform structure features to match sequen…
Browse files Browse the repository at this point in the history
…ce dimensions
  • Loading branch information
devin-ai-integration[bot] committed Nov 14, 2024
1 parent ddc0850 commit 2025439
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions models/analysis/multimodal_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ def __init__(self, hidden_size: int):
nn.Dropout(0.1)
)

# Transform structure features to match sequence dimensions
self.structure_encoder = nn.Sequential(
nn.Linear(3, 768), # Transform structure features to match dimensions
nn.LayerNorm(768), # Normalize features
nn.ReLU(),
nn.Dropout(0.1)
)

self.integration_network = nn.Sequential(
nn.Linear(768 * 3, 1536), # Concatenated features from all three modalities
nn.LayerNorm(1536), # Normalize combined features
Expand Down Expand Up @@ -171,6 +179,10 @@ def forward(
function_features = self.function_encoder(function_results['go_terms'])
print(f"Transformed function features shape: {function_features.shape}")

# Transform structure features to match sequence dimensions
structure_features = self.structure_encoder(structure_features)
print(f"Transformed structure features shape: {structure_features.shape}")

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

0 comments on commit 2025439

Please sign in to comment.