Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions src/heretic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,31 @@ def obtain_merge_strategy(settings: Settings, model: Model) -> str | None:
)
print()

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)"
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"
Comment on lines +134 to +158
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



def run():
Expand Down
Loading