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

Correct assignment of head #761

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion mace/cli/preprocess_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def multi_valid_hdf5(process, args, split_valid, drop_last):

def multi_test_hdf5(process, name, args, split_test, drop_last):
with h5py.File(
args.h5_prefix + "test/" + name + "_" + str(process) + ".h5", "w"
args.h5_prefix + "test/" + name + "/" + "test_" + str(process) + ".h5", "w"
) as f:
f.attrs["drop_last"] = drop_last
save_configurations_as_HDF5(split_test[process], process, f)
Expand Down Expand Up @@ -268,6 +268,8 @@ def run(args: argparse.Namespace):
if args.test_file is not None:
logging.info("Preparing test sets")
for name, subset in collections.tests:
if not os.path.exists(args.h5_prefix + "test/" + name):
os.makedirs(args.h5_prefix + "test/" + name)
drop_last = False
if len(subset) % 2 == 1:
drop_last = True
Expand Down
4 changes: 2 additions & 2 deletions mace/cli/run_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import argparse
import ast
import glob
import json
import logging
import os
from copy import deepcopy
from glob import glob
from pathlib import Path
from typing import List, Optional

Expand Down Expand Up @@ -706,7 +706,7 @@ def run(args: argparse.Namespace) -> None:
else:
test_folders = glob(head_config.test_dir + "/*")
for folder in test_folders:
name = os.path.splitext(os.path.basename(test_file))[0]
name = os.path.splitext(os.path.basename(folder))[0]
test_sets[name] = data.dataset_from_sharded_hdf5(
folder, r_max=args.r_max, z_table=z_table, heads=heads, head=head_config.head_name
)
Expand Down
3 changes: 1 addition & 2 deletions mace/data/hdf5_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def __getitem__(self, index):
pbc=unpack_value(subgrp["pbc"][()]),
cell=unpack_value(subgrp["cell"][()]),
)
if config.head is None:
config.head = self.kwargs.get("head")
config.head = self.kwargs.get("head", "Default")
atomic_data = AtomicData.from_config(
config,
z_table=self.z_table,
Expand Down
Loading