Skip to content

Gemma Tokenizer add padding to the left, but the code to find sequence length assume pad tokens are added to the right #30004

Description

@binh-vu

Gemma Tokenizer add padding to the left, but the code to find sequence length assume pad tokens are added to the right

Reference:

sequence_lengths = torch.eq(input_ids, self.config.pad_token_id).int().argmax(-1) - 1
sequence_lengths = sequence_lengths % input_ids.shape[-1]
sequence_lengths = sequence_lengths.to(logits.device)

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