问题发生
第一次使用DGLke,用的是TransE_I2模型,不太懂它的原理,跟着官方文档修改了参数以后,出现了下面的问题,看不明白是发生了什么,也不知道从哪开始解决
问题相关代码,请勿粘贴截图
使用该命令:DGLBACKEND=pytorch dglke_train --dataset TE --data_path D:/personal path --data_files train.tsv valid.tsv test.tsv --format 'raw_udd_hrt' --model_name TransE_l2 --batch_size 2048 --neg_sample_size 256 --hidden_dim 400 --gamma 12.0 --lr 0.1 --max_step 100000 --log_interval 1000 --batch_size_eval 16 -adv --regularization_coef 1.00E-07 --test --num_thread 1 --gpu 0 --neg_sample_size_eval 10000 --async_update
运行结果及报错内容
D:\Software\anaconda3\envs\pytorch\lib\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)
D:\Software\anaconda3\envs\pytorch\lib\site-packages\dgl\base.py:45: DGLWarning: Keyword arguments ['readonly', 'multigraph', 'sort_csr'] are deprecated in v0.5, and can be safe
ly removed in all cases.
return warnings.warn(message, category=category, stacklevel=1)
Traceback (most recent call last):
File "D:\Software\anaconda3\envs\pytorch\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Software\anaconda3\envs\pytorch\lib\site-packages\dglke\dataloader\sampler.py", line 379, in create_sampler
return EdgeSampler(self.g,
File "D:\Software\anaconda3\envs\pytorch\lib\site-packages\dgl\contrib\sampling\sampler.py", line 662, in init
File "D:\Software\anaconda3\envs\pytorch\lib\site-packages\dgl\utils\internal.py", line 271, in toindex
return data if isinstance(data, Index) else Index(data, dtype)
File "D:\Software\anaconda3\envs\pytorch\lib\site-packages\dgl\utils\internal.py", line 26, in init
self._initialize_data(data)
File "D:\Software\anaconda3\envs\pytorch\lib\site-packages\dgl\utils\internal.py", line 33, in _initialize_data
self._dispatch(data)
File "D:\Software\anaconda3\envs\pytorch\lib\site-packages\dgl\utils\internal.py", line 58, in _dispatch
raise InconsistentDtypeException('Index data specified as %s, but got: %s' %
dgl.utils.internal.InconsistentDtypeException: DGL now requires the input tensor to have the same dtype as the graph index's dtype(which you can get by g.idype). Inde
x data specified as int64, but got: int32
我想要达到的结果
我想知道一下这样的报错是什么原因,怎么解决