Skip to content
Snippets Groups Projects
Commit 7fcbd01d authored by Thomas Müller's avatar Thomas Müller
Browse files

Reduce (surprisingly significant) training progress printing overhead

parent 6ee845f7
No related branches found
No related tags found
No related merge requests found
...@@ -176,6 +176,7 @@ if __name__ == "__main__": ...@@ -176,6 +176,7 @@ if __name__ == "__main__":
if n_steps < 0: if n_steps < 0:
n_steps = 100000 n_steps = 100000
tqdm_last_update = 0
if n_steps > 0: if n_steps > 0:
with tqdm(desc="Training", total=n_steps, unit="step") as t: with tqdm(desc="Training", total=n_steps, unit="step") as t:
while testbed.frame(): while testbed.frame():
...@@ -193,9 +194,12 @@ if __name__ == "__main__": ...@@ -193,9 +194,12 @@ if __name__ == "__main__":
old_training_step = 0 old_training_step = 0
t.reset() t.reset()
t.update(testbed.training_step - old_training_step) now = time.monotonic()
t.set_postfix(loss=testbed.loss) if now - tqdm_last_update > 0.1:
old_training_step = testbed.training_step t.update(testbed.training_step - old_training_step)
t.set_postfix(loss=testbed.loss)
old_training_step = testbed.training_step
tqdm_last_update = now
if args.save_snapshot: if args.save_snapshot:
print("Saving snapshot ", args.save_snapshot) print("Saving snapshot ", args.save_snapshot)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment