Error when loading

#1
by irodkin - opened

Code:

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch # Added import for example

model_id = "botverse/Titans-MAC-Llama-3-8b-Instruct" # Replace with your repo ID

# Load the model and tokenizer, allowing custom code execution
# Requires sufficient VRAM for the Llama 8B model + memory buffer
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    trust_remote_code=True,
    torch_dtype=torch.float16, # Recommended for memory
    device_map="auto"
)

Error:

ValueError                                Traceback (most recent call last)
Cell In[1], line 8
      4 model_id = "botverse/Titans-MAC-Llama-3-8b-Instruct" # Replace with your repo ID
      6 # Load the model and tokenizer, allowing custom code execution
      7 # Requires sufficient VRAM for the Llama 8B model + memory buffer
----> 8 model = AutoModelForCausalLM.from_pretrained(
      9     model_id,
     10     trust_remote_code=True,
     11     torch_dtype=torch.float16, # Recommended for memory
     12     device_map="auto"
     13 )
     14 tokenizer = AutoTokenizer.from_pretrained(model_id)
     16 # Example prompt

File /opt/homebrew/Caskroom/miniconda/base/envs/ai/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:356, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    353 kwargs["adapter_kwargs"] = adapter_kwargs
    355 if has_remote_code and trust_remote_code:
--> 356     model_class = get_class_from_dynamic_module(
    357         class_ref, pretrained_model_name_or_path, code_revision=code_revision, **hub_kwargs, **kwargs
    358     )
    359     _ = hub_kwargs.pop("code_revision", None)
    360     # This block handles the case where the user is loading a model with `trust_remote_code=True`
    361     # but a library model exists with the same name. We don't want to override the autoclass
    362     # mappings in this case, or all future loads of that model will be the remote code model.

File /opt/homebrew/Caskroom/miniconda/base/envs/ai/lib/python3.10/site-packages/transformers/dynamic_module_utils.py:567, in get_class_from_dynamic_module(class_reference, pretrained_model_name_or_path, cache_dir, force_download, proxies, token, revision, local_files_only, repo_type, code_revision, **kwargs)
    565 else:
    566     repo_id = pretrained_model_name_or_path
--> 567 module_file, class_name = class_reference.split(".")
    569 if code_revision is None and pretrained_model_name_or_path == repo_id:
    570     code_revision = revision

ValueError: too many values to unpack (expected 2)

Sign up or log in to comment