-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Added support for SFTTrainer checkpoint models and adapter models containing some non-LoRA weights #9778
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
Conversation
…taining some non-LoRA weights The previous code triggers an unexpected name error and calls sys.exit(1) (lines 350-351 current version) even if a single weight in the lora_model is not a lora_A, lora_B, or base layer weight. This edit collects the names of all LoRA weights in the model before the for loop in line 341 (current version). And in line 350 (edit version), the subsequent operations are performed only on the LoRA and base layer weights, ignoring any non-LoRA weights in the lora_model. Hopefully, this helps by allowing the script to extract LoRA weights and convert LoRA to GGUF for adapters containing one or more non-LoRA weights.
…taining one or more non-LoRA weights My initial commit was more like a brute force. The edits suggested by @FirstTimeEZ reduces the complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial commit was literally the Brute Force solution I implemented when I encountered the "Unexpected name '{name}': Not a lora_A or lora_B tensor" error while trying to convert a SFTTrainer-Checkpoint-lora-adapter-model to gguf.
The edits proposed by @FirstTimeEZ reduces the complexity of the code, making it more performant.
Exactly, and the for loop checks for every weight in the lora_model and then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It make no sense to remove this error message.
We show the error because we never want to produce a half-working lora gguf. In your case, there are non-lora tensors in the file. This may hint that your safetensors
file contains unknown data that is not handled by llama.cpp
It's better to know exactly what are the non-lora tensors in your case, rather than ignore them.
Please at least put a full output log here.
INFO:lora-to-gguf:Loading base model: 392a143b624368100f77a3eafaa4a2468ba50a72 Above is the logged output error. |
@Victoran0 I'm checking with TRL team at hugging face to know why. In the meantime, could you share the adapter or the python code that you used to fine tune the model? |
The Adapter: https://huggingface.co/Victorano/llama-3.2-3B-it-Procurtech-Assistant |
Ok so the problem is that you used What I suggest is to remove the |
Okay, I will fix that, retrain and let you know the result |
The previous code triggers an unexpected name error and calls sys.exit(1) (lines 350-351 current version) even if a single weight in the lora_model is not a lora_A, lora_B, or base layer weight.
This edit collects the names of all LoRA weights in the model before the for loop in line 341 (current version). And in line 350 (edit version), the subsequent operations are performed only on the LoRA and base layer weights, ignoring any non-LoRA weights in the lora_model.
Hopefully, this helps by allowing the script to extract LoRA weights and convert LoRA to GGUF for adapter models containing one or more non-LoRA weights.