[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
bbabd2365a
commit
b76ac12e31
2 changed files with 5 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -29,16 +29,20 @@ from unsloth_zoo.rl_replacements import RL_REPLACEMENTS, left_pack_padding
|
|||
from unsloth_zoo.utils import Version
|
||||
from importlib.metadata import version as importlib_version
|
||||
from unsloth_zoo.log import logger
|
||||
|
||||
# device_synchronize may not exist in older unsloth_zoo versions
|
||||
try:
|
||||
from unsloth_zoo.device_type import device_synchronize
|
||||
except ImportError:
|
||||
import torch
|
||||
|
||||
def device_synchronize():
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.synchronize()
|
||||
elif hasattr(torch, "xpu") and torch.xpu.is_available():
|
||||
torch.xpu.synchronize()
|
||||
|
||||
|
||||
import importlib.util
|
||||
from ..device_type import (
|
||||
is_hip,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue