Skip to content

Doesn't anyone see a problem with the code about the prompt construction for BERT-style transformer??? #40

@lovekittynine

Description

@lovekittynine
if 'gpt' not in self.args.model_name and 'megatron' not in self.args.model_name:
    # BERT-style model(bert风格句子构造, CLS开头, SEP结尾)
    return [[self.tokenizer.cls_token_id]  # [CLS]
            + prompt_tokens * self.template[0]
            + [self.tokenizer.mask_token_id]  # head entity
            + prompt_tokens * self.template[1]
            + self.tokenizer.convert_tokens_to_ids(self.tokenizer.tokenize(' ' + x_h))  # [MASK] (tail entity)
            + (prompt_tokens * self.template[2] if self.template[
                                                       2] > 0 else self.tokenizer.convert_tokens_to_ids(['.']))
            + [self.tokenizer.sep_token_id]
            ]

我不知道理解的对不对?按照论文中的意思,这里head entity中的mask_token_id和tail entity中x_h的编码id是不是写反了呢?因此对于bert-style的finetune实际上是在用head entity去预测head entity?而并非是head entity去预测tail entity??? @Life-0-1 @#12 @#15 @Xiao9905

所以用bert尝试复现的效果不行的,有没有可能是因为这里呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions