g1g122 2022-01-19 12:30 采纳率: 100%
浏览 169
已结题

使用DGLke训练模型出现下图错误

问题发生

第一次使用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

我想要达到的结果

我想知道一下这样的报错是什么原因,怎么解决

  • 写回答

3条回答 默认 最新

  • 有问必答小助手 2022-01-21 10:31
    关注

    你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


    本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


    因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 2月2日
  • 已采纳回答 1月25日
  • 创建了问题 1月19日

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改