Skip to content

Commit

Permalink
Fix default run_name on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
krzentner committed May 18, 2024
1 parent c495ad1 commit 5fb96ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/kogiri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ def _default_run_name():
main_file = getattr(sys.modules.get("__main__"), "__file__", "interactive")
file_trail = os.path.splitext(os.path.basename(main_file))[0]
now = datetime.datetime.now().isoformat()
# Replace colons on windows
if os.name == "nt":
run_name = run_name.replace(":", "_")
return f"{file_trail}_{now}"


Expand Down
4 changes: 3 additions & 1 deletion src/kogiri/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ def summarize_module(module, key, dst):
@declare_summarizer("torch.optim.Optimizer")
def summarize_optimizer(optimizer, key, dst):
state = optimizer.state_dict()
del state["param_groups"]
for param_group in state["param_groups"]:
# These are just some lists that clutter up the plotting
del param_group["params"]
summarize(state, key, dst)

0 comments on commit 5fb96ea

Please sign in to comment.