Thank you for your reply!
Just to recap that I understand the implementation correctly, if I override this method, the results are gathered (I am using DDP) by __gather_epoch_end_eval_results
and then passed to my _epoch_end
method, which has to reduce it itself.
If the _epoch_end
methods are not overridden, __auto_reduce_result_objs
is called, which loops over the results of each dataloader, reduces them and returns the reduced results as a list.
Both ways a list with reduced results must be returned, correct?
Do you think it would be possible to just reuse the reduction implementation from the EvalResult
class? By returning something like return EvalResult.SOMEMAGICMETHOD(validation_step_output_result)
?
Currently I am using this, although this relies on the hugly hack that all values are named val/...
:
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)
validation_step_output_result[k] = v.mean()
return validation_step_output_result
And as a follow up question: Is there an _epoch_end
method which operates on all ddp results gathered from the individual processes? So the analog of validation_step_end
, but executed after the epoch has finished?