-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Description
System Info
- torch @ https://download.pytorch.org/whl/cu124/torch-2.6.0%2Bcu124-cp310-cp310-linux_x86_64.whl
- torchaudio @ https://download.pytorch.org/whl/cu124/torchaudio-2.6.0%2Bcu124-cp310-cp310-linux_x86_64.whl
- torchvision @ https://download.pytorch.org/whl/cu124/torchvision-0.21.0%2Bcu124-cp310-cp310-linux_x86_64.whl
- unsloth==2025.6.12
- unsloth_zoo==2025.6.8
- accelerate==1.8.1
- bitsandbytes==0.46.0
- pydantic==2.11.7
- pydantic_core==2.33.2
- tokenizers==0.21.2
- transformers==4.52.4
- treelite==4.4.1
- treescope==0.1.9
- triton==3.2.0
- trl==0.19.0
- xformers==0.0.29.post3
- sympy==1.13.1
- cut-cross-entropy==25.1.1
- Python 3.10.16
- NVIDIA A10G (CUDA Version: 12.5)
- Ubuntu 24.04.2 LTS
Who can help?
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examples
folder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
from transformers import AutoTokenizer
ModuleNotFoundError Traceback (most recent call last)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2045, in _LazyModule.getattr(self, name)
2044 try:
-> 2045 module = self._get_module(self._class_to_module[name])
2046 value = getattr(module, name)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2075, in _LazyModule._get_module(self, module_name)
2074 except Exception as e:
-> 2075 raise e
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2073, in _LazyModule._get_module(self, module_name)
2072 try:
-> 2073 return importlib.import_module("." + module_name, self.name)
2074 except Exception as e:
File /usr/local/lib/python3.10/importlib/init.py:126, in import_module(name, package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
File :1050, in _gcd_import(name, package, level)
File :1027, in find_and_load(name, import)
File :992, in find_and_load_unlocked(name, import)
File :241, in _call_with_frames_removed(f, *args, **kwds)
File :1050, in _gcd_import(name, package, level)
File :1027, in find_and_load(name, import)
File :1004, in find_and_load_unlocked(name, import)
ModuleNotFoundError: No module named 'transformers.models.ipynb_checkpoints'
The above exception was the direct cause of the following exception:
ModuleNotFoundError Traceback (most recent call last)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2045, in _LazyModule.getattr(self, name)
2044 try:
-> 2045 module = self._get_module(self._class_to_module[name])
2046 value = getattr(module, name)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2075, in _LazyModule._get_module(self, module_name)
2074 except Exception as e:
-> 2075 raise e
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2073, in _LazyModule._get_module(self, module_name)
2072 try:
-> 2073 return importlib.import_module("." + module_name, self.name)
2074 except Exception as e:
File /usr/local/lib/python3.10/importlib/init.py:126, in import_module(name, package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
File :1050, in _gcd_import(name, package, level)
File :1027, in find_and_load(name, import)
File :1006, in find_and_load_unlocked(name, import)
File :688, in _load_unlocked(spec)
File :883, in exec_module(self, module)
File :241, in _call_with_frames_removed(f, *args, **kwds)
File ~/.local/lib/python3.10/site-packages/transformers/models/encoder_decoder/configuration_encoder_decoder.py:20
19 from ...utils import logging
---> 20 from ..auto import AutoConfig
23 logger = logging.get_logger(name)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2048, in _LazyModule.getattr(self, name)
2047 except (ModuleNotFoundError, RuntimeError) as e:
-> 2048 raise ModuleNotFoundError(
2049 f"Could not import module '{name}'. Are this object's requirements defined correctly?"
2050 ) from e
2052 elif name in self._modules:
ModuleNotFoundError: Could not import module 'AutoConfig'. Are this object's requirements defined correctly?
The above exception was the direct cause of the following exception:
ModuleNotFoundError Traceback (most recent call last)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2045, in _LazyModule.getattr(self, name)
2044 try:
-> 2045 module = self._get_module(self._class_to_module[name])
2046 value = getattr(module, name)
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2075, in _LazyModule._get_module(self, module_name)
2074 except Exception as e:
-> 2075 raise e
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2073, in _LazyModule._get_module(self, module_name)
2072 try:
-> 2073 return importlib.import_module("." + module_name, self.name)
2074 except Exception as e:
File /usr/local/lib/python3.10/importlib/init.py:126, in import_module(name, package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
File :1050, in _gcd_import(name, package, level)
File :1027, in find_and_load(name, import)
File :1006, in find_and_load_unlocked(name, import)
File :688, in _load_unlocked(spec)
File :883, in exec_module(self, module)
File :241, in _call_with_frames_removed(f, *args, **kwds)
File ~/.local/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py:37
29 from ...utils import (
30 cached_file,
31 extract_commit_hash,
(...)
35 logging,
36 )
---> 37 from ..encoder_decoder import EncoderDecoderConfig
38 from .auto_factory import _LazyAutoMapping
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2048, in _LazyModule.getattr(self, name)
2047 except (ModuleNotFoundError, RuntimeError) as e:
-> 2048 raise ModuleNotFoundError(
2049 f"Could not import module '{name}'. Are this object's requirements defined correctly?"
2050 ) from e
2052 elif name in self._modules:
ModuleNotFoundError: Could not import module 'EncoderDecoderConfig'. Are this object's requirements defined correctly?
The above exception was the direct cause of the following exception:
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from transformers import AutoTokenizer, AutoModelForCausalLM
File ~/.local/lib/python3.10/site-packages/transformers/utils/import_utils.py:2048, in _LazyModule.getattr(self, name)
2046 value = getattr(module, name)
2047 except (ModuleNotFoundError, RuntimeError) as e:
-> 2048 raise ModuleNotFoundError(
2049 f"Could not import module '{name}'. Are this object's requirements defined correctly?"
2050 ) from e
2052 elif name in self._modules:
2053 try:
ModuleNotFoundError: Could not import module 'AutoTokenizer'. Are this object's requirements defined correctly?
Expected behavior
The same error arises even if transformers are upgraded to the latest version. Importing transformers by itself does not throw any errors.