-
Notifications
You must be signed in to change notification settings - Fork 317
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
Reuse entity, item and user embeddings #29
Comments
And is it possible to save these vectors? |
Yes, you can save these embedding vectors via the codes like: knowledge_graph_attention_network/Model/Main.py Lines 170 to 177 in 530327a
Hope it can be helpful. |
I will try that Does the relation and entity make sense alone? Or do I have to combine them in some way? |
I think that storing the relation matrices and entity embeddings separately is reasonable, such that you can combine them later in flexible ways. |
Thank you for your response =D
I got it running and saved the embeddings like you showed me.
But now I'm trying to run with "real" data but I got some errors
I'm using my own KG data
I'm running with the following command
!python Main.py --model_type kgat --alg_type bi --dataset bh15 --regs
[1e-5,1e-5] --layer_size [64,32,16] --embed_size 64 --lr 0.001 --epoch 100
--verbose 50 --save_flag 1 --pretrain 1 --batch_size 256 --node_dropout
[0.1] --mess_dropout [0.1,0.1,0.1] --use_att True --use_kge True
And this is the data
[n_users, n_items]=[252346, 462485]
[n_train, n_test]=[722370, 80211]
[n_entities, n_relations, n_triples]=[483176, 5, 1593039]
[batch_size, batch_size_kg]=[256, 564]
And the error:
without pretraining.
Traceback (most recent call last):
File "/home/ec2-user/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/home/ec2-user/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/home/ec2-user/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[735522,32] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node gradients/SparseTensorDenseMatMul_251/SparseTensorDenseMatMul_grad/SparseTensorDenseMatMul}}]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.
I will try to understand what is happening but if you have any tips I would
appreciate it
Thanks
ps: I'm using tensorflow 2 but i dont think this is the problem
…On Mon, Jun 22, 2020 at 10:21 PM Xiang Wang ***@***.***> wrote:
I think that storing the relation matrices and entity embeddings
separately is reasonable, such that you can combine them later in flexible
ways.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB3D5F232X3GPFUSD6GNOCLRX77SXANCNFSM4OC63TRA>
.
|
@lfomendes Thanks a lot! |
I'm experimenting with KGAT using my own user-item and KG data.
But I would like to reuse all the embeddings generated during the recommendations in other models and to visualize/clusterize the items.
How can I do that?
Looking at the KGAT.py I see that you keep
all_weights['user_embed']
all_weights['entity_embed']
all_weights['relation_embed']
all_weights['trans_W']
Does it make sense to get the embeddings from the 'entity embed' or since you are using TransR they only make sense when I trasnform with a specific relation?
Thanks
The text was updated successfully, but these errors were encountered: