-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
TensorBoard logging batch level metrics #6692
Comments
+1 |
I have been looking for something like this for a week. @sameermanek , does your implementation perform well? |
I haven't explicitly tested (computational) performance, but it has been useful to me (e..g, when testing things locally on CPU). |
Thanks! This looks really great, and I agree, so much easier to see what is happening between epochs. I am currently having problems with a large dataset myself. So this is just a modification of the tensorboard callback? I will then use the callback as normal. Should I see live graphing of the batches or will that still only show every epoch. |
@Barfknecht Correct -- this is just a modification of the tensorboard callback. I probably gave you the wrong link (sorry about that -- that was just a commit, not the entire file). The file is here and you can see the added You should see live graphing of the batches (example screenshot below; one epoch is 5,000 steps in this, so you can see there are values well before we get to an epoch) |
This would be really useful! Any ETA on when this will be merged into master? I don't see a PR? |
This is what I needed, thanks a lot. |
@wkretzsch I just submitted a PR; let's see whether it's accepted or if there's any feedback. Thanks. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
bump. I'd really like to see this make it to master, and it has no negative effect on current users of the Tensorboard callback. |
Short notice for those who got only one dot in the graph: remember to set write_batch_performance to True! |
@jpcenteno80, try this: class TB(callbacks.TensorBoard):
def __init__(self, log_every=1, **kwargs):
super().__init__(**kwargs)
self.log_every = log_every
self.counter = 0
def on_batch_end(self, batch, logs=None):
self.counter+=1
if self.counter%self.log_every==0:
for name, value in logs.items():
if name in ['batch', 'size']:
continue
summary = tf.Summary()
summary_value = summary.value.add()
summary_value.simple_value = value.item()
summary_value.tag = name
self.writer.add_summary(summary, self.counter)
self.writer.flush()
super().on_batch_end(batch, logs) Your |
Where exactly does this change have to occur? Tried changing it in:
but the code I am running still does not recognise write_batch_performance as an argument. |
@RyanCodes44 don't change the code in callbacks, just instantiate the class in your code and use it as a callback like https://keras.io/callbacks/#example-recording-loss-history |
Okay thanks! |
Regarding the code example by @sameermanek, @jpcenteno80, @VladislavZavadskyy (I have tried the latter): it seems to work fine, with two issues:
|
|
In answer to 2: |
Bump, the PR seems idle. This feature would be really useful ! |
@bersbersbers: As a workaround to the second issue you point out, I tend to redefine
This prevents the superclass' |
@jayanthc But in your case nothing will be written in val metrics |
I actually suggest adding this function into
So it will write all val-metrics and it will pass writing train-metrics |
@DmitriiDenisov: You are right. I ended up adding something similar to what you posted, to |
This feature has been implemented and merged in master. |
It'd be useful if there was some batch-level logging in TensorBoard when using the TensorBoard callback (as defined in keras/callbacks.py). I think this'd be generally useful when trying to keep track of stats between epochs.
As an example, there could be a new boolean argument
write_batch_performance
in the init() method, and a newon_batch_end
method, something like:I have a basic version of this locally; I'd need to slightly clean it up and incorporate it into the unit tests. Happy to do so if it makes sense to incorporate into keras. I couldn't find any matching outstanding feature requests.
Thanks!
The text was updated successfully, but these errors were encountered: