1Konny / Beta-VAE

Pytorch implementation of β-VAE
MIT License
525 stars 125 forks source link

Training on dsprites fails with 0-dim tensor #12

Open rcnlee opened 5 years ago

rcnlee commented 5 years ago

I'm running ./run_dsprites_B_gamma100_z10.sh with a reduced number of iterations. Error is below:

=> no checkpoint found at 'checkpoints/dsprites_B_gamma100_z10/last'
 67%|██████████████████████████████████████████████████                         | 10000/15000.0 [34:22<16:59,  4.91it/s]Traceback (most recent call last):
  File "main.py", line 69, in <module>
    main(args)
  File "main.py", line 24, in main
    net.train()
  File "/Users/rlee18/git/Beta-VAE/solver.py", line 182, in train
    self.global_iter, recon_loss.data[0], total_kld.data[0], mean_kld.data[0]))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
Everbeast commented 5 years ago

have you solved that problem?

rcnlee commented 5 years ago

No, I didn't solve it.

lucasc896 commented 5 years ago

This should do it:

https://gist.github.com/lucasc896/017088d990980c43adec0af2dcb1c45c

thavlik commented 5 years ago

I can confirm the above changes remedy the problem. Thanks!