From 71f07b29c794a94e8544503b140aab4c736bb814 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Fri, 6 Oct 2023 11:21:44 +1300 Subject: [PATCH 1/2] Fix normalization on Windows --- allenact/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/allenact/main.py b/allenact/main.py index d1ad6d0b1..7b8b543f9 100755 --- a/allenact/main.py +++ b/allenact/main.py @@ -2,6 +2,7 @@ name.""" import os +import posixpath if "CUDA_DEVICE_ORDER" not in os.environ: # Necessary to order GPUs correctly in some cases @@ -370,9 +371,7 @@ def load_config(args) -> Tuple[ExperimentConfig, Dict[str, str]]: ), "The path '{}' does not seem to exist (your current working directory is '{}').".format( args.experiment_base, os.getcwd() ) - rel_base_dir = os.path.relpath( # Normalizing string representation of path - os.path.abspath(args.experiment_base), os.getcwd() - ) + rel_base_dir = posixpath.normpath(args.experiment_base) rel_base_dot_path = rel_base_dir.replace("/", ".") if rel_base_dot_path == ".": rel_base_dot_path = "" From 2af659cfdf29e3272dc8c85e5943d51d53d19b2a Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Tue, 17 Oct 2023 11:39:27 +1300 Subject: [PATCH 2/2] Update main.py --- allenact/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/allenact/main.py b/allenact/main.py index 7b8b543f9..613445f5d 100755 --- a/allenact/main.py +++ b/allenact/main.py @@ -371,7 +371,10 @@ def load_config(args) -> Tuple[ExperimentConfig, Dict[str, str]]: ), "The path '{}' does not seem to exist (your current working directory is '{}').".format( args.experiment_base, os.getcwd() ) - rel_base_dir = posixpath.normpath(args.experiment_base) + rel_base_dir = posixpath.relpath( # Normalizing string representation of path + posixpath.abspath(args.experiment_base), os.getcwd() + ) + rel_base_dot_path = rel_base_dir.replace("/", ".") if rel_base_dot_path == ".": rel_base_dot_path = ""