mickeysjm / TaxoExpan

The source code used for self-supervised taxonomy expansion method TaxoExpan, published in WWW 2020
Apache License 2.0
75 stars 18 forks source link

Error during training #2

Open jinfenglin opened 3 years ago

jinfenglin commented 3 years ago

Hi, I am trying to run the training but got the error as follows, it indicates the graph and feature are not in the same device. Would you please help me to find out if I am doing anything wrong? I just utilize the configuration file config.mag.json Thanks,


Traceback (most recent call last):
  File "TaxoExpan/train.py", line 88, in <module>
    main(config)
  File "TaxoExpan/train.py", line 46, in main
    trainer.train()
  File "G:\Projects\FSE2021\ontology_construction\TaxoExpan\base\base_trainer.py", line 64, in train
    result = self._train_epoch(epoch)
  File "G:\Projects\FSE2021\ontology_construction\TaxoExpan\trainer\trainer.py", line 51, in _train_epoch
    prediction = self.model(bg, h, nf)
  File "C:\Users\ljfnw\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "G:\Projects\FSE2021\ontology_construction\TaxoExpan\model\model.py", line 84, in forward
    g.ndata['h'] = self.graph_propagate(g, h)
  File "C:\Users\ljfnw\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "G:\Projects\FSE2021\ontology_construction\TaxoExpan\model\model_zoo.py", line 215, in forward
    h = self.gat_layers[l](g, torch.cat((h, p), 1)).flatten(1)
  File "C:\Users\ljfnw\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\nn\modules\module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "G:\Projects\FSE2021\ontology_construction\TaxoExpan\model\model_zoo.py", line 86, in forward
    g.ndata['ft'] = ft
  File "C:\Users\ljfnw\AppData\Local\Programs\Python\Python37\lib\site-packages\dgl\view.py", line 81, in __setitem__
    self._graph._set_n_repr(self._ntid, self._nodes, {key : val})
  File "C:\Users\ljfnw\AppData\Local\Programs\Python\Python37\lib\site-packages\dgl\heterograph.py", line 3813, in _set_n_repr
    ' same device.'.format(key, F.context(val), self.device))
dgl._ffi.base.DGLError: Cannot assign node feature "ft" on device cuda:0 to a graph on device cpu. Call DGLGraph.to() to copy the graph to the same device.
'''
Dreamara commented 3 years ago

``You cannot copy the graph on the same device, provide a source for it.