Skip to content

num_query_tokens of blip2 might be None #42203

@HYLcool

Description

@HYLcool

System Info

transformers>=4.55.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

Hi, the code below did not check if the self.num_query_tokens is None, but in the __init__ method, the default value for this variable is None, which might cause error like:

TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'

if max_length is not None:
output_kwargs["text_kwargs"]["max_length"] = max_length - self.num_query_tokens

I tried kpyu/video-blip-opt-2.7b-ego4d in transformers>=4.55.0 and it failed.

Expected behavior

The model can be successfully used.

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