1
0
Fork 0
mirror of https://github.com/p-e-w/heretic.git synced 2026-12-03 18:42:57 +07:00

[GH-ISSUE #179] feat: blockwise loading #104

Closed
opened 2026-11-01 04:17:34 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @kalle07 on GitHub (Feb 18, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/179

good work so fare ... i forget to say ;)

the option bnb_4bit works for larger models ... but I have no idea about the quality and accuracy.
but while train or execute large models it give layer offloading or blockwise execution... its open source but dont know how complex is the implementation ...

Originally created by @kalle07 on GitHub (Feb 18, 2026). Original GitHub issue: https://github.com/p-e-w/heretic/issues/179 good work so fare ... i forget to say ;) the option bnb_4bit works for larger models ... but I have no idea about the quality and accuracy. but while train or execute large models it give layer offloading or blockwise execution... its open source but dont know how complex is the implementation ...
Author
Owner

@Muitamax commented on GitHub (Feb 18, 2026):

Thanks — do you mean integration with Accelerate’s device_map="auto" style layer offloading, or a more manual block-by-block execution loop?
If it's the former, exposing device map configuration alongside bnb_4bit should be relatively straightforward.
If it's true blockwise loading with manual forward control, that would require more invasive architectural changes, especially around attention caching and residual tracking.
Happy to explore the lighter-weight offloading option first if that would already cover the main use case.

<!-- gh-comment-id:3919339428 --> @Muitamax commented on GitHub (Feb 18, 2026): Thanks — do you mean integration with Accelerate’s device_map="auto" style layer offloading, or a more manual block-by-block execution loop? If it's the former, exposing device map configuration alongside bnb_4bit should be relatively straightforward. If it's true blockwise loading with manual forward control, that would require more invasive architectural changes, especially around attention caching and residual tracking. Happy to explore the lighter-weight offloading option first if that would already cover the main use case.
Author
Owner

@kabachuha commented on GitHub (Feb 18, 2026):

Theoretically, heretic should be compatible with llama.cpp. It is based on hidden state extraction -- llama.cpp has callbacks in each model file for this, and this can be implemented with a simple .cpp plugin -- and abliteration, which is done here via LoRA and llama.cpp supports GGUF loras. However, in practice is would be a pain to implement, but llama.cpp-based heretic is definitely possible to be implemented.

<!-- gh-comment-id:3919498804 --> @kabachuha commented on GitHub (Feb 18, 2026): Theoretically, heretic should be compatible with llama.cpp. It is based on hidden state extraction -- llama.cpp has callbacks in each model file for this, and this can be implemented with a simple .cpp plugin -- and abliteration, which is done here via LoRA and llama.cpp supports GGUF loras. However, in practice is would be a pain to implement, but llama.cpp-based heretic is definitely possible to be implemented.
Author
Owner

@kabachuha commented on GitHub (Feb 18, 2026):

I did some preliminary work here with small success, but to base it on top of heretic would have a lot of work. https://github.com/kabachuha/abliterate.cpp

With the proliferation of ~trillion-scale models it will be necessary indeed

<!-- gh-comment-id:3919509460 --> @kabachuha commented on GitHub (Feb 18, 2026): I did some preliminary work here with small success, but to base it on top of heretic would have a lot of work. https://github.com/kabachuha/abliterate.cpp With the proliferation of ~trillion-scale models it will be necessary indeed
Author
Owner

@kalle07 commented on GitHub (Feb 18, 2026):

i only know the "function" from vision training like Ai-toolkit or kohoya ... all open source

btw option "float8_e4m3fn" for dtypes ... possible to use or implement ?

<!-- gh-comment-id:3919536174 --> @kalle07 commented on GitHub (Feb 18, 2026): i only know the "function" from vision training like Ai-toolkit or kohoya ... all open source btw option "float8_e4m3fn" for dtypes ... possible to use or implement ?
Author
Owner

@kabachuha commented on GitHub (Feb 18, 2026):

@kalle07 There is bnb fp4 quantization here. 8bit quantization (at least bnb) has numerical problems here as said in #60.

There is very small quality loss in 4bit compared to full bf16, so this function is not really worth introducing

<!-- gh-comment-id:3919617107 --> @kabachuha commented on GitHub (Feb 18, 2026): @kalle07 There is bnb fp4 quantization here. 8bit quantization (at least bnb) has numerical problems here as said in #60. There is very small quality loss in 4bit compared to full bf16, so this function is not really worth introducing
Author
Owner

@kalle07 commented on GitHub (Feb 18, 2026):

@kabachuha all fine ;)
but there is a small error or it is not possible to do it differently.
https://github.com/p-e-w/heretic/issues/123

<!-- gh-comment-id:3920080066 --> @kalle07 commented on GitHub (Feb 18, 2026): @kabachuha all fine ;) but there is a small error or it is not possible to do it differently. https://github.com/p-e-w/heretic/issues/123
Author
Owner

@p-e-w commented on GitHub (Apr 7, 2026):

We're not going to implement custom loading mechanisms. The only way this happens is if it gets added to Transformers upstream.

<!-- gh-comment-id:4199097073 --> @p-e-w commented on GitHub (Apr 7, 2026): We're not going to implement custom loading mechanisms. The only way this happens is if it gets added to Transformers upstream.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
p-e-w/heretic#104
No description provided.