Changing filepaths to Path obj (#303)

changing from using strings to paths
This commit is contained in:
evonneng authored and GitHub committed 2022-08-30 14:23:04 -07:00
1 parent 2d1ba13e12
commit 8f42ce4b34
6 files changed
+70 -92

No files matched your search

+2 -3
View File
@@ -19,7 +19,6 @@ from __future__ import annotations
import functools
import logging
import os
import typing
from pathlib import Path
from typing import Any, Dict, List
@@ -165,8 +164,8 @@ class Trainer:
load_dir = self.config.trainer.load_dir
load_step = self.config.trainer.load_step
if load_dir is not None and load_step is not None:
load_path = os.path.join(load_dir, f"step-{load_step:09d}.ckpt")
assert os.path.exists(load_path), f"Checkpoint {load_path} does not exist"
load_path = load_dir / f"step-{load_step:09d}.ckpt"
assert load_path.exists(), f"Checkpoint {load_path} does not exist"
loaded_state = torch.load(load_path, map_location="cpu")
self.start_step = loaded_state["step"] + 1
# load the checkpoints for pipeline, optimizers, and gradient scalar