Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: loss@phase1 is nan. #45

Closed
ooobsidian opened this issue Mar 16, 2021 · 4 comments
Closed

ERROR: loss@phase1 is nan. #45

ooobsidian opened this issue Mar 16, 2021 · 4 comments

Comments

@ooobsidian
Copy link

ooobsidian commented Mar 16, 2021

您好,非常感谢您共享的如此优秀的代码,从github拉取代码后,我使用python Main.py --model_type kgat --alg_type bi --dataset last-fm --regs [1e-5,1e-5] --layer_size [64,32,16] --embed_size 64 --lr 0.0001 --epoch 1000 --verbose 50 --save_flag 1 --pretrain 0 --batch_size 1024 --node_dropout [0.1] --mess_dropout [0.1,0.1,0.1] --use_att True --use_kge True 训练模型,这里pretrain0,结果会报错ERROR: loss@phase1 is nan.。日志如下:

(KGAT) root@c34ffcf30357:/data/knowledge_graph_attention_network/Model# python Main.py --model_type kgat --alg_type bi --dataset last-fm --regs [1e-5,1e-5] --layer_size [64,32,16] --embed_size 64 --lr 0.0001 --epoch 1000 --verbose 50 --save_flag 1 --pretrain 0 --batch_size 1024 --node_dropout [0.1] --mess_dropout [0.1,0.1,0.1] --use_att True --use_kge True
[n_users, n_items]=[23566, 48123]
[n_train, n_test]=[1289003, 423635]
[n_entities, n_relations, n_triples]=[106389, 9, 464567]
[batch_size, batch_size_kg]=[1024, 369]
        convert ratings into adj mat done.
        convert 20 relational triples into adj mat done. @0.3366s
/data/knowledge_graph_attention_network/Model/utility/loader_kgat.py:87: RuntimeWarning: divide by zero encountered in power
  d_inv = np.power(rowsum, -1).flatten()
        generate si-normalized adjacency matrix.
        reordering indices...
        reorganize all kg data done.
        sort meta-data done.
        sort all data done.
using xavier initialization
#params: 8427280
without pretraining.
ERROR: loss@phase1 is nan.

另外当pretrain-1时,也会报这个错:

(KGAT) root@c34ffcf30357:/data/knowledge_graph_attention_network/Model# python Main.py --model_type kgat --alg_type bi --dataset last-fm --regs [1e-5,1e-5] --layer_size [64,32,16] --embed_size 64 --lr 0.0001 --epoch 1000 --verbose 50 --save_flag 1 --pretrain -1 --batch_size 1024 --node_dropout [0.1] --mess_dropout [0.1,0.1,0.1] --use_att True --use_kge True
[n_users, n_items]=[23566, 48123]
[n_train, n_test]=[1289003, 423635]
[n_entities, n_relations, n_triples]=[106389, 9, 464567]
[batch_size, batch_size_kg]=[1024, 369]
        convert ratings into adj mat done.
        convert 20 relational triples into adj mat done. @0.3448s
/data/knowledge_graph_attention_network/Model/utility/loader_kgat.py:87: RuntimeWarning: divide by zero encountered in power
  d_inv = np.power(rowsum, -1).flatten()
        generate si-normalized adjacency matrix.
        reordering indices...
        reorganize all kg data done.
        sort meta-data done.
        sort all data done.
load the pretrained bprmf model parameters.
using pretrained initialization
#params: 8427280
without pretraining.
ERROR: loss@phase1 is nan.

请问该如何解决呢?谢谢,期待您答复

@ooobsidian
Copy link
Author

是数据集的问题,已解决

@sungjun3010
Copy link

sungjun3010 commented May 16, 2021

@ooobsidian Hi there,

Could you tell me what's the problem of your dataset?
I've got ERROR: loss@phase2 is nan. :(

@ooobsidian
Copy link
Author

Please check your own data set carefully, the code of this project is no problem. You need to construct your own dataset according to the format of the dataset provided in the code to ensure the correctness of the number of entities and relationships.

@wei1826676931
Copy link

打扰一下老哥,请问这个项目下载好后,直接运行提供好的默认的数据集就会出现这个问题/错,难道提供的数据集格式有错的?还需要再修改一下提供的数据集吗?如何修改呢
谢谢你!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants