-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
How can I use the Lora Adapter for a model with Vocab size 40960? #3000
Comments
please support bigger vocab size like yi_6b: 64000 @Yard1 |
same issue, I deployed a LLaMA structure LLLM but the vocab_size had been expanded to 130,000 |
same problem, please add support for vocab_size over 32000. in my case need vocab_size 60256 |
I found a solution which inspired by Gemma that's the original support lora modules # LoRA specific attributes
supported_lora_modules = [
"qkv_proj",
"o_proj",
"gate_up_proj",
"down_proj",
"embed_tokens",
"lm_head",
]
embedding_modules = {
"embed_tokens": "input_embeddings",
"lm_head": "output_embeddings",
}
embedding_padding_modules = ["lm_head"] just remove some modules which may cause errors and finally saving like this: # LoRA specific attributes
supported_lora_modules = [
"qkv_proj",
"o_proj",
"gate_up_proj",
"down_proj",
]
embedding_modules = {}
embedding_padding_modules = [] |
+1 for this, Please add more vocab size support. |
Why doesn't the lora adapter load based on the vocabulary size of the origin model, even though the target_modules in adapter_config.json doesn't have embed_tokens and lm_head? |
Was also trying to run Yi with the same problem.. |
We'd need to modify the kernel/write a new LoRA kernel to support such a large vocabulary size. The current Punica ones cannot do that. |
@Yard1 How does the Gemma avoid this? it also has a huge vocab_size |
We just don't allow the embeddings layer to be modified on gemma |
+1. Need support for a larger vocabulary size. In addition to vocabulary size, there is also a use case like LLaMA Pro block expansion fine-tuning with LoRA, which may not have LoRA weights for all layers. For example, only layers 5, 10, 15, and 20 might have corresponding LoRA weights. |
It should already be possible to use adapters which do not modify every layer - if that is not the case, it is a bug and should be fixed. |
Also made it work with a gemma-like adaptation to Yi and it works :) |
lora finetune for Llama-3 has the same problem, however same code finetune Qwen1.5-7B-Chat, with vocab size 151643, has no such problem, why? |
@qZhang88 Llama 3 should be supported in latest release. |
@Yard1 I've tried llama3 on v0.4.0.post1, but this issue is still present when initializing the engine with lora adapters. The latest But to confirm - llama3 with adapters is supposed to work on 0.4.0.post1, or were you referring to the 0.4.1 prerelease? |
It should be 0.4.1 - this is the commit: 1e96c33 |
@Yard1 how can we upgrade to this release ?? |
@Techinix You can either manually install the wheel from the Release page or build yourself locally from the tagged git version. On my setup, local building takes around 15-30min. |
For the Please use the following codes for your tokenizer: tokenizer.pad_token = tokenizer.eos_token In this way, the vocabulary size is still However, if you use tokenizer.add_special_tokens(
{'pad_token': '[PAD]'}
)
# Resize input token embeddings matrix of the model if new_num_tokens != config.vocab_size.
model.resize_token_embeddings(len(tokenizer)) The vocabulary size is increased to For now, I don't know the reason. If you know the reason, please leave a message. Thank you very much in advance! Shuyue |
Wouldn't it make more sense to check which layers the LoRA-adapter actually applies to? Most LoRA-frameworks don't even touch the embedding layer by default. |
hello. In some multilingual models(like qwen2 or OpenBuddy multilingual series model), the vocab_size may exceed 128512, their size are bigger than 128k but usually not larger than 200k, can you extend the vocab_size to 200k?
|
This issue has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this issue should remain open. Thank you! |
This issue has been automatically closed due to inactivity. Please feel free to reopen if you feel it is still relevant. Thank you! |
The error occurs when I call the LLMEngine object.
The error below appears.
Does the method using the Lora Adapter not apply to models that expand the vocab or have a vocab size larger than 32000?
The text was updated successfully, but these errors were encountered: