Skip to content

Error during video handling with Gemma4 (E2B-Instruct) #47879

Description

@anand-kumar-consulting

System Info

  • transformers version: 5.15.0.dev0
  • Platform: Linux-6.18.33.1-microsoft-standard-WSL2-x86_64-with-glibc2.43
  • Python version: 3.13.14
  • Huggingface_hub version: 1.24.0
  • Safetensors version: 0.8.0
  • Accelerate version: 1.14.0
  • Accelerate config: not found
  • DeepSpeed version: not installed
  • PyTorch version (accelerator?): 2.13.0+cu132 (CUDA)
  • Using distributed or parallel set-up in script?: No
  • Using GPU in script?: Not clear.
  • GPU type: NVIDIA GeForce RTX 4080 Laptop GPU

Who can help?

@molbap @guarin

The issue is with the vision model (Gemma4-E2B-IT)

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

File ".../transformers/models/gemma4/modeling_gemma4.py", line 2344, in forward
video_features = video_features.to(inputs_embeds.device, inputs_embeds.dtype)
                 ^^^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'to'

The error is resolved on changing the code to:

video_features = video_features[0].to(inputs_embeds.device, inputs_embeds.dtype)

Expected behavior

The code works well by making the aforementioned change (which should be default behaviour).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions