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

fix: skip setting seed when descriptor/fitting_net doesn't exist #1584

Merged
merged 1 commit into from
Jul 13, 2024
Merged
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
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 @@
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 @@
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