Skip to content

Commit 829142e

Browse files
authored
Faster tests (#579)
1 parent fd6d518 commit 829142e

File tree

6 files changed

+30
-5
lines changed

6 files changed

+30
-5
lines changed

.github/workflows/architecture-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
tests:
11+
name: ${{ matrix.architecture-name }}
1112
strategy:
1213
matrix:
1314
include:

tests/cli/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
MODEL_PATH = RESOURCES_PATH / "model-32-bit.pt"
1616
MODEL_PATH_64_BIT = RESOURCES_PATH / "model-64-bit.ckpt"
1717
OPTIONS_PATH = RESOURCES_PATH / "options.yaml"
18+
OPTIONS_NANOPET_PATH = RESOURCES_PATH / "options-nanopet.yaml"

tests/cli/test_train_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
DATASET_PATH_QM7X,
2828
DATASET_PATH_QM9,
2929
MODEL_PATH_64_BIT,
30+
OPTIONS_NANOPET_PATH,
3031
OPTIONS_PATH,
3132
RESOURCES_PATH,
3233
)
@@ -114,7 +115,7 @@ def test_train(capfd, monkeypatch, tmp_path, output):
114115
assert "train" in stdout_log
115116
assert "energy" in stdout_log
116117
assert "with index" not in stdout_log # index only printed for more than 1 dataset
117-
assert "Running final evaluation with batch size 2" in stdout_log
118+
assert "Running final evaluation with batch size 16" in stdout_log
118119

119120
# Open the CSV log file and check if the logging is correct
120121
csv_glob = glob.glob("outputs/*/*/train.csv")
@@ -667,8 +668,7 @@ def test_train_generic_target_metatensor(monkeypatch, tmp_path, with_scalar_part
667668
)
668669

669670
# run training with original options
670-
options = OmegaConf.load(OPTIONS_PATH)
671-
options["architecture"]["name"] = "experimental.nanopet"
671+
options = OmegaConf.load(OPTIONS_NANOPET_PATH)
672672
options["training_set"]["systems"]["read_from"] = "qm7x_reduced_100.xyz"
673673
options["training_set"]["targets"] = {
674674
"mtt::polarizability": {

tests/resources/generate-outputs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cd $ROOT_DIR
99

1010
mtt train options.yaml -o model-32-bit.pt -r base_precision=32 # > /dev/null
1111
mtt train options.yaml -o model-64-bit.pt -r base_precision=64 # > /dev/null
12-
mtt train options.yaml -o model-no-extensions.pt -r architecture.name=experimental.nanopet # > /dev/null
12+
mtt train options-nanopet.yaml -o model-no-extensions.pt # > /dev/null
1313

1414
# upload results to private HF repo if token is set
1515
if [ -n "${HUGGINGFACE_TOKEN_METATRAIN:-}" ]; then

tests/resources/options-nanopet.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
seed: 42
2+
3+
architecture:
4+
name: experimental.nanopet
5+
training:
6+
batch_size: 16
7+
num_epochs: 1
8+
9+
training_set:
10+
systems:
11+
read_from: qm9_reduced_100.xyz
12+
length_unit: angstrom
13+
targets:
14+
energy:
15+
key: U0
16+
unit: eV
17+
18+
test_set: 0.5
19+
validation_set: 0.1

tests/resources/options.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ seed: 42
33
architecture:
44
name: soap_bpnn
55
training:
6-
batch_size: 2
6+
batch_size: 16
77
num_epochs: 1
8+
model:
9+
soap:
10+
max_radial: 4
11+
max_angular: 2
812

913
training_set:
1014
systems:

0 commit comments

Comments
 (0)