Skip to content

a logic error in _preprocess function of Qwen2VLImageProcessor Class #37064

Closed
@InsaneGe

Description

@InsaneGe

System Info

in the _preprocess function of Qwen2VLImageProcessor Class(

repeats = np.repeat(patches[-1][np.newaxis], temporal_patch_size - 1, axis=0)
), it writes down as follows:

if patches.shape[0] % temporal_patch_size != 0:
    repeats = np.repeat(patches[-1][np.newaxis], temporal_patch_size - 1, axis=0)
    patches = np.concatenate([patches, repeats], axis=0)
grid_t = patches.shape[0] // temporal_patch_size

it should repeat temporal_patch_size - (patches.shape[0] % temporal_patch_size) instead of temporal_patch_size - 1, to make sure patches.shape[0] can be divisible by temporal_patch_size.

if patches.shape[0] % temporal_patch_size != 0:
    repeats = np.repeat(patches[-1][np.newaxis], temporal_patch_size- (patches.shape[0] % temporal_patch_size), axis=0)
    patches = np.concatenate([patches, repeats], axis=0)

Who can help?

No response

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

nothing

Expected behavior

nothing

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