Skip to content

fix: disable LoRA export again#319

Merged
p-e-w merged 1 commit into
masterfrom
revert-308-anrp/loradetails
May 3, 2026
Merged

fix: disable LoRA export again#319
p-e-w merged 1 commit into
masterfrom
revert-308-anrp/loradetails

Conversation

@p-e-w
Copy link
Copy Markdown
Owner

@p-e-w p-e-w commented May 3, 2026

Reverts #308

@p-e-w p-e-w changed the title Revert "fix: Enable LoRAs" fix: disable LoRA export again May 3, 2026
@p-e-w p-e-w merged commit 216c089 into master May 3, 2026
5 of 6 checks passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the obtain_merge_strategy function to replace the adapter-only save option with a cancel option and introduces conditional logic for the merge prompt. A review comment points out that nesting the prompt within a specific conditional block makes certain quantization checks redundant and prevents users not using 4-bit quantization from accessing the cancel option. A suggestion was provided to move the prompt selection outside the conditional block to restore full functionality and clean up the logic.

Comment thread src/heretic/main.py
Comment on lines +134 to +158
strategy = prompt_select(
"How do you want to proceed?",
choices=[
Choice(
title="Merge LoRA into full model"
+ (
""
if settings.quantization == QuantizationMethod.NONE
else " (requires sufficient RAM)"
),
value="merge",
),
value="merge",
),
Choice(
title="Save LoRA adapter only (can be merged later)",
value="adapter",
),
],
)
Choice(
title="Cancel",
value="cancel",
),
],
)

if strategy == "cancel":
return None

return strategy
return strategy
else:
return "merge"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Moving the prompt outside the if block restores the ability to cancel the operation for all users (not just those using 4-bit quantization) and makes the conditional title logic meaningful again. In the current implementation, the check settings.quantization == QuantizationMethod.NONE at line 141 is redundant because it is nested inside a block that only executes when quantization is BNB_4BIT.

    strategy = prompt_select(
        "How do you want to proceed?",
        choices=[
            Choice(
                title="Merge LoRA into full model"
                + (
                    ""
                    if settings.quantization == QuantizationMethod.NONE
                    else " (requires sufficient RAM)"
                ),
                value="merge",
            ),
            Choice(
                title="Cancel",
                value="cancel",
            ),
        ],
    )

    if strategy == "cancel":
        return None

    return strategy

anrp added a commit to anrp/heretic that referenced this pull request May 7, 2026
p-e-w pushed a commit that referenced this pull request May 9, 2026
* fix: Reset model after saving merged model

The adapter is lost and writes 0-byte adapters if you save an adapter after saving the merged model.

* Revert "Revert "Revert "fix: disable LoRA export for now" (#308)" (#319)"

This reverts commit 216c089.

* Add comment as to why resetting model is needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant