Hi all!,
I was trying to add the movie year from the movie titles to the movielens model from lesson 5 but I get a cuda error:
“reduce failed to synchorinze”
I found a topic about this saying that this was discussed in lesson 7 but that was of V1 of the course so it’s still using keras.
Here’s the code for the model:
class MininetConts(nn.Module):
def __init__(self, n_users, n_movies, n_conts, nh=10, d1=0.05, d2=0.5):
super().__init__()
self.u, self.m = emb(n_users, n_factors), emb(n_movies, n_factors)
self.lin1 = nn.Linear(n_factors * 2 + n_conts, nh)
self.lin_out = nn.Linear(nh, 1)
self.d1 = nn.Dropout(d1)
self.d2 = nn.Dropout(d2)
def forward(self, cats, conts):
users, movies = cats[:,0], cats[:,1]
u_emb, m_emb = self.u(users), self.m(movies)
inpt = torch.cat([u_emb, m_emb, conts], 1) # dim=1 because we want them side by side
x = self.d1(inpt)
x = self.lin1(x)
x = F.relu(x)
x = self.d2(x)
x = self.lin_out(x)
return F.sigmoid(x) * (max_rating-min_rating) + min_rating
I looked at the shape of inpt which seems to make sense. Also the datatypes should be correct float32 for the year and target. Also this looks right to me:
it = iter(data.trn_dl)
*xs,yt = next(it)
xs[0].shape, xs[1].shape, yt.shape
output: (torch.Size([64, 2]), torch.Size([64, 1]), torch.Size([64, 1]))
Any ideas what I’m doing wrong? Thanks!