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.28k stars 196 forks source link

pytorch dglke_train Not Working, Expected type graph.Graph but get graph.HeteroGraph #275

Closed asifsamir closed 1 year ago

asifsamir commented 1 year ago

I ran this algorithm earlier with 0.4.3. Now I can't seem to find the repo. Then upgraded to 0.6, 0.8, 0.9, and getting the same error for all the versions. Can you please look into it and give me a solution?

Reading train triples.... Finished. Read 483142 train triples. Reading valid triples.... Finished. Read 50000 valid triples. Reading test triples.... Finished. Read 59071 test triples. |Train|: 483142 random partition 483142 edges into 8 parts part 0 has 60393 edges part 1 has 60393 edges part 2 has 60393 edges part 3 has 60393 edges part 4 has 60393 edges part 5 has 60393 edges part 6 has 60393 edges part 7 has 60391 edges /usr/local/lib/python3.9/dist-packages/dgl/heterograph.py:72: DGLWarning: Recommend creating graphs by dgl.graph(data) instead of dgl.DGLGraph(data). dgl_warning('Recommend creating graphs by dgl.graph(data)' /usr/local/lib/python3.9/dist-packages/dgl/heterograph.py:83: DGLWarning: Keyword arguments ['readonly', 'multigraph', 'sort_csr'] are deprecated in v0.5, and can be safely removed in all cases. dgl_warning('Keyword arguments {} are deprecated in v0.5, and can be safely' Traceback (most recent call last): File "/usr/local/bin/dglke_train", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/dist-packages/dglke/train.py", line 118, in main train_sampler_head = train_data.create_sampler(args.batch_size, File "/usr/local/lib/python3.9/dist-packages/dglke/dataloader/sampler.py", line 379, in create_sampler return EdgeSampler(self.g, File "/usr/local/lib/python3.9/dist-packages/dgl/contrib/sampling/sampler.py", line 683, in init self._sampler = _CAPI_CreateUniformEdgeSampler( File "dgl/_ffi/_cython/./function.pxi", line 293, in dgl._ffi._cy3.core.FunctionBase.call File "dgl/_ffi/_cython/./function.pxi", line 239, in dgl._ffi._cy3.core.FuncCall dgl._ffi.base.DGLError: [16:45:52] /opt/dgl/include/dgl/packed_func_ext.h:117: Check failed: ObjectTypeChecker::Check(sptr.get()): Expected type graph.Graph but get graph.HeteroGraph Stack trace: [bt] (0) /usr/local/lib/python3.9/dist-packages/dgl/libdgl.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x4f) [0x7ff0ca7e729f] [bt] (1) /usr/local/lib/python3.9/dist-packages/dgl/libdgl.so(dgl::GraphRef dgl::runtime::DGLArgValue::AsObjectRef() const+0x264) [0x7ff0cab04d04] [bt] (2) /usr/local/lib/python3.9/dist-packages/dgl/libdgl.so(+0x5255c0) [0x7ff0cab6a5c0] [bt] (3) /usr/local/lib/python3.9/dist-packages/dgl/libdgl.so(+0x526194) [0x7ff0cab6b194] [bt] (4) /usr/local/lib/python3.9/dist-packages/dgl/libdgl.so(DGLFuncCall+0x48) [0x7ff0caab30e8] [bt] (5) /usr/local/lib/python3.9/dist-packages/dgl/_ffi/_cy3/core.cpython-39-x86_64-linux-gnu.so(+0x15ff3) [0x7ff0ca3a9ff3] [bt] (6) /usr/local/lib/python3.9/dist-packages/dgl/_ffi/_cy3/core.cpython-39-x86_64-linux-gnu.so(+0x167db) [0x7ff0ca3aa7db] [bt] (7) /usr/bin/python3(_PyObject_MakeTpCall+0x2aa) [0x62a42a] [bt] (8) /usr/bin/python3(_PyEval_EvalFrameDefault+0x4a28) [0x5afc18]

cristinabb commented 1 year ago

I had the same issue but installing dgl-ke from the source like stated here https://github.com/awslabs/dgl-ke/issues/274 and dgl==0.9 solved it

asifsamir commented 1 year ago

I had the same issue but installing dgl-ke from the source like stated here #274 and dgl==0.9 solved it

Yes, I solved the issue this way. Thanks for the suggestion though.

PCMasterRace007 commented 1 year ago

I had the same issue but installing dgl-ke from the source like stated here #274 and dgl==0.9 solved it

Could you please assist me on how to install dgl-ke from source and which branch