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 #289] Error: cannot access local variable 'active_adapters' where it is not associated with a value #164

Closed
opened 2026-11-01 04:18:12 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @YuanBoXie on GitHub (Apr 8, 2026).
Original GitHub issue: https://github.com/p-e-w/heretic/issues/289

Image

Saving merged model...

  • Merging LoRA adapters into base model...
    Error: cannot access local variable 'active_adapters' where it is not associated with a value
Originally created by @YuanBoXie on GitHub (Apr 8, 2026). Original GitHub issue: https://github.com/p-e-w/heretic/issues/289 <img width="769" height="87" alt="Image" src="https://github.com/user-attachments/assets/6bd0b040-6ed0-4cd7-8dab-a87225c9c787" /> Saving merged model... * Merging LoRA adapters into base model... Error: cannot access local variable 'active_adapters' where it is not associated with a value
Author
Owner

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

Which model is that? I can't reproduce this.

<!-- gh-comment-id:4222970720 --> @p-e-w commented on GitHub (Apr 10, 2026): Which model is that? I can't reproduce this.
Author
Owner

@YuanBoXie commented on GitHub (Apr 10, 2026):

It's a path to a lora fine-tune model, after I merge the lora weight to base model, it could be solved.
Does Heretic lack default support for LoRA paths? This seems like a feature that could be expanded.

<!-- gh-comment-id:4224148213 --> @YuanBoXie commented on GitHub (Apr 10, 2026): It's a path to a lora fine-tune model, after I merge the lora weight to base model, it could be solved. Does Heretic lack default support for LoRA paths? This seems like a feature that could be expanded.
Author
Owner

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

I don't understand what you mean. Please describe exactly what you did to get that error.

<!-- gh-comment-id:4224598983 --> @p-e-w commented on GitHub (Apr 10, 2026): I don't understand what you mean. Please describe exactly what you did to get that error.
Author
Owner

@umran666 commented on GitHub (Jun 11, 2026):

I Understand the cause of this one!
After merge_and_unload(), the base model still has _hf_peft_config_loaded = True set . When saving, transformers tries to find active adapters that no longer exist, causing the crash.
Setting _hf_peft_config_loaded = False on the merged model fixes it completely. I can open the PR on this one..

<!-- gh-comment-id:4677915407 --> @umran666 commented on GitHub (Jun 11, 2026): I Understand the cause of this one! After `merge_and_unload()`, the base model still has `_hf_peft_config_loaded = True set` . When saving, transformers tries to find active adapters that no longer exist, causing the crash. Setting `_hf_peft_config_loaded = False` on the merged model fixes it completely. I can open the PR on this one..
Author
Owner

@p-e-w commented on GitHub (Oct 12, 2026):

Closing as this is a PEFT/Transformers bug, as discussed in #374.

<!-- gh-comment-id:6124833741 --> @p-e-w commented on GitHub (Oct 12, 2026): Closing as this is a PEFT/Transformers bug, as discussed in #374.
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#164
No description provided.