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.25k stars 194 forks source link

fix dgl >= 0.8 dgl.transform becomes dgl.transforms #270

Closed lroberts7 closed 1 year ago

lroberts7 commented 1 year ago

Issue number: #269

Description of changes:

I added an if/else to switch between dgl.transform and dgl.transforms depending on the version number.

If there is a preferred alternate solution please let me know.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

lroberts7 commented 1 year ago

after making this change, the execution happens but I'm getting a different (maybe upstream?) error:

$ DGLBACKEND=pytorch dglke_partition -k 1 --data_path '/Users/lroberts/datascience/dgl/dgl-ke/data/codebase'
load dataset..
Reading train triples....
Finished. Read 483142 train triples.
Reading valid triples....
Finished. Read 50000 valid triples.
Reading test triples....
Finished. Read 59071 test triples.
construct graph...
/opt/homebrew/lib/python3.10/site-packages/dgl/_deprecate/graph.py:1023: DGLWarning: multigraph will be deprecated.DGL will treat all graphs as multigraph in the future.
  dgl_warning("multigraph will be deprecated." \
partition graph...
Traceback (most recent call last):
  File "/opt/homebrew/bin/dglke_partition", line 33, in <module>
    sys.exit(load_entry_point('dglke==0.1.0.dev0', 'console_scripts', 'dglke_partition')())
  File "/opt/homebrew/lib/python3.10/site-packages/dglke-0.1.0.dev0-py3.10.egg/dglke/partition.py", line 121, in main
  File "/opt/homebrew/lib/python3.10/site-packages/dgl/partition.py", line 403, in metis_partition
    node_part = metis_partition_assignment(g, k, balance_ntypes, balance_edges, mode)
  File "/opt/homebrew/lib/python3.10/site-packages/dgl/partition.py", line 293, in metis_partition_assignment
    sym_gidx = _CAPI_DGLMakeSymmetric_Hetero(g._graph)
  File "/opt/homebrew/lib/python3.10/site-packages/dgl/_ffi/_ctypes/function.py", line 188, in __call__
    check_call(_LIB.DGLFuncCall(
  File "/opt/homebrew/lib/python3.10/site-packages/dgl/_ffi/base.py", line 65, in check_call
    raise DGLError(py_str(_LIB.DGLGetLastError()))
dgl._ffi.base.DGLError: [16:59:16] /tmp/dgl_src/include/dgl/packed_func_ext.h:117: Check failed: ObjectTypeChecker<TObjectRef>::Check(sptr.get()): Expected type graph.HeteroGraph but get graph.Graph
Stack trace:
  [bt] (0) 1   libdgl.dylib                        0x000000015287329c dmlc::LogMessageFatal::~LogMessageFatal() + 116
  [bt] (1) 2   libdgl.dylib                        0x0000000152b1e244 dgl::HeteroGraphRef dgl::runtime::DGLArgValue::AsObjectRef<dgl::HeteroGraphRef>() const + 592
  [bt] (2) 3   libdgl.dylib                        0x0000000152c8e298 std::__1::__function::__func<dgl::transform::$_4, std::__1::allocator<dgl::transform::$_4>, void (dgl::runtime::DGLArgs, dgl::runtime::DGLRetValue*)>::operator()(dgl::runtime::DGLArgs&&, dgl::runtime::DGLRetValue*&&) + 92
  [bt] (3) 4   libdgl.dylib                        0x0000000152b5f0a4 DGLFuncCall + 80
  [bt] (4) 5   libffi.dylib                        0x00000001ad8c4050 ffi_call_SYSV + 80
  [bt] (5) 6   libffi.dylib                        0x00000001ad8cc9e4 ffi_call_int + 948
  [bt] (6) 7   _ctypes.cpython-310-darwin.so       0x00000001029290e0 _ctypes_callproc + 872
  [bt] (7) 8   _ctypes.cpython-310-darwin.so       0x000000010292391c PyCFuncPtr_call + 216
  [bt] (8) 9   Python                              0x0000000101441290 _PyObject_MakeTpCall + 136

any suggestions/advice from the maintainers of dgl-ke?

lroberts7 commented 1 year ago

@aksnzhy @zheng-da are you-or someone else-maintaining this repository?