Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught RuntimeError in import_utils.py line 1865 #3544

Open
sanity opened this issue Mar 14, 2025 · 0 comments
Open

Uncaught RuntimeError in import_utils.py line 1865 #3544

sanity opened this issue Mar 14, 2025 · 0 comments

Comments

@sanity
Copy link

sanity commented Mar 14, 2025

Aider version: 0.77.0
Python version: 3.10.12
Platform: Linux-6.8.0-55-generic-x86_64-with-glibc2.39
Python implementation: CPython
Virtual environment: No
OS: Linux 6.8.0-55-generic (64bit)
Git version: git version 2.43.0

An uncaught exception occurred:

Traceback (most recent call last):
  File "import_utils.py", line 1863, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "configuration_timm_wrapper.py", line 25, in <module>
    from timm.data import ImageNetInfo, infer_imagenet_subset
  File "__init__.py", line 2, in <module>
    from .layers import is_scriptable, is_exportable, set_scriptable, set_exportable
  File "__init__.py", line 7, in <module>
    from .classifier import ClassifierHead, create_classifier, NormMlpClassifierHead
  File "classifier.py", line 15, in <module>
    from .create_norm import get_norm_layer
  File "create_norm.py", line 14, in <module>
    from torchvision.ops.misc import FrozenBatchNorm2d
ModuleNotFoundError: No module named 'torchvision'

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

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
  File "main.py", line 1078, in main
    coder.run()
  File "base_coder.py", line 856, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 897, in run_one
    message = self.preproc_user_input(user_message)
  File "base_coder.py", line 886, in preproc_user_input
    return self.commands.run(inp)
  File "commands.py", line 268, in run
    return self.do_run(command, rest_inp)
  File "commands.py", line 240, in do_run
    return cmd_method(args)
  File "commands.py", line 1056, in cmd_help
    self.help = Help()
  File "help.py", line 139, in __init__
    Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
  File "base.py", line 155, in __init__
    model = SentenceTransformer(
  File "SentenceTransformer.py", line 308, in __init__
    modules, self.module_kwargs = self._load_sbert_model(
  File "SentenceTransformer.py", line 1739, in _load_sbert_model
    module = module_class(model_name_or_path, cache_dir=cache_folder, backend=self.backend, **kwargs)
  File "Transformer.py", line 81, in __init__
    self._load_model(model_name_or_path, config, cache_dir, backend, is_peft_model, **model_args)
  File "Transformer.py", line 181, in _load_model
    self.auto_model = AutoModel.from_pretrained(
  File "auto_factory.py", line 543, in from_pretrained
    has_local_code = type(config) in cls._model_mapping.keys()
  File "auto_factory.py", line 780, in keys
    mapping_keys = [
  File "auto_factory.py", line 781, in <listcomp>
    self._load_attr_from_module(key, name)
  File "auto_factory.py", line 777, in _load_attr_from_module
    return getattribute_from_module(self._modules[module_name], attr)
  File "auto_factory.py", line 693, in getattribute_from_module
    if hasattr(module, attr):
  File "import_utils.py", line 1851, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "import_utils.py", line 1865, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.models.timm_wrapper.configuration_timm_wrapper because of the following error (look up to see its traceback):
No module named 'torchvision'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant