uclnlp / cqd

Continuous Query Decomposition for Complex Query Answering in Incomplete Knowledge Graphs
MIT License
95 stars 11 forks source link

Answering queries with CQD Error #4

Closed Joyrocky closed 3 years ago

Joyrocky commented 3 years ago

When I have trained the model, I followed the the path to answer the question but it showed that missing the entity2text.text .Could you please give some suggestions to slove the problems? thx!😊

image

dfdazac commented 3 years ago

@Joyrocky thank you for pointing this out! I have merged a fix for this, please let me know if you still have any issues with the code after pulling the changes.

pminervini commented 3 years ago

Hi @Joyrocky, we also implemented CQD in the KGReasoning framework, which supports experimenting with the Query2Box and BetaE datasets; our code is available at this link: https://github.com/pminervini/KGReasoning/

Joyrocky commented 3 years ago

@Joyrocky thank you for pointing this out! I have merged a fix for this, please let me know if you still have any issues with the code after pulling the changes.

image image I am sorry to bother that when I run the answering step, there is always a collapse about the memory, do you have some suggestions for me to solve this, thx!

pminervini commented 3 years ago

Thank you for getting back, let me look into this

pminervini commented 3 years ago

Hello @Joyrocky, setting the number of candidates (k in the paper, --candidates flag on the command line) to e.g. 4 fixes the problem! Try replacing --candidates 64 with --candidates 4, and everything should be fine.

On a side note, you may want to a different value of k for each different query type: in most cases, using very large k values will work very well in terms of downstream accuracy, and the GPU memory usage will be feasible. The code on this repo needs to be adapted a bit (I can do it this weekend), but the KGReasoning repo I linked earlier allows to do this already.

Joyrocky commented 3 years ago

Hello @Joyrocky, setting the number of candidates (k in the paper, --candidates flag on the command line) to e.g. 4 fixes the problem! Try replacing --candidates 64 with --candidates 4, and everything should be fine.

On a side note, you may want to a different value of k for each different query type: in most cases, using very large k values will work very well in terms of downstream accuracy, and the GPU memory usage will be feasible. The code on this repo needs to be adapted a bit (I can do it this weekend), but the KGReasoning repo I linked earlier allows to do this already.

Ok, I have get it. Then I got this, maybe this module have some redundant code? image

PavlidisAris commented 2 years ago

Hello @pminervini , When I'm executing your program, at any model you have, even if I'm training any model again, I'm receiving the error showed in this picture. Do you know how could I fix it? Thanks a lot 2022-05-11

pminervini commented 2 years ago

@osoblanco this was resolved in the past, right?

@PavlidisAris @Joyrocky, we incorporated CQD in the KGReasoning framework, it may be easier to use that instead: https://github.com/pminervini/KGReasoning/

osoblanco commented 2 years ago

@PavlidisAris it seems that the error occurs because at least one of the tasks you are trying/training/inferring with is outside the set we provide here

https://github.com/uclnlp/cqd/blob/36148c110f336415250c98873fc27ca847741a78/kbc/utils.py#L141

Can you please share the command you are using ? It seems the graph_type is incorrect.

PavlidisAris commented 2 years ago

@PavlidisAris it seems that the error occurs because at least one of the tasks you are trying/training/inferring with is outside the set we provide here

https://github.com/uclnlp/cqd/blob/36148c110f336415250c98873fc27ca847741a78/kbc/utils.py#L141

Can you please share the command you are using ? It seems the graph_type is incorrect.

Thanks for your rapidly answer The command that I'm using is: !python3 kbc/cqd_beam.py --model_path models/NELL-model-rank-100-epoch-50-1602489428.pt --dataset NELL --mode test --t_norm product --candidates 8 --scores_normalize 0 data/NELL

This is the last command. I tried much more commands depending the model I use, but the problem still remains.

PavlidisAris commented 2 years ago

Dear Pasquale,

Thanks for your suggestion for the KGReasoning framework. It works well. I reduce some parameters of a command in order of faster loading. The model loaded completely. Now, what? How can I ask the model a question? Are there any demo for viewing?

Thanks for your time Aris


From: Pasquale Minervini @.> Sent: Wednesday, May 11, 2022 6:34:50 PM To: uclnlp/cqd @.> Cc: PavlidisAris @.>; Mention @.> Subject: Re: [uclnlp/cqd] Answering queries with CQD Error (#4)

@osoblancohttps://github.com/osoblanco this was resolved in the past, right?

@PavlidisArishttps://github.com/PavlidisAris @Joyrockyhttps://github.com/Joyrocky, we incorporated CQD in the KGReasoning framework, it may be easier to use that instead: https://github.com/pminervini/KGReasoning/

— Reply to this email directly, view it on GitHubhttps://github.com/uclnlp/cqd/issues/4#issuecomment-1123938216, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIWD5H6GQL7ZO7OV2JSTRNLVJPHRVANCNFSM5BFRMZKQ. You are receiving this because you were mentioned.Message ID: @.***>

pminervini commented 2 years ago

@PavlidisAris sure! Here's how to use the CQD implementation in KGReasoning on the validation and test complex queries: https://github.com/pminervini/KGReasoning/blob/main/CQD.md

PavlidisAris commented 2 years ago

Thank you very much for your quick answer. I'm sure that I don't understand very good something. I'm running a model in cmd environment, it's completely loaded and that's it. Nothing moreover happens. How can I ask a question to the model? Thanks for your time.

Aris


Από: Pasquale Minervini @.> Eστάλη: Τρίτη, 7 Ιουνίου 2022, 09:37 Προς: uclnlp/cqd @.> Κοιν.: PavlidisAris @.>; Mention @.> Θέμα: Re: [uclnlp/cqd] Answering queries with CQD Error (#4)

@PavlidisArishttps://github.com/PavlidisAris sure! Here's how to use the CQD implementation in KGReasoning on the validation and test complex queries: https://github.com/pminervini/KGReasoning/blob/main/CQD.md

— Reply to this email directly, view it on GitHubhttps://github.com/uclnlp/cqd/issues/4#issuecomment-1148255450, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIWD5H6P6SXEYIEPCFHTCRLVN3U3HANCNFSM5BFRMZKQ. You are receiving this because you were mentioned.Message ID: @.***>

pminervini commented 2 years ago

@PavlidisAris the code is not supposed to work interactively -- what command line did you use?

PavlidisAris commented 2 years ago

Good morning Pasquale, The command that I was used is shown below python3 main.py --do_test --data_path data/FB15k-q2b -n 1 -b 1000 -d 1000 --cpu_num 0 --geo cqd --tasks 1p --print_on_screen --test_batch_size 1 --checkpoint_path models/fb15k-q2b --cqd discrete

Using the above command, the data loaded correctly, the evaluation of dataset completely OK and that's all. After all, I want to ask e.g. the question of your paper, you know this one: “In what genres of moviesdid Martin Lawrence appear?” My question is "how can I do that?"  Depending of your previous answer, I can't, if I'm understanding well. I'm postgraduate student and your work is my homework. I'd like to show a demo how this program is working if it possible. Thanks a lot Aris

Στις Τετάρτη 8 Ιουνίου 2022, 08:51:20 π.μ. EEST, ο χρήστης Pasquale Minervini ***@***.***> έγραψε:  

@PavlidisAris the code is not supposed to work interactively -- what command line did you use?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

pminervini commented 2 years ago

@PavlidisAris I see! Interactive mode is not supported atm, the code "only" allows you to evaluate on a set of validation and test queries.

Maybe the easiest way to go about this is to create a new test dataset containing your test query, and edit the code to e.g. print the top k answers together with their score

PavlidisAris commented 2 years ago

Thank you very very much for your answers and for your time.

Λήψη Outlook για Androidhttps://aka.ms/AAb9ysg


From: Pasquale Minervini @.> Sent: Sunday, June 12, 2022 1:58:39 PM To: uclnlp/cqd @.> Cc: PavlidisAris @.>; Mention @.> Subject: Re: [uclnlp/cqd] Answering queries with CQD Error (#4)

@PavlidisArishttps://github.com/PavlidisAris I see! Interactive mode is not supported atm, the code "only" allows you to evaluate on a set of validation and test queries.

Maybe the easiest way to go about this is to create a new test dataset containing your test query, and edit the code to e.g. print the top k answers together with their score

— Reply to this email directly, view it on GitHubhttps://github.com/uclnlp/cqd/issues/4#issuecomment-1153128603, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIWD5H2HVWRK7NVZKINO3CDVOW7F7ANCNFSM5BFRMZKQ. You are receiving this because you were mentioned.Message ID: @.***>