Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/transformers/models/blip/modeling_blip.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def forward(

>>> outputs = model(**inputs)
```"""
batch_size = pixel_values.shape[0]
pixel_values.shape[0]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can be removed as well

return_dict = return_dict if return_dict is not None else self.config.use_return_dict

vision_outputs = self.vision_model(
Expand All @@ -1002,12 +1002,6 @@ def forward(

image_embeds = vision_outputs[0]

if input_ids is None:
input_ids = torch.LongTensor([[self.decoder_input_ids] * batch_size]).to(image_embeds.device)

if labels is None:
labels = input_ids.masked_fill(input_ids == self.decoder_pad_token_id, -100)

outputs = self.text_decoder(
input_ids=input_ids,
attention_mask=attention_mask,
Expand Down