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
ValueError: Number of images does not match number of special image tokens in the input text. Got 256 image tokens in the text but 256 tokens from image embeddings.
#2751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
gemma has problem when passing input embedding to model.generate() function forced to pass **input_ids otherwise it causes this error
maybe Integer vs. Float Comparison:
When you calculate special_image_mask based on input_ids, the comparison is done between integer values, which gives exact results.
When comparing on inputs_embeds, you compare float vectors from the embedding layer with the embedding vector of the special token. Since float comparisons can have floating point precision issues, sometimes some values may be incorrectly identified (or have very small deviations that cause the comparison to return True or False inconsistently).
gemma has problem when passing input embedding to model.generate() function forced to pass **input_ids otherwise it causes this error
maybe Integer vs. Float Comparison:
When you calculate special_image_mask based on input_ids, the comparison is done between integer values, which gives exact results.
When comparing on inputs_embeds, you compare float vectors from the embedding layer with the embedding vector of the special token. Since float comparisons can have floating point precision issues, sometimes some values may be incorrectly identified (or have very small deviations that cause the comparison to return True or False inconsistently).
if using input embedding special_image_mask.sum() =tensor(655363, device='cuda:0'),
if using input_ids it is equal to tensor(655360, device='cuda:0')
The text was updated successfully, but these errors were encountered: