Skip to content

The problem about the beginning index #2

@Loose-Gu

Description

@Loose-Gu

The scorer computes the scores by sequence_cross_entropy_with_logits(). I notice that the begining index of the para is different from the implementation in EPR.
in UDR:
loss_list = sequence_cross_entropy_with_logits(logits=output.logits[:, :-1].contiguous(), targets=entry.input_ids[:, 1:].contiguous(), weights=pad_mask, average=None)
in EPR:
loss_list = sequence_cross_entropy_with_logits(logits=output.logits, targets=entry.input_ids[:,1:], weights=pad_mask, average=None)
So I wander what actually the input is and find this in scorer_dsr.py
tokenized_example = self.tokenizer.encode_plus(enc_text, truncation=True, add_special_tokens=False, return_tensors='pt') tokenized_labels = self.tokenizer.encode_plus(test_answer, truncation=True, add_special_tokens=False, return_tensors='pt')
Since the special tokens aren't add into the inputs, Why do we need to exclude the first of the inputs and the end of the logits?

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