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

Ability to specify step for logged metrics #788

Closed
festeh opened this issue Feb 4, 2020 · 2 comments · Fixed by #808
Closed

Ability to specify step for logged metrics #788

festeh opened this issue Feb 4, 2020 · 2 comments · Fixed by #808
Labels
feature Is an improvement or enhancement help wanted Open to be worked on

Comments

@festeh
Copy link
Contributor

festeh commented Feb 4, 2020

🚀 Feature

Add option to specify step for logged metrics

Motivation

After calculating some metric on n-th epoch I'd like to put corresponding mark (n) on x-axis. As I see in the source code, there's no obvious way to do this. Instead something like n * num_batches will be shown, like in the figure where the loss is calculated after each epoch.
Screenshot from 2020-02-04 15-50-12

Pitch

I'd love to see 0,1,2,... ticks on x-axis.
My proposal is to allow user to add step key in log dict, if this key is presented, corresponding value would be used in x-axis. I can make a PR if you agree with this idea.

Alternatives

It would be interesting to know how this could be achieved in other way.

@festeh festeh added feature Is an improvement or enhancement help wanted Open to be worked on labels Feb 4, 2020
@awaelchli
Copy link
Contributor

awaelchli commented Feb 14, 2020

An alternative would be to call the specific experiment object from the logger, e.g., for TensorBoard logger:

self.logger.experiment.add_scalar("myloss", loss, global_step=...)

I think that should work. It will still log the other metrics you return in the dict with the regular step values.

@festeh
Copy link
Contributor Author

festeh commented Feb 14, 2020

You're right, this is a vaild way, when I opened this issue I did not thought about it. Still I think that this approach is a bit complex, as for such a simple task you need to cast your metrics to float and possibly write a loop with add_scalar instead of just passing metrics in log dict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants