You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
My own task or dataset (give details below)
Reproduction
Steps to reproduce:
Load the Gemma 3 model locally using a pipeline with an image as input.
Ensure the do_pan_and_scan option is set to False.
Run the script — the error appears when the model tries to process the image input.
Expected behavior
It tries to process the image but encounters some logic errors, they are not major errors but little yet errors:
image_processing_gemma3_fast.py
Line 357: The code references images_list, but this variable is defined only inside the if do_pan_and_scan: condition. When do_pan_and_scan == False, images_list is never initialized, resulting in an UnboundLocalError.
image_text_to_text.py
Line 84: Inside the retrieve_images_in_messages() function, the variable idx_images must be incremented even when the first if condition is met. Otherwise, the final check at line 105 throws an IndexError due to a mismatch in the expected number of images.
I implemented the following changes, which resolved the issues:
In image_processing_gemma3_fast.py, replace:
num_crops = [[0] for images in images_list]
With:
num_crops = [[0] for _ in image_list]
In the same file, replace all references to images_list with image_list after the if do_pan_and_scan: condition to ensure consistency.
In image_text_to_text.py, modify line 84 to increment idx_images inside the first if block:
if key in content:
retrieved_images.append(content[key])
idx_images += 1 # Fix to ensure alignment in the list of images
The text was updated successfully, but these errors were encountered:
System Info
transformers
version: 4.50.0.dev0Who can help?
@amyeroberts
@qubvel
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Steps to reproduce:
Expected behavior
It tries to process the image but encounters some logic errors, they are not major errors but little yet errors:
image_processing_gemma3_fast.py
Line 357: The code references images_list, but this variable is defined only inside the if do_pan_and_scan: condition. When do_pan_and_scan == False, images_list is never initialized, resulting in an UnboundLocalError.
image_text_to_text.py
Line 84: Inside the retrieve_images_in_messages() function, the variable idx_images must be incremented even when the first if condition is met. Otherwise, the final check at line 105 throws an IndexError due to a mismatch in the expected number of images.
I implemented the following changes, which resolved the issues:
In image_processing_gemma3_fast.py, replace:
num_crops = [[0] for images in images_list]
With:
num_crops = [[0] for _ in image_list]
In the same file, replace all references to images_list with image_list after the if do_pan_and_scan: condition to ensure consistency.
In image_text_to_text.py, modify line 84 to increment idx_images inside the first if block:
if key in content:
retrieved_images.append(content[key])
idx_images += 1 # Fix to ensure alignment in the list of images
The text was updated successfully, but these errors were encountered: