Error loading model using huggingface transformers

#12
by yuemning - opened

I encountered a no module found error as follows:
No module named 'transformers_modules.BAAI.bge-reranker-v2'

Is this a known issue?

details:
ModuleNotFoundError Traceback (most recent call last)
Cell In[12], line 64
62 tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-v2.5-gemma2-lightweight', trust_remote_code=True)
63 tokenizer.padding_side = 'right'
---> 64 model = AutoModelForCausalLM.from_pretrained('BAAI/bge-reranker-v2.5-gemma2-lightweight', trust_remote_code=True)
65 model = model.to('cuda')
66 model.eval()

File /opt/conda/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py:521, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
518 if kwargs.get("quantization_config", None) is not None:
519 _ = kwargs.pop("quantization_config")
--> 521 config, kwargs = AutoConfig.from_pretrained(
522 pretrained_model_name_or_path,
523 return_unused_kwargs=True,
524 trust_remote_code=trust_remote_code,
525 code_revision=code_revision,
526 _commit_hash=commit_hash,
527 **hub_kwargs,
528 **kwargs,
529 )
531 # if torch_dtype=auto was passed here, ensure to pass it on
532 if kwargs_orig.get("torch_dtype", None) == "auto":

File /opt/conda/lib/python3.11/site-packages/transformers/models/auto/configuration_auto.py:1120, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1118 if has_remote_code and trust_remote_code:
1119 class_ref = config_dict["auto_map"]["AutoConfig"]
-> 1120 config_class = get_class_from_dynamic_module(
1121 class_ref, pretrained_model_name_or_path, code_revision=code_revision, **kwargs
1122 )
1123 if os.path.isdir(pretrained_model_name_or_path):
1124 config_class.register_for_auto_class()

File /opt/conda/lib/python3.11/site-packages/transformers/dynamic_module_utils.py:500, in get_class_from_dynamic_module(class_reference, pretrained_model_name_or_path, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, repo_type, code_revision, **kwargs)
487 # And lastly we get the class inside our newly created module
488 final_module = get_cached_module_file(
489 repo_id,
490 module_file + ".py",
(...)
498 repo_type=repo_type,
499 )
--> 500 return get_class_in_module(class_name, final_module.replace(".py", ""))

File /opt/conda/lib/python3.11/site-packages/transformers/dynamic_module_utils.py:200, in get_class_in_module(class_name, module_path)
189 """
190 Import a module on the cache directory for modules and extract a class from it.
191
(...)
197 typing.Type: The class looked for.
198 """
199 module_path = module_path.replace(os.path.sep, ".")
--> 200 module = importlib.import_module(module_path)
201 return getattr(module, class_name)

File /opt/conda/lib/python3.11/importlib/init.py:126, in import_module(name, package)
124 break
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)

Sign up or log in to comment