-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Lm_head layer Problem in gemma2 : 2b-it #2244
Comments
When you do |
but i am noticing that when i target the lm_head as well the accuracy of the fine tuned tasks gets higher by almost 10% |
What do you mean by accuracy, are you working on a sequence classification task? Also, there are probably better ways to achieve that accuracy, maybe tinker a bit with the hyper params like increase the LoRA If you absolutely want to target the LM head, you can create a copy of it first (after loading the base model, before applying PEFT and merging): model.lm_head.weight.data = model.model.embed_tokens.weight.data.clone() |
@OmarHelwe10 If the embeddings are tied, lm_head is the embedding layer, so you can train both without altering the architecture by training only the embedding (which lm_head points to). Gguf conversion currently does not allow to have lm_head different from embedding as this alters the architecture of gemma and it’s not supported by llamacpp at the moment. So, if you want to use gguf conversion with a tied embedding model then do not train lm_head. (If there is a strong case from the community to have gemma version with embeddings not tied then this might change in llamacpp in the future.) if you do not want to use gguf then you can follow this approach in #2025 to train lm_head. |
Thanks for the info, I didn't know that. |
System Info
all libraries are latest versions
python 3.11
Who can help?
No response
Information
Tasks
examples
folderReproduction
when i run the ft script the first warning is this :
but it works fine and i get adapters in which i can run later using Peftmodel.from_pretrained(model,adapter)...
but when i want to run convert adapters to gguf so i merge them with the LLm to get a final version of gguf model that i can run for inference i run the following script using llama.cpp:
python convert_lora_to_gguf.py --base "/models/gemma-2-2b-it" --outfile "/gemma-2b/adapters.gguf" --outtype auto "/ft_models/gemma-2b/adapters"
Expected behavior
what should i do for this kind of issue?
The text was updated successfully, but these errors were encountered: