Unverified Commit 03885a3f authored by Ayal Klein's avatar Ayal Klein Committed by GitHub
Browse files

fix to issue #14833 in data_collator - consider no labels (#14930)

parent 501307b5
...@@ -591,7 +591,11 @@ class DataCollatorForSeq2Seq: ...@@ -591,7 +591,11 @@ class DataCollatorForSeq2Seq:
) )
# prepare decoder_input_ids # prepare decoder_input_ids
if self.model is not None and hasattr(self.model, "prepare_decoder_input_ids_from_labels"): if (
labels is not None
and self.model is not None
and hasattr(self.model, "prepare_decoder_input_ids_from_labels")
):
decoder_input_ids = self.model.prepare_decoder_input_ids_from_labels(labels=features["labels"]) decoder_input_ids = self.model.prepare_decoder_input_ids_from_labels(labels=features["labels"])
features["decoder_input_ids"] = decoder_input_ids features["decoder_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