facebookresearch / NARS

Scalable Graph Neural Networks for Heterogeneous Graphs
Other
72 stars 12 forks source link

DGLKE cannot generate TransE embeddings for DGLHeteroGraph #3

Closed JonnyTran closed 3 years ago

JonnyTran commented 3 years ago

OS: Ubuntu 20.04 Python: 3.8 DGL version: 0.6.1 (pip install dgl-cu110) DGLKE version: 0.1.2 (pip install dglke)

This issue seems to be related to recent changes in DGL.

bash train_graph_emb.sh mag

  • dataset=mag
  • '[' mag == mag ']'
  • embed_size=128
  • DGLBACKEND=pytorch
  • dglke_train --model TransE_l2 --batch_size 1000 --neg_sample_size 200 --hidden_dim 128 --gamma 10 --lr 0.1 --max_step 400000 --log_interval 10000 -adv --gpu 0 --regularization_coef 1e-9 --data_path ./ --data_files train_triplets_mag --format raw_udd_hrt --dataset mag Using backend: pytorch Reading train triples.... Finished. Read 21111007 train triples. |Train|: 21111007 /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/base.py:45: DGLWarning: Recommend creating graphs by dgl.graph(data) instead of dgl.DGLGraph(data). return warnings.warn(message, category=category, stacklevel=1) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/base.py:45: DGLWarning: Keyword arguments ['readonly', 'multigraph', 'sort_csr'] are deprecated in v0.5, and can be safely removed in all cases. return warnings.warn(message, category=category, stacklevel=1) Traceback (most recent call last): File "/home/jonny/.conda/envs/jonny_conda3/bin/dglke_train", line 8, in sys.exit(main()) File "/home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dglke/train.py", line 144, in main train_sampler_head = train_data.create_sampler(args.batch_size, File "/home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dglke/dataloader/sampler.py", line 379, in create_sampler return EdgeSampler(self.g, File "/home/jonny/.conda/envs/jonny_conda3/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: [11:47:04] /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) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/libdgl.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x4f) [0x7f7ea63d416f] [bt] (1) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/libdgl.so(dgl::GraphRef dgl::runtime::DGLArgValue::AsObjectRef() const+0x264) [0x7f7ea6b1f7f4] [bt] (2) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/libdgl.so(+0xcf5020) [0x7f7ea6b7e020] [bt] (3) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/libdgl.so(+0xcf5bf4) [0x7f7ea6b7ebf4] [bt] (4) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/libdgl.so(DGLFuncCall+0x48) [0x7f7ea6ad8378] [bt] (5) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/_ffi/_cy3/core.cpython-38-x86_64-linux-gnu.so(+0x15d3e) [0x7f7e7c675d3e] [bt] (6) /home/jonny/.conda/envs/jonny_conda3/lib/python3.8/site-packages/dgl/_ffi/_cy3/core.cpython-38-x86_64-linux-gnu.so(+0x1626b) [0x7f7e7c67626b] [bt] (7) /home/jonny/.conda/envs/jonny_conda3/bin/python(_PyObject_MakeTpCall+0x22f) [0x556c7e81385f] [bt] (8) /home/jonny/.conda/envs/jonny_conda3/bin/python(_PyEval_EvalFrameDefault+0x475) [0x556c7e896e35]
lingfanyu commented 3 years ago

Hi @JonnyTran

Which version of DGL and DGLKE are you using?

If you'd like to use the latest version of DGL, you probably also need to use the latest version of DGLKE as well so that they are compatible.

JonnyTran commented 3 years ago

My DGL version is 0.6.1 and DGLKE version is 0.1.2. I edited more info above.

lingfanyu commented 3 years ago

I found a similar issue in DGL-KE and the author of DGL-KE says only DGL 0.4 is supported.

Since NARS only uses DGL-KE as a third-party tool to generate graph embedding, we can't fix the compatibility issue that DGL-KE has. I would recommend just creating a virtual environment and installing DGL 0.4.

JonnyTran commented 3 years ago

Thanks for that. Since the issue is not related to NARS, I'll close this.