Skip to content
Open
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
2 changes: 1 addition & 1 deletion deepmd/utils/finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

log = logging.getLogger(__name__)

_IGNORED_DESCRIPTOR_KEYS = frozenset({"trainable"})
_IGNORED_DESCRIPTOR_KEYS = frozenset({"trainable", "seed", "use_amp"})
_MISSING = object()
_MAX_DESCRIPTOR_CONFIG_DIFFS = 20
_MAX_CONFIG_VALUE_LENGTH = 200
Expand Down
22 changes: 22 additions & 0 deletions source/tests/common/test_finetune_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,28 @@ def test_descriptor_config_warning_skips_default_only_difference(caplog):
assert caplog.text == ""


def test_descriptor_config_warning_skips_runtime_only_differences(monkeypatch, caplog):
monkeypatch.setattr(
finetune,
"_normalize_descriptor_for_compare",
lambda descriptor: descriptor,
)

runtime_only_differences = [
({"type": "se_e2_a", "seed": None}, {"type": "se_e2_a", "seed": 42}),
({"type": "dpa4c", "use_amp": False}, {"type": "dpa4c", "use_amp": True}),
]
for input_descriptor, pretrained_descriptor in runtime_only_differences:
caplog.clear()
with caplog.at_level(logging.WARNING):
finetune.warn_configuration_mismatch_during_finetune(
input_descriptor,
pretrained_descriptor,
)

assert caplog.text == ""


def test_descriptor_config_warning_falls_back_to_raw_if_normalization_fails(
monkeypatch, caplog
):
Expand Down