"docs/source/vscode:/vscode.git/clone" did not exist on "49c61a4ae7f269c5f590d62334c33832a29e0c7d"
Unverified Commit 6b7d6f84 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`Blip`] Fix blip doctest (#23698)

fix blip doctest
parent 876d9a32
......@@ -1200,6 +1200,10 @@ class BlipForQuestionAnswering(BlipPreTrainedModel):
return_dict=return_dict,
)
if labels is not None and decoder_input_ids is None:
# labels are already shifted right, see: https://github.com/huggingface/transformers/pull/23153
decoder_input_ids = labels
question_embeds = question_embeds[0] if not return_dict else question_embeds.last_hidden_state
answer_output = self.text_decoder(
......
......@@ -1416,6 +1416,10 @@ class TFBlipForQuestionAnswering(TFBlipPreTrainedModel):
question_embeds = question_embeds[0] if not return_dict else question_embeds.last_hidden_state
if labels is not None and decoder_input_ids is None:
# labels are already shifted right, see: https://github.com/huggingface/transformers/pull/23153
decoder_input_ids = labels
answer_output = self.text_decoder(
input_ids=decoder_input_ids,
attention_mask=decoder_attention_mask,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment