Skip to content

Commit

Permalink
Fix bug with distributed training and fixed composition (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostedoyster authored Jul 22, 2024
1 parent cf8c65b commit e14207b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/metatrain/experimental/soap_bpnn/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,18 @@ def train(
"user-supplied composition weights"
)
cur_weight_dict = self.hypers["fixed_composition_weights"][target_name]
atomic_types = set()
atomic_types = []
num_species = len(cur_weight_dict)
fixed_weights = torch.zeros(num_species, dtype=dtype, device=device)

for ii, (key, weight) in enumerate(cur_weight_dict.items()):
atomic_types.add(key)
atomic_types.append(key)
fixed_weights[ii] = weight

if not set(atomic_types) == model.atomic_types:
if (
not set(atomic_types)
== (model.module if is_distributed else model).atomic_types
):
raise ValueError(
"Supplied atomic types are not present in the dataset."
)
Expand Down

0 comments on commit e14207b

Please sign in to comment.