DGSR icon indicating copy to clipboard operation
DGSR copied to clipboard

Error occur when setting the long term to orgat and short term to last

Open JohnZcp opened this issue 2 years ago • 3 comments

Here is the command I used and the execution result: %run new_main.py --data=Games
--gpu=0
--epoch=20
--hidden_size=50
--batchSize=50
--user_long=orgat
--user_short=last
--item_long=orgat
--item_short=last
--user_update=rnn
--item_update=rnn
--lr=0.001
--l2=0.0001
--layer_num=2
--item_max_length=50
--user_max_length=50
--attn_drop=0.3
--feat_drop=0.3
--record \


RuntimeError Traceback (most recent call last) /content/drive/MyDrive/TCSS556/DGSR-master/new_main.py in () 112 for user, batch_graph, label, last_item in train_data: 113 iter += 1 --> 114 score = model(batch_graph.to(device), user.to(device), last_item.to(device), is_training=True) 115 loss = loss_func(score, label.to(device)) 116 optimizer.zero_grad()

8 frames /content/drive/MyDrive/TCSS556/DGSR-master/DGSR.py in user_reduce_func(self, nodes) 272 return {'user_h': h[0]} 273 else: --> 274 return {'user_h': self.agg_gate_u(torch.cat(h,-1))} 275 276 def graph_user(bg, user_index, user_embedding):

RuntimeError: Tensors must have same number of dimensions: got 2 and 1

JohnZcp avatar May 27 '22 01:05 JohnZcp

I also have some question about the commend for the model variants. I used the following code for Variants DGSR-G. ''' %run new_main.py --data=Games
--gpu=0
--epoch=20
--hidden_size=50
--batchSize=50
--user_long=gcn
--user_short=none
--item_long=gcn
--item_short=none
--user_update=rnn
--item_update=rnn
--lr=0.001
--l2=0.0001
--layer_num=2
--item_max_length=50
--user_max_length=50
--attn_drop=0.3
--feat_drop=0.3
--record
''' And received the following error. '''

AttributeError Traceback (most recent call last) /content/drive/MyDrive/TCSS556/DGSR-master/new_main.py in () 112 for user, batch_graph, label, last_item in train_data: 113 iter += 1 --> 114 score = model(batch_graph.to(device), user.to(device), last_item.to(device), is_training=True) 115 loss = loss_func(score, label.to(device)) 116 optimizer.zero_grad()

9 frames /usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in getattr(self, name) 1184 return modules[name] 1185 raise AttributeError("'{}' object has no attribute '{}'".format( -> 1186 type(self).name, name)) 1187 1188 def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None:

AttributeError: 'DGSRLayers' object has no attribute 'agg_gate_u' ''' Is there anything wrong with the arguments I used?

JohnZcp avatar May 28 '22 23:05 JohnZcp

Have you solved the first problem

PaceCYZ avatar Mar 11 '23 03:03 PaceCYZ

Have you solved the first problem i also meet the problem, are you solved it?

wbcat132 avatar Sep 25 '23 01:09 wbcat132