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

Transformers does not recognize this architecture #149

Open
Yu-xm opened this issue Jan 13, 2025 · 0 comments
Open

Transformers does not recognize this architecture #149

Yu-xm opened this issue Jan 13, 2025 · 0 comments

Comments

@Yu-xm
Copy link

Yu-xm commented Jan 13, 2025

你好,当我想要加载我自己训练好的基于 llama3-8b 的 bunny 模型时:

model = AutoModelForCausalLM.from_pretrained(
'./checkpoints-llama3-8b/bunny-llama3-8b/checkpoint-500',
torch_dtype=torch.float16, # float32 for cpu
device_map='auto',
trust_remote_code=True)

tokenizer = AutoTokenizer.from_pretrained(
'./checkpoints-llama3-8b/bunny-llama3-8b/checkpoint-500',
trust_remote_code=True)

报错:

Traceback (most recent call last):
File "/home/xmyu/miniconda3/envs/bunny/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1023, in from_pretrained
config_class = CONFIG_MAPPING[config_dict["model_type"]]
File "/home/xmyu/miniconda3/envs/bunny/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 725, in getitem
raise KeyError(key)
KeyError: 'bunny-llama'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/data/xmyu/Bunny_text/checkpoints-llama3-8b/bunny-llama3-8b/test.py", line 17, in
model = AutoModelForCausalLM.from_pretrained(
File "/home/xmyu/miniconda3/envs/bunny/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 526, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/home/xmyu/miniconda3/envs/bunny/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1025, in from_pretrained
raise ValueError(
ValueError: The checkpoint you are trying to load has model type bunny-llama but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.

请问我该如何正确加载模型?

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