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: 0 additions & 2 deletions mace/calculators/mace_torchsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ def _resolve_head(head: Optional[Union[str, int]], available_heads: list) -> int
return 0

def _setup_compile(self, compile_mode: str) -> None:
import torch._dynamo as dynamo

from mace.tools.compile import configure_autograd_for_compile, simplify

if self._enable_oeq:
Expand Down
15 changes: 12 additions & 3 deletions mace/tools/finetuning_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ def load_foundations_elements(
readout.linear_1.weight = torch.nn.Parameter(
model_readouts_one_linear_1_weight
)
if readout.linear_1.bias is not None and readout.linear_1.bias.numel() > 0:
if (
readout.linear_1.bias is not None
and readout.linear_1.bias.numel() > 0
):
model_readouts_one_linear_1_bias = (
model_foundations.readouts[i]
.linear_1.bias.view(-1)
Expand All @@ -259,7 +262,10 @@ def load_foundations_elements(
/ ((shape_input_1) / (shape_output_1)) ** 0.5
)
# if it has biases transfer them too
if readout.linear_mid.bias is not None and readout.linear_mid.bias.numel() > 0:
if (
readout.linear_mid.bias is not None
and readout.linear_mid.bias.numel() > 0
):
readout.linear_mid.bias = torch.nn.Parameter(
model_foundations.readouts[i]
.linear_mid.bias.repeat(len(model_heads))
Expand All @@ -277,7 +283,10 @@ def load_foundations_elements(
readout.linear_2.weight = torch.nn.Parameter(
model_readouts_one_linear_2_weight
)
if readout.linear_2.bias is not None and readout.linear_2.bias.numel() > 0:
if (
readout.linear_2.bias is not None
and readout.linear_2.bias.numel() > 0
):
model_readouts_one_linear_2_bias = (
model_foundations.readouts[i]
.linear_2.bias.view(-1)
Expand Down
8 changes: 6 additions & 2 deletions mace/tools/model_script_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ def configure_model(
args.compute_stress = True

if compute_virials or compute_stress:
if args.error_table in ['PerAtomRMSE','PerAtomMAE','TotalRMSE', 'TotalMAE']:
args.error_table = "PerAtomRMSEstressvirials" if 'RMSE' in args.error_table else 'PerAtomMAEstressvirials'
if args.error_table in ["PerAtomRMSE", "PerAtomMAE", "TotalRMSE", "TotalMAE"]:
args.error_table = (
"PerAtomRMSEstressvirials"
if "RMSE" in args.error_table
else "PerAtomMAEstressvirials"
)

output_args = {
"energy": args.compute_energy,
Expand Down
4 changes: 1 addition & 3 deletions tests/test_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,7 @@ def __init__(self, model_paths, device, default_dtype, **kwargs):
self.kwargs = kwargs

monkeypatch.setattr(foundations_models, "get_cache_dir", lambda: str(tmp_path))
monkeypatch.setattr(
foundations_models, "_urlretrieve_with_timeout", fake_download
)
monkeypatch.setattr(foundations_models, "_urlretrieve_with_timeout", fake_download)
monkeypatch.setattr(foundations_models, "MACECalculator", DummyCalculator)

kwargs = {"device": "cpu"}
Expand Down
Loading