Hi, I must be doing something simple wrong here. Any advice on the correct way to get predictions would be appreciated.
I’ve trained a collaborative filtering model and now want to get predictions for combinations of users and items. I’ve tried
learn.predict(df.iloc[0])
and also
learn.get_preds()
with a dataframe and a dataloader to no avail.
This is the error that is being returned.
/usr/local/lib/python3.6/dist-packages/fastcore/foundation.py in __getitem__(self, k)
110 def __init__(self, items): self.items = items
111 def __len__(self): return len(self.items)
--> 112 def __getitem__(self, k): return self.items[list(k) if isinstance(k,CollBase) else k]
113 def __setitem__(self, k, v): self.items[list(k) if isinstance(k,CollBase) else k] = v
114 def __delitem__(self, i): del(self.items[i])
TypeError: list indices must be integers or slices, not list
Also ran into troubles using the BCELossFlat loss function. I got this error:
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/torch/tensor.py in __torch_function__(cls, func, types, args, kwargs)
993
994 with _C.DisableTorchFunction():
--> 995 ret = func(*args, **kwargs)
996 return _convert(ret, cls)
997
RuntimeError: CUDA error: device-side assert triggered
Is the because you can’t use BCE with collaborative filtering? My label was binary, so I thought that would be better than mse.