unsloth
unsloth copied to clipboard
ImportError: cannot import name 'BaseTrainer' from 'trl.trainer.alignprop_trainer'
Hi,
I keep running into the same error when trying to run the GRPO tutorial notebook locally:
When import unsloth
from unsloth import FastLanguageModel, PatchFastRL
I get the following error:
File ~/.../unsloth_compiled_cache/UnslothAlignPropTrainer.py:5
4 from torch.nn import functional as F
...
----> 5 from trl.trainer.alignprop_trainer import (Accelerator, AlignPropConfig, AlignPropTrainer, Any, BaseTrainer, Callable, DDPOStableDiffusionPipeline, MODEL_CARD_TEMPLATE, Optional, ProjectConfiguration, Tuple, defaultdict, logger, os, set_seed, torch, warn, warnings, whoami)
8 import os
9 from typing import *
ImportError: cannot import name 'BaseTrainer' from 'trl.trainer.alignprop_trainer'
I have the following versions:
Python = 3.11.11
torch = 2.5.1+cu124
trl = 0.15.2
diffusers = 0.32.2
unsloth = 2025.3.7
unsloth_zoo = 2025.3.5
vllm = 0.7.3
Do you have any idea how this could be solved?
Could you try reinstalling Unsloth - I just added a fix: pip install --upgrade --force-reinstall --no-deps unsloth unsloth_zoo
I am unsure what fixed this issue, but reinstalling the newest versions did the trick! Many thanks for your help! Closing the issue