Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6b7d6f84
Unverified
Commit
6b7d6f84
authored
May 23, 2023
by
Younes Belkada
Committed by
GitHub
May 23, 2023
Browse files
[`Blip`] Fix blip doctest (#23698)
fix blip doctest
parent
876d9a32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
src/transformers/models/blip/modeling_blip.py
src/transformers/models/blip/modeling_blip.py
+4
-0
src/transformers/models/blip/modeling_tf_blip.py
src/transformers/models/blip/modeling_tf_blip.py
+4
-0
No files found.
src/transformers/models/blip/modeling_blip.py
View file @
6b7d6f84
...
@@ -1200,6 +1200,10 @@ class BlipForQuestionAnswering(BlipPreTrainedModel):
...
@@ -1200,6 +1200,10 @@ class BlipForQuestionAnswering(BlipPreTrainedModel):
return_dict
=
return_dict
,
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
question_embeds
=
question_embeds
[
0
]
if
not
return_dict
else
question_embeds
.
last_hidden_state
answer_output
=
self
.
text_decoder
(
answer_output
=
self
.
text_decoder
(
...
...
src/transformers/models/blip/modeling_tf_blip.py
View file @
6b7d6f84
...
@@ -1416,6 +1416,10 @@ class TFBlipForQuestionAnswering(TFBlipPreTrainedModel):
...
@@ -1416,6 +1416,10 @@ class TFBlipForQuestionAnswering(TFBlipPreTrainedModel):
question_embeds
=
question_embeds
[
0
]
if
not
return_dict
else
question_embeds
.
last_hidden_state
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
(
answer_output
=
self
.
text_decoder
(
input_ids
=
decoder_input_ids
,
input_ids
=
decoder_input_ids
,
attention_mask
=
decoder_attention_mask
,
attention_mask
=
decoder_attention_mask
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment