Skip to content

Fix for hardcoded final_labels to enable loss calculation in PaliGemma #30987

@ariG23498

Description

@ariG23498

I have encountered an issue with the current implementation where final_labels is hardcoded to None, which prevents the loss calculation even when labels is provided and not None.

Proposed Fix: Assign labels to final_labels. This way, final_labels can be None or have some value based on labels.

I have created a working fork demonstrating this fix, and it successfully generates loss:

Fork: https://github.com/ariG23498/transformers/tree/aritra/ft-paligemma
Colab Notebook: https://colab.research.google.com/drive/1W27YMyyQG2ynUo6BYvru2xkzCS8ff83m?usp=sharing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions