Issue with running KG embeddings train.py

Ran into an issue while using KG embeddings train.py

To Reproduce

Steps to reproduce the behavior:

  1. Install dgl 0.4.2
  2. clone dgl
  3. run the fb15k training by the given command in the documentation:

python3 train.py --model DistMult --dataset FB15k --batch_size 1024
–neg_sample_size 256 --hidden_dim 2000 --gamma 500.0 --lr 0.1 --max_step 100000
–batch_size_eval 16 --gpu 0 --valid --test -adv

Issue:

Traceback (most recent call last):
File “/Users/sai/Downloads/dgl2/apps/kg/train.py”, line 401, in
run(args, logger)
File “/Users/sai/Downloads/dgl2/apps/kg/train.py”, line 336, in run
train(args, model, train_sampler, valid_samplers, rel_parts=rel_parts)
File “/Users/sai/Downloads/dgl2/apps/kg/train_pytorch.py”, line 136, in train
pos_g, neg_g = next(train_sampler)
File “/Users/sai/Downloads/dgl2/apps/kg/dataloader/sampler.py”, line 702, in next
pos_g, neg_g = next(self.iterator_tail)
File “/Users/sai/Downloads/dgl2/apps/kg/dataloader/sampler.py”, line 711, in one_shot_iterator
is_chunked, neg_head, num_nodes)
File “/Users/sai/Downloads/dgl2/apps/kg/dataloader/sampler.py”, line 475, in create_neg_subgraph
neg_sample_size, neg_head)
File “/Users/sai/Downloads/dgl2/apps/kg/dataloader/sampler.py”, line 404, in init
parent=subg.parent)
AttributeError: ‘EdgeSubgraph’ object has no attribute ‘parent’

I suggest you to install the nightly-build version of DGL.

pip install --pre dgl-cu101  

Or if you are using mac, you should try build from source.

dgl-ke is under developing so you need to use DGL nightly build for it. We will release the first version of dgl-ke recently. Please pay attention to our release news. Thanks!