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
Hello, I am a Korean college student studying the BLIP paper. Before to start my English is limited, there may be some incorrect translations.
In HuggingFace's generation_utils.py
def _validate_model_kwargs(self, model_kwargs: Dict[str, Any]):
...
if "kwargs" in model_args:
model_args = set(inspect.signature(self.forward).parameters)
...
They checking the unsued_model_args for validating model kwargs with "kwargs". But BLIP use "model_kwargs" on code like below
def prepare_inputs_for_generation(self, input_ids, past=None, attention_mask=None, **model_kwargs):
input_shape = input_ids.shape
# if model is used as a decoder in encoder-decoder model, the decoder attention mask is created on the fly
if attention_mask is None:
attention_mask = input_ids.new_ones(input_shape)
# cut decoder_input_ids if past is used
if past is not None:
input_ids = input_ids[:, -1:]
return {
"input_ids": input_ids,
"attention_mask": attention_mask,
"past_key_values": past,
"encoder_hidden_states": model_kwargs.get("encoder_hidden_states", None),
"encoder_attention_mask": model_kwargs.get("encoder_attention_mask", None),
"is_decoder": True,
}
So my opinion is just modifies model_kwargs to kwargs like below
def prepare_inputs_for_generation(self, input_ids, past=None, attention_mask=None, **kwargs):
input_shape = input_ids.shape
# if model is used as a decoder in encoder-decoder model, the decoder attention mask is created on the fly
if attention_mask is None:
attention_mask = input_ids.new_ones(input_shape)
# cut decoder_input_ids if past is used
if past is not None:
input_ids = input_ids[:, -1:]
return {
"input_ids": input_ids,
"attention_mask": attention_mask,
"past_key_values": past,
"encoder_hidden_states": kwargs.get("encoder_hidden_states", None),
"encoder_attention_mask": kwargs.get("encoder_attention_mask", None),
"is_decoder": True,
}
Thank you to read this issue
The text was updated successfully, but these errors were encountered:
Hello, I am a Korean college student studying the BLIP paper. Before to start my English is limited, there may be some incorrect translations.
In HuggingFace's
generation_utils.py
They checking the
unsued_model_args
for validating model kwargs with "kwargs". But BLIP use "model_kwargs" on code like belowSo my opinion is just modifies
model_kwargs
tokwargs
like belowThank you to read this issue
The text was updated successfully, but these errors were encountered: