diff --git a/unsloth/models/rl.py b/unsloth/models/rl.py index a323d2340e..8351cc932a 100755 --- a/unsloth/models/rl.py +++ b/unsloth/models/rl.py @@ -1916,6 +1916,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: