ModuleNotFoundError: No module named 'transformers_modules.TheBloke.Airoboros-L2-13B-2'

#1
by rjmehta - opened

@TheBloke Please help. Thank you

Getting this error:


ModuleNotFoundError Traceback (most recent call last)
Cell In[5], line 6
3 model_name_or_path = "TheBloke/Airoboros-L2-13B-2.1-YaRN-64K-GPTQ"
4 # To use a different branch, change revision
5 # For example: revision="gptq-4bit-32g-actorder_True"
----> 6 model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
7 device="cuda:0",
8 trust_remote_code=True,
9 revision="main")
11 tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)

File ~/.conda/envs/summr/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:527, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
524 if kwargs.get("quantization_config", None) is not None:
525 _ = kwargs.pop("quantization_config")
--> 527 config, kwargs = AutoConfig.from_pretrained(
528 pretrained_model_name_or_path,
529 return_unused_kwargs=True,
530 trust_remote_code=trust_remote_code,
531 code_revision=code_revision,
532 _commit_hash=commit_hash,
533 **hub_kwargs,
534 **kwargs,
535 )
537 # if torch_dtype=auto was passed here, ensure to pass it on
538 if kwargs_orig.get("torch_dtype", None) == "auto":

File ~/.conda/envs/summr/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py:1032, in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1030 if has_remote_code and trust_remote_code:
1031 class_ref = config_dict["auto_map"]["AutoConfig"]
-> 1032 config_class = get_class_from_dynamic_module(
1033 class_ref, pretrained_model_name_or_path, code_revision=code_revision, **kwargs
1034 )
1035 if os.path.isdir(pretrained_model_name_or_path):
1036 config_class.register_for_auto_class()

File ~/.conda/envs/summr/lib/python3.10/site-packages/transformers/dynamic_module_utils.py:497, 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)
484 # And lastly we get the class inside our newly created module
485 final_module = get_cached_module_file(
486 repo_id,
487 module_file + ".py",
(...)
495 repo_type=repo_type,
496 )
--> 497 return get_class_in_module(class_name, final_module.replace(".py", ""))

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

File ~/.conda/envs/summr/lib/python3.10/importlib/init.py:126, in import_module(name, package)
124 break
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 :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 :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_modules.TheBloke.Airoboros-L2-13B-2'

Transformers == 4.33.1

ah damn. This is a long standing Transformers bug. It can't load trust_remote_code=True modules from repos with a . in their name. I'll have to rename it. I will do that now

Ahh okay. Got it. Hence the error "transformers_modules.TheBloke.Airoboros-L2-13B-2". Thanks

I've renamed it, please re-test with the new name

It is working now but the model always goes OOM. Even after changing max embeddings to 11k, it goes OOM. I have 4XA10 96GB GPU Mem.

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_name_or_path = "TheBloke/Airoboros-L2-13B-2.1-YaRN-64K-GPTQ"
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
device_map="auto",
trust_remote_code=True,
revision="main")
#model = model.to_bettertransformer()
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
model.max_position_embeddings = 11000
import torch
from auto_gptq import exllama_set_max_input_length
model = exllama_set_max_input_length(model, 11000)
input_ids = tokenizer(prompt, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.35,max_new_tokens=500)

ERROR: OutOfMemoryError: CUDA out of memory. Tried to allocate 16.10 GiB. GPU 0 has a total capacty of 21.99 GiB of which 9.96 GiB is free. Including non-PyTorch memory, this process has 12.02 GiB memory in use. Of the allocated memory 11.28 GiB is allocated by PyTorch, and 445.42 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Sign up or log in to comment