Skip to content

Commit

Permalink
Fixes nested YAML config loading from the ASE calculator (#585)
Browse files Browse the repository at this point in the history
* Fixes nested yaml config loading from the ase calculator

* Install libarchive on mac builds

* Revert "Install libarchive on mac builds"

This reverts commit d3daddd.

* debugging circleci

* disregard coverage ci failures

* update thresh

* remove github checks

* codecov debug

* make codecov informational, not ci blocking

* ci debug

---------

Co-authored-by: Muhammed Shuaibi <[email protected]>
  • Loading branch information
abhshkdz and mshuaibii authored Oct 4, 2023
1 parent 82237be commit 6d19ba1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ commands:
# Conda configuration
conda config --set always_yes yes --set auto_update_conda false
# Update conda
conda update conda
conda install mamba -n base -c conda-forge
# Install ocp conda env
conda create --name ocp-models --clone base
Expand Down
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
github_checks: false
28 changes: 15 additions & 13 deletions ocpmodels/common/relaxation/ase_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@
"""
import copy
import logging
import os
from typing import Dict, Optional

import torch
import yaml
from ase import Atoms
from ase.calculators.calculator import Calculator
from ase.calculators.singlepoint import SinglePointCalculator as sp
from ase.constraints import FixAtoms

from ocpmodels.common.registry import registry
from ocpmodels.common.utils import setup_imports, setup_logging
from ocpmodels.common.utils import load_config, setup_imports, setup_logging
from ocpmodels.datasets import data_list_collater
from ocpmodels.preprocessing import AtomsToGraphs

Expand Down Expand Up @@ -98,18 +96,22 @@ def __init__(
checkpoint = None
if config_yml is not None:
if isinstance(config_yml, str):
config = yaml.safe_load(open(config_yml, "r"))

if "includes" in config:
for include in config["includes"]:
# Change the path based on absolute path of config_yml
path = os.path.join(
config_yml.split("configs")[0], include
)
include_config = yaml.safe_load(open(path, "r"))
config.update(include_config)
config, duplicates_warning, duplicates_error = load_config(
config_yml
)
if len(duplicates_warning) > 0:
logging.warning(
f"Overwritten config parameters from included configs "
f"(non-included parameters take precedence): {duplicates_warning}"
)
if len(duplicates_error) > 0:
raise ValueError(
f"Conflicting (duplicate) parameters in simultaneously "
f"included configs: {duplicates_error}"
)
else:
config = config_yml

# Only keeps the train data that might have normalizer values
if isinstance(config["dataset"], list):
config["dataset"] = config["dataset"][0]
Expand Down

0 comments on commit 6d19ba1

Please sign in to comment.