variational-autoencoders-for-collaborative-filtering-pytorch icon indicating copy to clipboard operation
variational-autoencoders-for-collaborative-filtering-pytorch copied to clipboard

Size mismatch problem in the impl.

Open FalconLK opened this issue 4 years ago • 0 comments

Hi,

Thanks for sharing the nice repo! I'm pretty interested in the work.

However, there is a size mismatch error when I run the code as is after downloading and processing the data.

Could you please kindly answer a few of my questions ? :)

  1. Is there a specific condition to run this? Please give me an example command so that I can use as is (when we assume the dataset(pkl) is generated)?

  2. Also, the parameter "processed_dir" = 'O:/dataset/vae_cf/data/ml-20m/pro_sg' is it correct? Cause your dataset.py doesn't generate the pkl to that path. The original ml-20m/ dir is under the root of the project.

File "demo.py", line 149, in main
    trainer.train()
  File ".../variational-autoencoders-for-collaborative-filtering-pytorch/trainer.py", line 189, in train
    self.train_epoch()
  File ".../variational-autoencoders-for-collaborative-filtering-pytorch/trainer.py", line 155, in train_epoch
    logits, KL, mu_q, std_q, epsilon, sampled_z = self.model.forward(data_tr, prof)
  File ".../variational-autoencoders-for-collaborative-filtering-pytorch/vae.py", line 79, in forward
    mu_q, logvar_q = self.encoder.forward(x)
  File ".../variational-autoencoders-for-collaborative-filtering-pytorch/vae.py", line 31, in forward
    x = self.linear_1(x)
  File ".../anaconda3/envs/pytorch_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File ".../anaconda3/envs/pytorch_env/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 87, in forward
    return F.linear(input, self.weight, self.bias)
  File ".../anaconda3/envs/pytorch_env/lib/python3.8/site-packages/torch/nn/functional.py", line 1610, in linear
    ret = torch.addmm(bias, input, weight.t())
RuntimeError: size mismatch, **m1: [1 x 20108], m2: [1 x 600]** at /Users/distiller/project/conda/conda-bld/pytorch_1591914893314/work/aten/src/TH/generic/THTensorMath.cpp:41

FalconLK avatar Jul 04 '20 19:07 FalconLK