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

merge报错 #124

Closed
CHIHOQ opened this issue Feb 25, 2024 · 2 comments
Closed

merge报错 #124

CHIHOQ opened this issue Feb 25, 2024 · 2 comments

Comments

@CHIHOQ
Copy link

CHIHOQ commented Feb 25, 2024

RuntimeError: The size of tensor a (32000) must match the size of tensor b (32002) at non-singleton dimension 0 如何解决?

@hamishivi
Copy link
Collaborator

Hi, looks like you're trying to merge two models with different vocabulary (and thus embedding) sizes. This can happen when you've added tokens like a padding token to the vocabulary. I would recommend merging before adding vocab items if possible. If you only have access to a llama model with added vocab items, just removed them from the model before merging (either by manually slicing the embedding matrix, or via the huggingface resize method (which I think shooouuuld work).

@notoookay
Copy link

notoookay commented Apr 3, 2024

If you are using llama2 model and add pad_token, use this base_model.resize_token_embeddings(32002) for pretrained llama2 model, then load tokenizer of peft fine-tuned locally, it should work.

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

3 participants