Skip to content

Commit

Permalink
fix: skip setting seed when descriptor/fitting_net doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
njzjz committed Jul 13, 2024
1 parent 30bc1e5 commit c9734d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dpgen/generator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,9 @@ def make_train_dp(iter_index, jdata, mdata):
mdata["deepmd_version"]
) < Version("3"):
# 1.x
if jinput["model"]["descriptor"]["type"] == "hybrid":
if "descriptor" not in jinput["model"]:
pass

Check warning on line 587 in dpgen/generator/run.py

View check run for this annotation

Codecov / codecov/patch

dpgen/generator/run.py#L587

Added line #L587 was not covered by tests
elif jinput["model"]["descriptor"]["type"] == "hybrid":
for desc in jinput["model"]["descriptor"]["list"]:
desc["seed"] = random.randrange(sys.maxsize) % (2**32)
elif jinput["model"]["descriptor"]["type"] == "loc_frame":
Expand All @@ -592,9 +594,10 @@ def make_train_dp(iter_index, jdata, mdata):
jinput["model"]["descriptor"]["seed"] = random.randrange(
sys.maxsize
) % (2**32)
jinput["model"]["fitting_net"]["seed"] = random.randrange(sys.maxsize) % (
2**32
)
if "fitting_net" in jinput["model"]:
jinput["model"]["fitting_net"]["seed"] = random.randrange(
sys.maxsize
) % (2**32)
if "type_embedding" in jinput["model"]:
jinput["model"]["type_embedding"]["seed"] = random.randrange(
sys.maxsize
Expand Down

0 comments on commit c9734d7

Please sign in to comment.