diff --git a/src/llamafactory/data/collator.py b/src/llamafactory/data/collator.py index db0562d9..3fb08f4b 100644 --- a/src/llamafactory/data/collator.py +++ b/src/llamafactory/data/collator.py @@ -176,7 +176,7 @@ class MultiModalDataCollatorForSeq2Seq(DataCollatorForSeq2Seq): "input_ids": features["input_ids"], "image_grid_thw": mm_inputs.get("image_grid_thw"), "video_grid_thw": mm_inputs.get("video_grid_thw"), - "attention_mask": features["attention_mask"], + "attention_mask": (features["attention_mask"] >= 1).float(), } if "second_per_grid_ts" in mm_inputs: # for qwen2vl rope_index_kwargs["second_per_grid_ts"] = mm_inputs.get("second_per_grid_ts")