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 tests #146

Merged
merged 8 commits into from
Mar 14, 2024
Merged
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 .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
include:
- os: ubuntu-22.04
python-version: "3.8"
python-version: "3.9"
- os: ubuntu-22.04
python-version: "3.12"
- os: macos-11
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "metatensor-models"
dynamic = ["version"]
requires-python = ">=3.8"
requires-python = ">=3.9"

readme = "README.md"
license = {text = "BSD-3-Clause"}
Expand Down
2 changes: 1 addition & 1 deletion src/metatensor/models/utils/omegaconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def check_options_list(dataset_config: ListConfig) -> None:
# loop over ALL configs because we have check units for all elements in
# `dataset_config`
for actual_config in dataset_config:
# Perform consistentcy checks between config elements
# Perform consistency checks between config elements
actual_length_unit = actual_config["systems"]["length_unit"]
if actual_length_unit != desired_length_unit:
raise ValueError(
Expand Down
4 changes: 3 additions & 1 deletion tests/utils/data/targets/test_targets_ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def test_read_virial_warn(monkeypatch, tmp_path):
ase.io.write(filename, systems)

with pytest.warns(match="Found 9-long numerical vector"):
results = read_virial_ase(filename=filename, key="stress-9")
results = read_virial_ase(
filename=filename, key="stress-9", dtype=torch.get_default_dtype()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is float64 not working. Isn't the default one 64-bit?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyTorch default dtype if the user does nothing is float32

)

expected = -torch.tensor(systems.info["stress-9"])
expected = expected.reshape(-1, 3, 3, 1)
Expand Down
4 changes: 3 additions & 1 deletion tests/utils/test_compute_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def test_compute_model_loss():
model = soap_bpnn.Model(capabilities)
# model = torch.jit.script(model) # jit the model for good measure

systems = read_systems(RESOURCES_PATH / "alchemical_reduced_10.xyz")[:2]
systems = read_systems(
RESOURCES_PATH / "alchemical_reduced_10.xyz", dtype=torch.get_default_dtype()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above I rather would like to set an explicit dtype here.

)[:2]

gradient_samples = Labels(
names=["sample", "atom"],
Expand Down