Hi, thank you for sharing your code!
When I run the cmd line:
python train.py --file model_setting/st-metanet.yaml --gpus 0 --epochs 200
The Traceback message likes:
/home/ypy/rec_sys/env_sb/lib/python3.6/site-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)'
Traceback (most recent call last):
File "train.py", line 172, in
main(args)
File "train.py", line 150, in main
metrics = [MAE(scaler), RMSE(scaler), IndexMAE(scaler, [0,1,2]), IndexRMSE(scaler, [0,1,2])],
File "train.py", line 72, in fit
self.process_data(epoch, train, metrics)
File "train.py", line 53, in process_data
outputs = [self.net(x, is_training) for x in zip(inputs)]
File "train.py", line 53, in
outputs = [self.net(x, is_training) for x in zip(inputs)]
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/mxnet/gluon/block.py", line 540, in call
out = self.forward(args)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/seq2seq.py", line 233, in forward
states = self.encoder(feature, data)
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/mxnet/gluon/block.py", line 540, in call
out = self.forward(args)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/seq2seq.py", line 52, in forward
_data = _data + g(data, feature)
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/mxnet/gluon/block.py", line 540, in call
out = self.forward(*args)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/graph.py", line 70, in forward
g = self.get_graph_on_ctx(state.context)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/graph.py", line 66, in get_graph_on_ctx
self.build_graph_on_ctx(ctx)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/graph.py", line 60, in build_graph_on_ctx
g.edata['dist'] = self.dist.as_in_context(ctx)
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/view.py", line 227, in setitem
self._graph._set_e_repr(self._etid, self._edges, {key: val})
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/heterograph.py", line 4135, in _set_e_repr
if F.context(val) != self.device:
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/backend/pytorch/tensor.py", line 99, in context
return input.device
AttributeError: 'NDArray' object has no attribute 'device'
Could you please help me fix this~
Waiting for your reply. Thanks a lot~
Hi, thank you for sharing your code! When I run the cmd line: python train.py --file model_setting/st-metanet.yaml --gpus 0 --epochs 200 The Traceback message likes:
/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/heterograph.py:72: DGLWarning: Recommend creating graphs by
main(args)
File "train.py", line 150, in main
metrics = [MAE(scaler), RMSE(scaler), IndexMAE(scaler, [0,1,2]), IndexRMSE(scaler, [0,1,2])],
File "train.py", line 72, in fit
self.process_data(epoch, train, metrics)
File "train.py", line 53, in process_data
outputs = [self.net(x, is_training) for x in zip(inputs)]
File "train.py", line 53, in
outputs = [self.net(x, is_training) for x in zip(inputs)]
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/mxnet/gluon/block.py", line 540, in call
out = self.forward(args)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/seq2seq.py", line 233, in forward
states = self.encoder(feature, data)
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/mxnet/gluon/block.py", line 540, in call
out = self.forward(args)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/seq2seq.py", line 52, in forward
_data = _data + g(data, feature)
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/mxnet/gluon/block.py", line 540, in call
out = self.forward(*args)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/graph.py", line 70, in forward
g = self.get_graph_on_ctx(state.context)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/graph.py", line 66, in get_graph_on_ctx
self.build_graph_on_ctx(ctx)
File "/home/ypy/rec_sys/ST-MetaNet/traffic-prediction/src/model/graph.py", line 60, in build_graph_on_ctx
g.edata['dist'] = self.dist.as_in_context(ctx)
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/view.py", line 227, in setitem
self._graph._set_e_repr(self._etid, self._edges, {key: val})
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/heterograph.py", line 4135, in _set_e_repr
if F.context(val) != self.device:
File "/home/ypy/rec_sys/env_sb/lib/python3.6/site-packages/dgl/backend/pytorch/tensor.py", line 99, in context
return input.device
AttributeError: 'NDArray' object has no attribute 'device'
dgl.graph(data)
instead ofdgl.DGLGraph(data)
. dgl_warning('Recommend creating graphs bydgl.graph(data)
' Traceback (most recent call last): File "train.py", line 172, inCould you please help me fix this~ Waiting for your reply. Thanks a lot~