Failed to import transformers.trainer because of the following error (look up to see its traceback): cannot import name 'add_model_info_to_custom_pipelines' from 'transformers.utils'
Author: Joey936
Pull request: no
Labels: name: bug

### System Info

 transformers-4.49.0
python-3.10

### Who can help?

_No response_

### 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

import transformers
from transformers import  Trainer
ImportError                               Traceback (most recent call last)
File ~\anaconda\lib\site-packages\transformers\utils\import_utils.py:1510, in _LazyModule._get_module(self, module_name)
   1509 try:
-> 1510     return importlib.import_module("." + module_name, self.__name__)
   1511 except Exception as e:

File ~\anaconda\lib\importlib\__init__.py:126, in import_module(name, package)
    125         level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)

File <frozen importlib._bootstrap>:1050, in _gcd_import(name, package, level)

File <frozen importlib._bootstrap>:1027, in _find_and_load(name, import_)

File <frozen importlib._bootstrap>:1006, in _find_and_load_unlocked(name, import_)

File <frozen importlib._bootstrap>:688, in _load_unlocked(spec)

File <frozen importlib._bootstrap_external>:883, in exec_module(self, module)

File <frozen importlib._bootstrap>:241, in _call_with_frames_removed(f, *args, **kwds)

File ~\anaconda\lib\site-packages\transformers\trainer.py:64
     63 from .integrations.deepspeed import deepspeed_init, deepspeed_load_checkpoint, is_deepspeed_available
---> 64 from .integrations.tpu import tpu_spmd_dataloader
     65 from .modelcard import TrainingSummary

File ~\anaconda\lib\site-packages\transformers\image_processing_utils.py:21
     19 import numpy as np
---> 21 from .image_processing_base import BatchFeature, ImageProcessingMixin
     22 from .image_transforms import center_crop, normalize, rescale

File ~\anaconda\lib\site-packages\transformers\image_processing_base.py:29
     28 from .feature_extraction_utils import BatchFeature as BaseBatchFeature
---> 29 from .utils import (
     30     IMAGE_PROCESSOR_NAME,
     31     PushToHubMixin,
     32     add_model_info_to_auto_map,
     33     add_model_info_to_custom_pipelines,
     34     cached_file,
     35     copy_func,
     36     download_url,
     37     is_offline_mode,
     38     is_remote_url,
     39     is_vision_available,
     40     logging,
     41 )
     44 if is_vision_available():

ImportError: cannot import name 'add_model_info_to_custom_pipelines' from 'transformers.utils' (C:\Users\86136\anaconda\lib\site-packages\transformers\utils\__init__.py)

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
Cell In[15], line 2
      1 import transformers
----> 2 from transformers import  Trainer

File <frozen importlib._bootstrap>:1075, in _handle_fromlist(module, fromlist, import_, recursive)

File ~\anaconda\lib\site-packages\transformers\utils\import_utils.py:1500, in _LazyModule.__getattr__(self, name)
   1498     value = self._get_module(name)
   1499 elif name in self._class_to_module.keys():
-> 1500     module = self._get_module(self._class_to_module[name])
   1501     value = getattr(module, name)
   1502 else:

File ~\anaconda\lib\site-packages\transformers\utils\import_utils.py:1512, in _LazyModule._get_module(self, module_name)
   1510     return importlib.import_module("." + module_name, self.__name__)
   1511 except Exception as e:
-> 1512     raise RuntimeError(
   1513         f"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its"
   1514         f" traceback):\n{e}"
   1515     ) from e

RuntimeError: Failed to import transformers.trainer because of the following error (look up to see its traceback):
cannot import name 'add_model_info_to_custom_pipelines' from 'transformers.utils' (C:\Users\86136\anaconda\lib\site-packages\transformers\utils\__init__.py)

### Expected behavior

please help me

Comments:
hi @Joey936, I can't reproduce this issue at all! I'm afraid it's probably some kind of environment issue, which we can't really debug for you.