From a99f8c75b5930d593474483d5ec94b5efbcd7599 Mon Sep 17 00:00:00 2001 From: zulissimeta <122578103+zulissimeta@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:14:48 -0700 Subject: [PATCH] first commit (#798) --- src/fairchem/core/common/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fairchem/core/common/utils.py b/src/fairchem/core/common/utils.py index 9b9c3a517..4dc04915b 100644 --- a/src/fairchem/core/common/utils.py +++ b/src/fairchem/core/common/utils.py @@ -49,9 +49,10 @@ DEFAULT_ENV_VARS = { # Expandable segments is a new cuda feature that helps with memory fragmentation during frequent allocations (ie: in the case of variable batch sizes). # see https://pytorch.org/docs/stable/notes/cuda.html. - "PYTORCH_CUDA_ALLOC_CONF" : "expandable_segments:True", + "PYTORCH_CUDA_ALLOC_CONF": "expandable_segments:True", } + # copied from https://stackoverflow.com/questions/33490870/parsing-yaml-in-python-detect-duplicated-keys # prevents loading YAMLS where keys have been overwritten class UniqueKeyLoader(yaml.SafeLoader): @@ -265,8 +266,8 @@ def _import_local_file(path: Path, *, project_root: Path) -> None: :type project_root: Path """ - path = path.resolve() - project_root = project_root.parent.resolve() + path = path.absolute() + project_root = project_root.parent.absolute() module_name = ".".join( path.absolute().relative_to(project_root.absolute()).with_suffix("").parts @@ -285,7 +286,7 @@ def setup_experimental_imports(project_root: Path) -> None: :param project_root: The root directory of the project (i.e., the "ocp" folder) """ - experimental_dir = (project_root / "experimental").resolve() + experimental_dir = (project_root / "experimental").absolute() if not experimental_dir.exists() or not experimental_dir.is_dir(): return @@ -298,8 +299,7 @@ def setup_experimental_imports(project_root: Path) -> None: for inc_dir in include_dirs: experimental_files.extend( - f.resolve().absolute() - for f in (experimental_dir / inc_dir).rglob("*.py") + f.absolute() for f in (experimental_dir / inc_dir).rglob("*.py") ) for f in experimental_files: