fixes diff storage location

This commit is contained in:
Mayank Mittal 2023-12-11 11:50:05 +01:00
parent d7a15a7436
commit cde1e87a19
2 changed files with 5 additions and 3 deletions

View File

@ -59,6 +59,8 @@ def unpad_trajectories(trajectories, masks):
def store_code_state(logdir, repositories) -> list:
git_log_dir = os.path.join(logdir, "git")
os.makedirs(git_log_dir, exist_ok=True)
file_paths = []
for repository_file_path in repositories:
try:
@ -69,7 +71,7 @@ def store_code_state(logdir, repositories) -> list:
# get the name of the repository
repo_name = pathlib.Path(repo.working_dir).name
t = repo.head.commit.tree
diff_file_name = os.path.join(logdir, f"{repo_name}_git.diff")
diff_file_name = os.path.join(git_log_dir, f"{repo_name}.diff")
content = f"--- git status ---\n{repo.git.status()} \n\n\n--- git diff ---\n{repo.git.diff(t)}"
with open(diff_file_name, "x") as f:
f.write(content)

View File

@ -74,7 +74,7 @@ class WandbSummaryWriter(SummaryWriter):
self.store_config(env_cfg, runner_cfg, alg_cfg, policy_cfg)
def save_model(self, model_path, iter):
wandb.save(model_path)
wandb.save(model_path, base_path=os.path.dirname(model_path))
def save_file(self, path, iter=None):
wandb.save(path)
wandb.save(path, base_path=os.path.dirname(path))