ctallec / world-models

Reimplementation of World-Models (Ha and Schmidhuber 2018) in pytorch
MIT License
568 stars 131 forks source link

Error training MD-rnn #25

Open waiyc opened 5 years ago

waiyc commented 5 years ago

Hi,

I am facing this invalid input size error when training dmrnn.

File "trainmdrnn.py", line 205, in test_loss = test(e) File "trainmdrnn.py", line 170, in data_pass latent_obs, latent_next_obs = to_latent(obs, next_obs) File "trainmdrnn.py", line 108, in to_latent [(obs_mu, obs_logsigma), (next_obs_mu, next_obs_logsigma)]] File "trainmdrnn.py", line 107, in for x_mu, x_logsigma in RuntimeError: shape '[16, 32, 32]' is invalid for input of size 11264

megsano commented 5 years ago

Hi, we're also experiencing this issue (but with a different size):


  File "trainmdrnn.py", line 202, in <module>
    train(e)
  File "trainmdrnn.py", line 168, in data_pass
    latent_obs, latent_next_obs = to_latent(obs, next_obs)
  File "trainmdrnn.py", line 106, in to_latent
    [(obs_mu, obs_logsigma), (next_obs_mu, next_obs_logsigma)]]
  File "trainmdrnn.py", line 105, in <listcomp>
    for x_mu, x_logsigma in
RuntimeError: shape '[16, 32, 32]' is invalid for input of size 36864```
megsano commented 5 years ago

Never mind, we just solved the problem by changing the SIZE in utils/misc.py to 96 instead of 64.

wildermuthn commented 5 years ago

@waiyc, you'll want to add drop_last=True as an argument to the DataLoader. This resolved the problem for me, as the difference in batch sizes caused the error.

https://github.com/ctallec/world-models/blob/master/trainmdrnn.py#L79