aitorzip / PyTorch-CycleGAN

A clean and readable Pytorch implementation of CycleGAN
https://arxiv.org/abs/1703.10593
GNU General Public License v3.0
1.25k stars 289 forks source link

Regarding Visdom #23

Open nisargshah1999 opened 4 years ago

nisargshah1999 commented 4 years ago

Hi, Thank you very much for easy implementation of Cyclgan code. I am training on the server and couldn't use web browser to visualize the results. So is there a way that I could stop that part in code as it is continuously giving errorss.

LINFF1023 commented 2 years ago

Hi, Thank you very much for easy implementation of Cyclgan code. I am training on the server and couldn't use web browser to visualize the results. So is there a way that I could stop that part in code as it is continuously giving errorss.

hi!!! How did you solve it?

liu-bohan commented 1 year ago

How did you solve it?

I just commented out all the code about Visdom. They're all in the utils.py file:

from torch.autograd import Variable
import torch
#from visdom import Visdom
import numpy as np
... ...
class Logger():
    def __init__(self, n_epochs, batches_epoch):
        #self.viz = Visdom()
        self.n_epochs = n_epochs
        self.batches_epoch = batches_epoch
        self.epoch = 1
        ... ...
 # Draw images
        '''
        for image_name, tensor in images.items():
            if image_name not in self.image_windows:
                self.image_windows[image_name] = self.viz.image(tensor2image(tensor.data), opts={'title':image_name})
            else:
                self.viz.image(tensor2image(tensor.data), win=self.image_windows[image_name], opts={'title':image_name})
        '''
# End of epoch
        if (self.batch % self.batches_epoch) == 0:
            # Plot losses
            for loss_name, loss in self.losses.items():
                '''
                if loss_name not in self.loss_windows:
                    self.loss_windows[loss_name] = self.viz.line(X=np.array([self.epoch]), Y=np.array([loss/self.batch]),
                                                                    opts={'xlabel': 'epochs', 'ylabel': loss_name, 'title': loss_name})
                else:
                    self.viz.line(X=np.array([self.epoch]), Y=np.array([loss/self.batch]), win=self.loss_windows[loss_name], update='append')
                '''
                # Reset losses for next epoch
                self.losses[loss_name] = 0.0