Skip to content

Gemma3 (and Paligemma) position_ids 1-indexed? #36856

@oceanusxiv

Description

@oceanusxiv

In the official google implementation of gemma3, all the position_id preparation indicates that position_ids are 0-indexed, the same is true of paligemma in big vision. https://github.com/google-deepmind/gemma/blob/91ee586fbb2f3b8bfeb07b99967008348a229689/gemma/transformer.py#L791.

However, in transformers

# position_ids in Gemma3 are 1-indexed
, it's stated that position_ids are 1-indexed, this seems like a weird discrepancy between model implementations, is this intended?

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