stared / livelossplot

Live training loss plot in Jupyter Notebook for Keras, PyTorch and others
https://p.migdal.pl/livelossplot
MIT License
1.29k stars 142 forks source link

Add dictionary support for plotlosses.update() ? #93

Closed johntiger1 closed 4 years ago

johntiger1 commented 4 years ago

I have a standard loss dictionary which I update like:

losses['iteration'].append(iteration)
            losses['D_real_loss'].append(D_real_loss.item())
            losses['D_fake_loss'].append(D_fake_loss.item())
            losses['G_loss'].append(G_loss.item())

Is it possible to pass in the dictionary directly? i.e. instead of:

plotlosses.update({
            'iteration': iteration,
            'D_real_loss': D_real_loss.item(),
            'D_fake_loss': D_fake_loss.item(),
            'G_loss': G_loss.item()
             })

make it something like

plotlosses.update(losses)

Also, is there an API or readthedocs anywhere? Thanks

stared commented 4 years ago

It is more-or-less how MainLogger stores the data - see plotlosses.logger.log_history. However, we made plotlosses.update more general - so not to assume that all metrics have the same number of steps.

If there is more need for that, I can add update_from_many_steps . Could you describe your use case?