Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior of global_step=None #49

Closed
DrJimFan opened this issue Nov 24, 2017 · 4 comments
Closed

Behavior of global_step=None #49

DrJimFan opened this issue Nov 24, 2017 · 4 comments

Comments

@DrJimFan
Copy link

This is probably a stupid question: I don't understand the behavior when global_step=None. I'd expect the plot's x-axis to correspond to wallclock time, but in reality it squeezes the curve to a single dot.
Both this repo and the official TB repo say global_step is optional. Under what situation do I actually set it to None?

@DrJimFan DrJimFan changed the title Behavior of global_step=None Behavior of global_step=None Nov 24, 2017
@lanpa
Copy link
Owner

lanpa commented Nov 24, 2017

I always pass n_iter explicitly. It's more intuitive.

However you can try this for wall clock time:

import time
for n_iter in range(100):
    s1 = torch.rand(1) # value to keep
    writer.add_scalar('data/scalar1', s1[0]) 
    time.sleep(0.1)

Note that it's important to have a sleep.

image

@DrJimFan
Copy link
Author

Yes, I know you can emulate wall clock time that way. However, I do want to understand what does global_step=None mean, and why is it even optional at all.

@lanpa
Copy link
Owner

lanpa commented Nov 24, 2017

Setting global_step=None means no step information is saved in protobuf (while time is still logged). So if users don't want to maintain a global step variable in the code, they can simply ignore this argument.

@DrJimFan
Copy link
Author

Gotcha. I guess it's always good to make it explicit then. Thanks!
Happy Black Friday. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants