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
d337631b
Unverified
Commit
d337631b
authored
Apr 28, 2023
by
Younes Belkada
Committed by
GitHub
Apr 28, 2023
Browse files
🚨
🚨
🚨
[`Blip`] remove labels masking (#23024)
* remove labels masking * add fix on blip tf
parent
c2c99dc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
4 deletions
+0
-4
src/transformers/models/blip/modeling_blip.py
src/transformers/models/blip/modeling_blip.py
+0
-2
src/transformers/models/blip/modeling_tf_blip.py
src/transformers/models/blip/modeling_tf_blip.py
+0
-2
No files found.
src/transformers/models/blip/modeling_blip.py
View file @
d337631b
...
@@ -1218,8 +1218,6 @@ class BlipForQuestionAnswering(BlipPreTrainedModel):
...
@@ -1218,8 +1218,6 @@ class BlipForQuestionAnswering(BlipPreTrainedModel):
if
labels
is
not
None
and
decoder_input_ids
is
None
:
if
labels
is
not
None
and
decoder_input_ids
is
None
:
# get decoder inputs from shifting lm labels to the right - this is used in training mode
# get decoder inputs from shifting lm labels to the right - this is used in training mode
decoder_input_ids
=
self
.
_shift_right
(
labels
)
decoder_input_ids
=
self
.
_shift_right
(
labels
)
# replace possible -100 values in labels by `pad_token_id`
labels
=
labels
.
masked_fill
(
labels
==
self
.
decoder_pad_token_id
,
-
100
)
answer_output
=
self
.
text_decoder
(
answer_output
=
self
.
text_decoder
(
input_ids
=
decoder_input_ids
,
input_ids
=
decoder_input_ids
,
...
...
src/transformers/models/blip/modeling_tf_blip.py
View file @
d337631b
...
@@ -1452,8 +1452,6 @@ class TFBlipForQuestionAnswering(TFBlipPreTrainedModel):
...
@@ -1452,8 +1452,6 @@ class TFBlipForQuestionAnswering(TFBlipPreTrainedModel):
if
labels
is
not
None
and
decoder_input_ids
is
None
:
if
labels
is
not
None
and
decoder_input_ids
is
None
:
# get decoder inputs from shifting lm labels to the right - this is used in training mode
# get decoder inputs from shifting lm labels to the right - this is used in training mode
decoder_input_ids
=
self
.
_shift_right
(
labels
)
decoder_input_ids
=
self
.
_shift_right
(
labels
)
# replace possible -100 values in labels by `pad_token_id`
labels
=
tf
.
where
(
labels
==
self
.
decoder_pad_token_id
,
-
100
,
labels
)
answer_output
=
self
.
text_decoder
(
answer_output
=
self
.
text_decoder
(
input_ids
=
decoder_input_ids
,
input_ids
=
decoder_input_ids
,
...
...
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