Skip to content

Commit

Permalink
first commit (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
zulissimeta authored Aug 8, 2024
1 parent bc1307f commit a99f8c7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/fairchem/core/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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:
Expand Down

0 comments on commit a99f8c7

Please sign in to comment.