ngcf_pytorch_g61
ngcf_pytorch_g61 copied to clipboard
Failing to reproduce the code
Hi,
I'm trying to run your code and i'm getting an error on the evaluation function. Could you please tell me what am I doing wrong?
> CUDA_VISIBLE_DEVICES=1 python run_ngcf.py --dataset ml-100k
n_users=943, n_items=1682
n_interactions=100000
n_train=80064, n_test=19936, sparsity=0.06305
Creating interaction matrices R_train and R_test...
Complete. Interaction matrices R_train and R_test created in 1.9346222877502441 sec
Loaded adjacency-matrix (shape: (2625, 2625) ) in 0.051796674728393555 sec.
Initializing weights...
Weights initialized.
Start at 2021-02-18 18:04:15.554979
Using cuda for computations
Params on CUDA: True
Epoch: 0, Training time: 8.75s, Loss: 30.0306
Traceback (most recent call last):
File "run_ngcf.py", line 107, in <module>
k)
File "/home/pgd721/work/NGCF_pytorch/utils/helper_functions.py", line 142, in eval_model
pred_items.scatter_(dim=1, index=test_indices, src=torch.tensor(1.0).cuda())
RuntimeError: Index tensor must have the same number of dimensions as src tensor
Thank you very much!
line 137, 140 must be pred_items.scatter_(dim=1, index=test_indices,src=torch.ones_like(test_indices).float().cuda()) topk_preds.scatter_(dim=1, index=test_indices[:, :k], src=torch.ones_like(test_indices[:, :k]).float().cuda())
line 137, 140 must be pred_items.scatter_(dim=1, index=test_indices,src=torch.ones_like(test_indices).float().cuda()) topk_preds.scatter_(dim=1, index=test_indices[:, :k], src=torch.ones_like(test_indices[:, :k]).float().cuda())
thanks a lot!