Skip to content

Additional description information during testing(inference) #29

@meaningful96

Description

@meaningful96

I have a question about code implementation. First, in the doc.py section

def vectorize(self) -> dict:
head_desc, tail_desc = self.head_desc, self.tail_desc
if args.use_link_graph:
if len(head_desc.split()) < 20:
head_desc += ' ' + get_neighbor_desc(head_id=self.head_id, tail_id=self.tail_id)
if len(tail_desc.split()) < 20:
tail_desc += ' ' + get_neighbor_desc(head_id=self.tail_id, tail_id=self.head_id)

head_word = _parse_entity_name(self.head)
head_text = _concat_name_desc(head_word, head_desc)
hr_encoded_inputs = _custom_tokenize(text=head_text,
text_pair=self.relation)

head_encoded_inputs = _custom_tokenize(text=head_text)

tail_word = _parse_entity_name(self.tail)
tail_encoded_inputs = _custom_tokenize(text=_concat_name_desc(tail_word, tail_desc))

Looking at this part, when the number of tokens is less than 20, the description of the neighbors is included.
By the way, in the predict.py file

args.use_link_graph = self.train_args.use_link_graph
args.is_test = True

According to this part, additional description will be included in the test, so isn't the description of the tail, which is the correct answer, even though the problem solving in the knowledge graph is to match the tail when the head and relation are given?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions