Skip to content

Commit adfa8ad

Browse files
authored
chore(pt): use more warmup steps (#4761)
The SiLUT activation function is using JIT compile. Hence, we require more warm-up steps to avoid JIT compiling time interfering the profiling result. This commit also adds logging info of the saved profiling results. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Enhancements** - Increased the profiling warmup duration during training for improved profiling accuracy. - Added a log message to notify users when the profiling trace is saved to the TensorBoard log directory. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 2279459 commit adfa8ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

deepmd/pt/train/training.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def run(self) -> None:
684684
writer = SummaryWriter(log_dir=self.tensorboard_log_dir)
685685
if self.enable_profiler or self.profiling:
686686
prof = torch.profiler.profile(
687-
schedule=torch.profiler.schedule(wait=1, warmup=1, active=3, repeat=1),
687+
schedule=torch.profiler.schedule(wait=1, warmup=15, active=3, repeat=1),
688688
on_trace_ready=torch.profiler.tensorboard_trace_handler(
689689
self.tensorboard_log_dir
690690
)
@@ -1058,10 +1058,14 @@ def log_loss_valid(_task_key="Default"):
10581058
writer.close()
10591059
if self.enable_profiler or self.profiling:
10601060
prof.stop()
1061+
if self.enable_profiler:
1062+
log.info(
1063+
f"The profiling trace has been saved under {self.tensorboard_log_dir}"
1064+
)
10611065
if self.profiling:
10621066
prof.export_chrome_trace(self.profiling_file)
10631067
log.info(
1064-
f"The profiling trace have been saved to: {self.profiling_file}"
1068+
f"The profiling trace has been saved to: {self.profiling_file}"
10651069
)
10661070

10671071
def save_model(self, save_path, lr=0.0, step=0) -> None:

0 commit comments

Comments
 (0)