awslabs / dgl-ke

High performance, easy-to-use, and scalable package for learning large-scale knowledge graph embeddings.
https://dglke.dgl.ai/doc/
Apache License 2.0
1.25k stars 194 forks source link

Issues with dglke_emb_sim #253

Open Maristela-de-Jesus opened 2 years ago

Maristela-de-Jesus commented 2 years ago

Hi,

I would like to find the similarity scores of TransE, and I am finding the same error as this one https://github.com/awslabs/dgl-ke/issues/160

!DGLBACKEND=pytorch dglke_emb_sim --model_path ./wikimedia/TransE_l2_wikimedia_0/ \
--format 'h_*_*' --data_files head.list \
--score_func none --topK 10 --gpu 0

The results:

usage: dglke_emb_sim [-h] [--mfile MFILE] [--emb_file EMB_FILE]
                     [--format FORMAT]
                     [--data_files DATA_FILES [DATA_FILES ...]] [--raw_data]
                     [--exec_mode EXEC_MODE] [--topK TOPK]
                     [--sim_func SIM_FUNC] [--output OUTPUT] [--gpu GPU]
dglke_emb_sim: error: unrecognized arguments: --model_path ./wikimedia/TransE_l2_wikimedia_0/ --score_func none

I saw the suggestion to use dglke_predict instead, but I would need to use dglke_emb_sim to check the node similarities.

Any idea how I can solve this?

Thank you!

classicsong commented 2 years ago

dglke_emb_sim accepts embedding files, i.e., --emb_file instead of --model_path

Maristela-de-Jesus commented 2 years ago

Thank you for your answer, @classicsong :)

I changed to --emb_file. However, the score_func seems to be not an acceptable args.

I also tried --score_func logsigmoid, but it still didn't work.

Updated code:

!DGLBACKEND=pytorch dglke_emb_sim --emb_file ./wikimedia/TransE_l2_wikimedia_0/wikimedia_TransE_l2_entity.npy \
--format 'h_*_*' --data_files head.list \
--score_func none --topK 10

Result:

usage: dglke_emb_sim [-h] [--mfile MFILE] [--emb_file EMB_FILE]
                     [--format FORMAT]
                     [--data_files DATA_FILES [DATA_FILES ...]] [--raw_data]
                     [--exec_mode EXEC_MODE] [--topK TOPK]
                     [--sim_func SIM_FUNC] [--output OUTPUT] [--gpu GPU]
dglke_emb_sim: error: unrecognized arguments: --score_func none

Thank you :)

classicsong commented 2 years ago

You do not need to specify score_func as this is for entity embedding similarity.