mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[GH-ISSUE #156] [Feature request] Sharded LoRA merge #92
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#92
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kabachuha on GitHub (Feb 14, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/156
Currently, the export algorithm requires the full model to be loaded into RAM before the LoRA merge and saving to drive.
However, it can be frustrating if the model size is much more than the RAM capability.
Yet, it is possible to apply LoRA per model shard. For each o_proj and mlp_proj component lora is simply a set of two low-rank matrices A and B, which are being added to the model's weight processing at inference. It is possible to fuse them into the weights using the simple algorithm.
What I propose is to
model-00001-of-00010.safetensorsload each shard one by one.This way will allow exporting very large models with smaller RAM.
Most quantization frameworks like llama.cpp read the model layer by layer and therefore too can operate in low RAM.
@p-e-w commented on GitHub (May 9, 2026):
LoRA export is now working, so we don't need such complicated logic anymore. If the user wants a special merge strategy they can export the LoRA and do it manually with a tool of their choice.