Skip to content

Commit

Permalink
Inline concat path using os.path.join instead of wrapping in pathlib.…
Browse files Browse the repository at this point in the history
…Path (FAIR-Chem#163)

This fix allows the use of alternative TensorFlow SummaryWriter's (e.g., GCP, S3, etc). Using pathlib.Path, it changes incoming --run-dir=s3://path to s3:/path (Note the single slash) and the SummaryWriter check fails to match due to the single slash.

The fix is to not wrap in a pathlib.Path and do inline concatenation using os.path.join
  • Loading branch information
joshes committed Dec 23, 2020
1 parent e96d963 commit 47bf5d2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ocpmodels/trainers/base_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __init__(
# but there are no gpu devices available
if run_dir is None:
run_dir = os.getcwd()
run_dir = Path(run_dir)

timestamp = torch.tensor(datetime.datetime.now().timestamp()).to(
self.device
Expand All @@ -90,9 +89,9 @@ def __init__(
"print_every": print_every,
"seed": seed,
"timestamp": timestamp,
"checkpoint_dir": str(run_dir / "checkpoints" / timestamp),
"results_dir": str(run_dir / "results" / timestamp),
"logs_dir": str(run_dir / "logs" / logger / timestamp),
"checkpoint_dir": os.path.join(run_dir, "checkpoints", timestamp),
"results_dir": os.path.join(run_dir, "results", timestamp),
"logs_dir": os.path.join(run_dir, "logs", logger, timestamp),
},
}
# AMP Scaler
Expand Down

0 comments on commit 47bf5d2

Please sign in to comment.