awslabs / dgl-ke

High performance, easy-to-use, and scalable package for learning large-scale knowledge graph embeddings.
https://dglke.dgl.ai/doc/
Apache License 2.0
1.27k stars 195 forks source link

Expected type graph.Graph but get graph.HeteroGraph error #185

Closed vlad43210 closed 3 years ago

vlad43210 commented 3 years ago

Hi,

I am trying to train dgl-ke on a new dataset. I get the following error:

Traceback (most recent call last):
  File "/opt/conda/envs/kge/bin/dglke_train", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/envs/kge/lib/python3.8/site-packages/dglke/train.py", line 118, in main
    train_sampler_head = train_data.create_sampler(args.batch_size,
  File "/opt/conda/envs/kge/lib/python3.8/site-packages/dglke/dataloader/sampler.py", line 379, in create_sampler
    return EdgeSampler(self.g,
  File "/opt/conda/envs/kge/lib/python3.8/site-packages/dgl/contrib/sampling/sampler.py", line 683, in __init__
    self._sampler = _CAPI_CreateUniformEdgeSampler(
  File "dgl/_ffi/_cython/./function.pxi", line 287, in dgl._ffi._cy3.core.FunctionBase.__call__
  File "dgl/_ffi/_cython/./function.pxi", line 232, in dgl._ffi._cy3.core.FuncCall
  File "dgl/_ffi/_cython/./base.pxi", line 155, in dgl._ffi._cy3.core.CALL
dgl._ffi.base.DGLError: [21:45:00] /opt/dgl/include/dgl/packed_func_ext.h:117: Check failed: ObjectTypeChecker<TObjectRef>::Check(sptr.get()): Expected type graph.Graph but get graph.HeteroGraph
Stack trace:
  [bt] (0) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/libdgl.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x4f) [0x7f96cd73313f]
  [bt] (1) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/libdgl.so(dgl::GraphRef dgl::runtime::DGLArgValue::AsObjectRef<dgl::GraphRef>() const+0x264) [0x7f96cd8a0cf4]
  [bt] (2) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/libdgl.so(+0x999680) [0x7f96cdeb5680]
  [bt] (3) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/libdgl.so(+0x99a254) [0x7f96cdeb6254]
  [bt] (4) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/libdgl.so(DGLFuncCall+0x48) [0x7f96cde0fd38]
  [bt] (5) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/_ffi/_cy3/core.cpython-38-x86_64-linux-gnu.so(+0x15d2e) [0x7f96cd091d2e]
  [bt] (6) /opt/conda/envs/kge/lib/python3.8/site-packages/dgl/_ffi/_cy3/core.cpython-38-x86_64-linux-gnu.so(+0x1625b) [0x7f96cd09225b]
  [bt] (7) /opt/conda/envs/kge/bin/python(_PyObject_MakeTpCall+0x22f) [0x555a5ec7185f]
  [bt] (8) /opt/conda/envs/kge/bin/python(_PyEval_EvalFrameDefault+0x475) [0x555a5ecf4e35]

I did some googling and it may have to do with EdgeSampler not working on heterographs, but I am not quite sure how to resolve the issue. I did not see an existing issue for this package with this error.

This is running on Python 3.8.5. Relevant package versions:

- dgl==0.6.0
- dglke==0.1.2
- torch==1.7.1

Please let me know if you can help with this issue, I would really appreciate it!

classicsong commented 3 years ago

Please install dgl==0.4.3post2 right now.

vlad43210 commented 3 years ago

Looks like it's working with dgl==0.4.3post2, thank you very much!

xing969541 commented 3 years ago

Please install dgl==0.4.3post2 right now.

I met the same error with dgl==0.6.0post1, dglke==0.1.2. Should I lower my DGL version? Thanks for any help!