"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "0afa5071bd84e44301750fdc594e33db102cf374"
Unverified Commit d337631b authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

🚨🚨🚨 [`Blip`] remove labels masking (#23024)

* remove labels masking

* add fix on blip tf
parent c2c99dc7
...@@ -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,
......
...@@ -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,
......
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