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

change logic to catch missing outputs #859

Merged
merged 6 commits into from
Sep 19, 2024
Merged
Changes from 3 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: 5 additions & 1 deletion src/fairchem/core/trainers/ocp_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def _forward(self, batch):

## TODO: deprecate the following logic?
## Otherwise, assume target property is a derived output of the model. Construct the parent property
else:
elif self.output_targets[target_key] == "decomposition":
_max_rank = 0
for subtarget_key in self.output_targets[target_key]["decomposition"]:
_max_rank = max(
Expand Down Expand Up @@ -291,6 +291,10 @@ def _forward(self, batch):
cg_change_mat(_max_rank, self.device),
pred_irreps,
)
else:
raise AttributeError(
f"Output target: '{target_key}', not found in model outputs: {list(out.keys())}"
)

### not all models are consistent with the output shape
### reshape accordingly: num_atoms_in_batch, -1 or num_systems_in_batch, -1
Expand Down