EugenHotaj / pytorch-generative

Easy generative modeling in PyTorch.
MIT License
422 stars 68 forks source link

Sampling via py scripts #16

Closed eyalbetzalel closed 4 years ago

eyalbetzalel commented 4 years ago

Hi!

Is there a way to use the sample function that appears in the notebook within the py scripts / add sampling option to the tensorboard logs?

I tried to convert the imshow to imsave and run it after finish training, but the output image is currrpted for some reason.

BTW - this project is great! thank you for this.

Regards.

EugenHotaj commented 4 years ago

Is there a way to use the sample function that appears in the notebook within the py scripts / add sampling option to the tensorboard logs?

All the implemented models have a #sample() method which they inherit from the base class. Does this not work for you?

I tried to convert the imshow to imsave and run it after finish training, but the output image is currrpted for some reason.

Hmm, interesting, let me look more into this and get back to you.

BTW - this project is great! thank you for this.

Thanks! Glad you like it and I appreciate the bug reports.

EugenHotaj commented 4 years ago

Hey @eyalbetzalel

I tried to convert the imshow to imsave and run it after finish training, but the output image is currrpted for some reason.

Hmm, interesting, let me look more into this and get back to you.

I built a quick notebook with the PixelSnail model (colab link). I only ran it for one epoch so the generated images are not very high quality, but as far as I can tell everything seems to be working.

How exactly are the output images corrupted for you? Are you not even able to open the saved image file? Or do the results just look bad?

add sampling option to the tensorboard logs

Yea it should be possible to add images to TensorBoard using the SummaryWriter API. I've been hesitant to add this feature since generating samples takes a while, especially fo big models, which could slow down training. However, if we do it pretty infrequently (say every ~10 epochs) it should not be a big deal. I'll open a new issue to track this.

eyalbetzalel commented 4 years ago

Thanks.

EugenHotaj commented 3 years ago

Hey @eyalbetzalel, I've now added this functionality in dfee0349a443956d053f92916f5141b248ed389e.