i have recently adopted
EvalResult with version 0.9.0 and really like it so far . Thanks for the great work on it and Pytorch-Lightning overall!
I am using
result.log("val/accuracy", acc, on_epoch=True) to a log an aggregated version of the validation accuracy for each epoch. I was wondering whether it is possible to additionally log the unreduced validation results as a histogram to ones favorite logger (e.g. Tensorboard) for each epoch as well. This way one can get a more in-depth view at the validation results.
I have implemented a validation_epoch_end method which itself works well.
def validation_epoch_end(self, validation_step_output_result): # log non-aggregated validation results as histogram. # This gives us a more in-depth view at the results for k, v in validation_step_output_result.items(): if "val" in k: self.logger.experiment.add_histogram(k, v, self.global_step) return validation_step_output_result
But it only works for the pre-training check and the first epoch and crashes in
logging.py line 110 (the last line of the
metrics_to_scalars function). The exact error is
Exception has occurred: ValueError only one element tensors can be converted to Python scalars.
From looking at lines 486-495 of
evaluation_loop.py it seems like I would need to implement the reduction methods myself, which would be redundant to Pytorch-Lightnings implementation.
So I am wondering, whether there is a way of (additionally) logging evaluation values as histograms but using Pytorch-Lightnings inbuild aggregation and logging?