DiscoGAN-pytorch icon indicating copy to clipboard operation
DiscoGAN-pytorch copied to clipboard

How to start training??

Open edwardcho opened this issue 4 years ago • 1 comments

Hello Sir,

I downloaded your code and maps-dataset.. And when I started I met some error.

...
Traceback (most recent call last):
  File "main.py", line 41, in <module>
    main(config)
  File "main.py", line 33, in main
    trainer.train()
  File "/itsme/TESTBOARD/additional_networks/GAN/pytorch_DiscoGAN_carpedm20/trainer.py", line 247, in train
    format(step, self.max_step, l_d.data[0], l_g.data[0]))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

Thanks..

edwardcho avatar May 11 '20 02:05 edwardcho

You need to change from .data[0] to .item() (example: print("[{}/{}] Loss_D: {:.4f} Loss_G: {:.4f}".format(step, self.max_step, l_d.data.item(), l_g.data.item())))

CorvoOrc avatar May 13 '20 11:05 CorvoOrc