Skip to content

[Bug] On import NameError: name 'PreTrainedConfig' is not defined. Did you mean: 'PretrainedConfig'? #3415

@vilhub

Description

@vilhub
  1. Did you update? pip install --upgrade unsloth unsloth_zoo Yes, latest stable
  2. Colab or Kaggle or local / cloud: local
  3. Number GPUs used, use nvidia-smi: 1
  4. Which notebook? Please link! Just running "import unsloth"
  5. Which Unsloth version, TRL version, transformers version, PyTorch version? Latest unsloth stable, transformers main branch
import unsloth

A new commit in transformers (163601c6197e2addccd30d9bf450f664766f2e71) today breaks unsloth import, results in

srun --gres=gpu:1 --pty python -c "import unsloth"
🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/***/env/lib/python3.12/site-packages/unsloth/__init__.py", line 261, in <module>
    from .models import *
  File "/home/***/env/lib/python3.12/site-packages/unsloth/models/__init__.py", line 15, in <module>
    from .llama     import FastLlamaModel
  File "/home/***/env/lib/python3.12/site-packages/unsloth/models/llama.py", line 20, in <module>
    from ._utils import *
  File "/home/***/env/lib/python3.12/site-packages/unsloth/models/_utils.py", line 466, in <module>
    exec(config, globals())
  File "<string>", line 1, in <module>
NameError: name 'PreTrainedConfig' is not defined. Did you mean: 'PretrainedConfig'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions