diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index 1427ca747f..80ddbf19a4 100644 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -1587,6 +1587,7 @@ def _patch_prepare_multimodal_messages(): # Also patch in grpo_trainer module if imported try: import trl.trainer.grpo_trainer as _gt + if hasattr(_gt, "prepare_multimodal_messages"): _gt.prepare_multimodal_messages = _safe_prepare_multimodal_messages except ImportError: