xiangwang1223 / knowledge_graph_attention_network

KGAT: Knowledge Graph Attention Network for Recommendation, KDD2019
MIT License
1.06k stars 311 forks source link

AttributeError: 'KGAT' object has no attribute 'ua_embeddings' #10

Open liupenggg opened 5 years ago

liupenggg commented 5 years ago

AttributeError: 'KGAT' object has no attribute 'ua_embeddings' ??

xiangwang1223 commented 4 years ago

?? Sorry. Others using the codes do not have the error.

Aliang-CN commented 4 years ago

我也遇到了这个问题

xiangwang1223 commented 4 years ago

hi, could you please show me your running command & parameter settings?

Aliang-CN commented 4 years ago

WARNING:tensorflow:From D:\Program Files\anaconda3\envs\data_analysis\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. using xavier initialization Traceback (most recent call last): File "D:\Program Files\anaconda3\envs\data_analysis\lib\site-packages\IPython\core\interactiveshell.py", line 3325, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in runfile('E:/project/knowledge_graph_attention_network-master/Model/Main.py', wdir='E:/project/knowledge_graph_attention_network-master/Model') File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:/project/knowledge_graph_attention_network-master/Model/Main.py", line 158, in model = KGAT(data_config=config, pretrain_data=pretrain_data, args=args) File "E:\project\knowledge_graph_attention_network-master\Model\KGAT.py", line 29, in init self._build_model_phase_I() File "E:\project\knowledge_graph_attention_network-master\Model\KGAT.py", line 136, in _build_model_phase_I self.u_e = tf.nn.embedding_lookup(self.ua_embeddings, self.users) AttributeError: 'KGAT' object has no attribute 'ua_embeddings'

Aliang-CN commented 4 years ago

这个比较诡异,我用pycharm run的时候会出现这个报错,如果在终端下run就不会报错,但是一直卡在without pretraining上。

DOGEE7 commented 4 years ago

你好,请问without pretraining这个问题你最后解决了吗,我也是因为这个问题!

Aliang-CN commented 4 years ago

换机器跑,我换了1080ti跑,跑一个epoch要600s吧

liupenggg commented 4 years ago

1660ti能跑吗

Aliang-CN commented 4 years ago

1660ti应该可以跑吧,不过应该很慢很慢

diaoyudiaochan commented 4 years ago

大家好,请问AttributeError: 'KGAT' object has no attribute 'ua_embeddings'这个问题你们都是则么解决的呀 非常感谢! Hello everyone, please tell me how to solve AttributeError: 'KGAT' object has no attribute 'ua_embeddings' . thank you very very much!

quanjing commented 4 years ago

同样遇到了这个问题。。。

gxw928 commented 4 years ago

我也有这个问题: Traceback (most recent call last): File "E:\eclipse_workspace\knowledge_graph_attention_network-master\Model\Main.py", line 94, in model = KGAT(data_config=config, pretrain_data=pretrain_data, args=args) File "E:\eclipse_workspace\knowledge_graph_attention_network-master\Model\KGAT.py", line 38, in init self._build_model_phase_I() File "E:\eclipse_workspace\knowledge_graph_attention_network-master\Model\KGAT.py", line 176, in _build_model_phase_I self.u_e = tf.nn.embedding_lookup(self.ua_embeddings, self.users) AttributeError: 'KGAT' object has no attribute 'ua_embeddings'

wuziteng commented 4 years ago

这个比较诡异,我用pycharm run的时候会出现这个报错,如果在终端下run就不会报错,但是一直卡在without pretraining上。

我在终端跑也是出现 without pretrain,之后就没反应了

xiangwang1223 commented 4 years ago

Hi all,

  1. Please use the command of README in the terminal to run the code. 请在命令行中使用README中的命令;
  2. GPU is recommended to run the code. 推荐使用GPU去跑代码,一般卡在without pretrain是由于使用CPU计算时间过长导致的。
  3. You can set the larger batch size to speed up. 如果使用GPU但是每个epoch时间太久的话,可以适当增大batch size来提速。

希望能解决各位的疑惑。

wuziteng commented 4 years ago

Hi all,

1. Please use the command of README in the terminal to run the code. 请在命令行中使用README中的命令;

2. GPU is recommended to run the code. 推荐使用GPU去跑代码,一般卡在without pretrain是由于使用CPU计算时间过长导致的。

3. You can set the larger batch size to speed up. 如果使用GPU但是每个epoch时间太久的话,可以适当增大batch size来提速。

希望能解决各位的疑惑。

谢谢作者,但是上面的这个AttributeError: 'KGAT' object has no attribute 'ua_embeddings'一直没解决

xiangwang1223 commented 4 years ago

请问你运行的命令是什么呢?

wuziteng commented 4 years ago

python Main.py --model_type kgat --alg_type ngcf --adj_type bi --dataset yelp2018 --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

Hi all,

1. Please use the command of README in the terminal to run the code. 请在命令行中使用README中的命令;

2. GPU is recommended to run the code. 推荐使用GPU去跑代码,一般卡在without pretrain是由于使用CPU计算时间过长导致的。

3. You can set the larger batch size to speed up. 如果使用GPU但是每个epoch时间太久的话,可以适当增大batch size来提速。

希望能解决各位的疑惑。

python Main.py --model_type kgat --alg_type ngcf --adj_type bi --dataset yelp2018 --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

xiangwang1223 commented 4 years ago

请把--alg_type ngcf换成--alg_type bi试一下。 readme中有标注,alg_type参数的选值在[kgat, gcn, graphsage],我这里没有写清楚kgat和bi相等,稍后会更新一下代码。