Skip to content

Commit bf7d1ac

Browse files
author
krammnic
committed
just date as trace name
1 parent 8cc8524 commit bf7d1ac

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

torchtune/training/_profiler.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
import datetime
9-
import glob
109
import os
1110
import time
1211
from functools import partial
@@ -99,23 +98,16 @@ def trace_handler(
9998

10099
# Use tensorboard trace handler rather than directly exporting chrome traces since
101100
# tensorboard doesn't seem to be able to parse traces with prof.export_chrome_trace
101+
102+
now = datetime.datetime.now()
103+
102104
exporter = tensorboard_trace_handler(
103105
curr_trace_dir,
104-
worker_name="rank0",
106+
worker_name=f"r0-{now.year}-{now.month}-{now.day}-{now.hour}-{now.minute}",
105107
use_gzip=True,
106108
)
107109
exporter(prof)
108110

109-
latest_trace = max(
110-
glob.glob(curr_trace_dir + "/*.pt.trace.json.gz"), key=os.path.getctime
111-
)
112-
113-
now = datetime.datetime.now()
114-
os.rename(
115-
latest_trace,
116-
f"{curr_trace_dir}/r0-{now.year}-{now.month}-{now.day}-{now.hour}-{now.minute}.pt.trace.json.gz",
117-
)
118-
119111
if rank == 0:
120112
log.info(f"Finished dumping traces in {time.monotonic() - begin:.2f} seconds")
121113

0 commit comments

Comments
 (0)