Who anyone experience recommendation

hey !

always thanks to your good platform ! it makes me more interested in graph embedding world

i’m in now try to adapt my custom dataset with recommendation task

and before it works that , i think that i need to understand DGL module and so try to study GNN tutorial especially, WWW20-hands-on session.

In conclusion, At " application/recsys.ipynb " happens ’ index error

concretely


IndexError Traceback (most recent call last)
in
2 model.train()
3 with tqdm.tqdm(train_dataloader) as t:
----> 4 for pair_graph, blocks in t:
5 user_emb, item_emb = model(blocks)
6 prediction = model.compute_score(pair_graph, user_emb, item_emb)

~/anaconda3/lib/python3.8/site-packages/tqdm/std.py in iter(self)
1163
1164 try:
→ 1165 for obj in iterable:
1166 yield obj
1167 # Update and possibly print the progressbar.

~/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py in next(self)
515 if self._sampler_iter is None:
516 self._reset()
→ 517 data = self._next_data()
518 self._num_yielded += 1
519 if self._dataset_kind == _DatasetKind.Iterable and \

~/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py in _next_data(self)
555 def _next_data(self):
556 index = self._next_index() # may raise StopIteration
→ 557 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
558 if self._pin_memory:
559 data = _utils.pin_memory.pin_memory(data)

~/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py in fetch(self, possibly_batched_index)
45 else:
46 data = self.dataset[possibly_batched_index]
—> 47 return self.collate_fn(data)

in sample(self, batch)
24 seeds = {‘user’: pair_graph.nodes[‘user’].data[dgl.NID],
25 ‘item’: pair_graph.nodes[‘item’].data[dgl.NID]}
—> 26 blocks = self.construct_blocks(seeds, (users, items))
27
28 # Copy node features from original graph to the sampled block.

in construct_blocks(self, seeds, user_item_pairs_to_remove)
59 sampled_with_edges_removed = dgl.remove_edges(
60 sampled_with_edges_removed, edges_to_remove, ‘watched’)
—> 61 sampled_eids = sampled_eids[sampled_with_edges_removed.edges[‘watched’].data[dgl.EID]]
62 if len(edges_to_remove_rev) > 0:
63 sampled_with_edges_removed = dgl.remove_edges(

IndexError: index 43935 is out of bounds for dimension 0 with size 43495


whoever solve this error ? i inference that error why happens ? at my think , since processing which is removed the ‘watched’ data at pair_graph session (construct_blocks)

thanks to help my worried !

bye

That tutorial is quite outdated as it is for DGL 0.4.3post2. If you are using DGL 0.5 or later you could give a try with the solution in this link WWW20-Hands-on-Tutorial.