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

KBQA extension #1598

Merged
merged 39 commits into from
May 13, 2023
Merged

KBQA extension #1598

merged 39 commits into from
May 13, 2023

Conversation

dmitrijeuseew
Copy link
Contributor

@dmitrijeuseew dmitrijeuseew commented Nov 8, 2022

Improvement of models for question answering over knowledge graphs.
Updated:

Added:

log.debug(f"(__call__)answers: {answers}")
if not answers:
answers = ["Not Found" for _ in question_batch]
return answers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What behavior do you expect from model, when chainer's element will return only one argument instead of two?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two options: if we want to perform rel ranking in query_generator component, then self.return_answers is true and we output answers, otherwise we output candidate_outputs_batch, template_answers_batch and perform ranking in a separate component of the chainer.

answers = ["Not Found" for _ in question_batch]
return answers
else:
return candidate_outputs_batch, template_answers_batch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't fit "out": ["answers", "answer_ids", "query"] in kbqa_cq_ru

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answers variable on 113 line is a tuple of "answers", "answer_ids", "query"

question_tokens = nltk.word_tokenize(question)
rels_scores_dict = {}
for query_info in queries_info:
parsed_query_info = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't needed to be declared here

Comment on lines 208 to 225
parsed_query_info["query_triplets"] = query_triplets
parsed_query_info["query_sequence"] = query_sequence
parsed_query_info["rels_from_query"] = rels_from_query
parsed_query_info["answer_ent"] = answer_ent
parsed_query_info["filter_info"] = filter_info
parsed_query_info["order_info"] = order_info
parsed_query_info["rel_types"] = rel_types
parsed_query_info["unk_rels"] = unk_rels
parsed_query_info["return_if_found"] = return_if_found
parsed_query_info["selected_entity_ids"] = selected_entity_ids
parsed_query_info["selected_type_ids"] = selected_type_ids
parsed_query_info["rels"] = rels
parsed_query_info["entities_rel_conn"] = entities_rel_conn
parsed_query_info["entity_combs"] = entity_combs
parsed_query_info["type_combs"] = type_combs
parsed_query_info["rel_combs"] = rel_combs
parsed_query_info["all_combs_list"] = all_combs_list
parsed_queries_info.append(parsed_query_info)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since parsed_query_info doesn't modified anywhere before this place, it's better to replace with

parsed_queries_info.append({
    "x": x,
    "y": y,
    ... etc
})



@register('query_formatter')
class QueryFormatter:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QueryFormatter(Component)

@IgnatovFedor IgnatovFedor merged commit d76a601 into dev May 13, 2023
@IgnatovFedor IgnatovFedor deleted the feat/kbqa_full branch May 13, 2023 10:15
@IgnatovFedor IgnatovFedor mentioned this pull request Jun 6, 2023
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

Successfully merging this pull request may close these issues.

4 participants