Skip to content

[GroundingDino] - GroundingDinoProcessor kwargs is Broken #31952

@EduardoPach

Description

@EduardoPach

System Info

While working on #31828 I realized that GroundingDinoProcessor.__call__ passes the kwargs only to the self.tokenizer which is not ideal specially if one wants to pass annotations to self.image_processor as it's currently not possible.

It should be an easy fix following #31197

Who can help?

@amyeroberts

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

from transformers import AutoProcessor
from datasets import load_dataset

processor = AutoPocessor.from_pretrained("IDEA-Research/grounding-dino-tiny")
ds = load_dataset("EduardoPacheco/aquarium-sample", split="train")
id2label = {0: "fish", 1: "jellyfish", 2: "penguins", 3: "sharks", 4: "puffins", 5: "stingrays", 6: "starfish"}
prompt = ". ".join(id2label.values()) + "."

# Passes `annotations` as kwargs to tokenizer instead of image_processor
inputs = processor(images=ds["image"], text=[prompt, prompt], annotations=ds["annotations"], return_tensors="pt")

Expected behavior

Kwargs being correctly mapped to tokenizer and image processor

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