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

Add mixing layers to SO3net #451

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/schnetpack/configs/callbacks/earlystopping.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
early_stopping:
_target_: pytorch_lightning.callbacks.EarlyStopping
monitor: "val_loss" # name of the logged metric which determines when model is improving
patience: 1000 # how many epochs of not improving until training stops
patience: 100 # how many epochs of not improving until training stops
mode: "min" # can be "max" or "min"
min_delta: 0.0 # minimum change in the monitored metric needed to qualify as an improvement
min_delta: 1e-5 # minimum change in the monitored metric needed to qualify as an improvement
16 changes: 14 additions & 2 deletions src/schnetpack/representation/so3net.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ def __init__(
self.n_interactions,
shared_interactions,
)
self.mixings = snn.replicate_module(
self.mixings1 = snn.replicate_module(
lambda: nn.Linear(n_atom_basis, n_atom_basis, bias=False),
self.n_interactions,
shared_interactions,
)
self.mixings2 = snn.replicate_module(
lambda: nn.Linear(n_atom_basis, n_atom_basis, bias=False),
self.n_interactions,
shared_interactions,
)
self.mixings3 = snn.replicate_module(
lambda: nn.Linear(n_atom_basis, n_atom_basis, bias=False),
self.n_interactions,
shared_interactions,
Expand Down Expand Up @@ -100,9 +110,11 @@ def forward(self, inputs: Dict[str, torch.Tensor]):

for i in range(self.n_interactions):
dx = self.so3convs[i](x, radial_ij, Yij, cutoff_ij, idx_i, idx_j)
ddx = self.mixings[i](dx)
ddx = self.mixings1[i](dx)
dx = self.so3product(dx, ddx)
dx = self.mixings2[i](dx)
dx = self.gatings[i](dx)
dx = self.mixings3[i](dx)
x = x + dx

inputs["scalar_representation"] = x[:, 0]
Expand Down