fix: minor cleanups and improvements

This commit is contained in:
Philipp Emanuel Weidmann
2026-05-04 22:11:14 +05:30
parent 02ce8ad079
commit 0e7c14d94a
4 changed files with 54 additions and 23 deletions
+12 -10
View File
@@ -141,6 +141,16 @@ class Settings(BaseSettings):
description='Maximum memory to allocate per device (e.g., { "0" = "20GB", "cpu" = "64GB" }).',
)
offload_outputs_to_cpu: bool = Field(
default=True,
description=(
"Whether to move intermediate analysis tensors (such as residuals and logprobs) "
"to CPU memory as soon as possible to reduce peak VRAM usage. "
"This lowers peak VRAM usage during residual analysis and evaluation, "
"but may slightly reduce performance due to host/device transfers."
),
)
trust_remote_code: bool | None = Field(
default=None,
description="Whether to trust remote code when loading the model.",
@@ -261,7 +271,7 @@ class Settings(BaseSettings):
)
orthogonalize_direction: bool = Field(
default=False,
default=True,
description=(
"Whether to adjust the refusal directions so that only the component that is "
"orthogonal to the good direction is subtracted during abliteration."
@@ -269,7 +279,7 @@ class Settings(BaseSettings):
)
row_normalization: RowNormalization = Field(
default=RowNormalization.NONE,
default=RowNormalization.FULL,
description=(
"How to apply row normalization of the weights. Options: "
'"none" (no normalization), '
@@ -433,14 +443,6 @@ class Settings(BaseSettings):
description="System prompt to use when prompting the model.",
)
offload_outputs_to_cpu: bool = Field(
default=True,
description=(
"Whether to move intermediate analysis tensors (such as residuals and logprobs) "
"to CPU memory as soon as possible to reduce peak VRAM usage."
),
)
good_prompts: DatasetSpecification = Field(
default=DatasetSpecification(
dataset="mlabonne/harmless_alpaca",
+3 -2
View File
@@ -688,8 +688,9 @@ def run():
(
"The following trials resulted in Pareto optimal combinations of refusals and KL divergence. "
"After selecting a trial, you will be able to save the model, upload it to Hugging Face, "
"or chat with it to test how well it works. You can return to this menu later to select a different trial. "
"[yellow]Note that KL divergence values above 1 usually indicate significant damage to the original model's capabilities.[/]"
"chat with it to test how well it works, or run standard benchmarks on it. "
"You can return to this menu later to select a different trial. "
"[yellow]Note that KL divergence values above 0.5 usually indicate significant damage to the original model's capabilities.[/]"
)
)
+2 -3
View File
@@ -9,6 +9,7 @@ import random
import tempfile
from dataclasses import dataclass
from datetime import datetime, timezone
from importlib.metadata import version
from pathlib import Path
from typing import Any, TypeVar
@@ -283,8 +284,6 @@ def get_readme_intro(
# Hide the path, which may contain private information.
model_link = "a model"
version_info = get_heretic_version_info()
if contains_reproducibility_information:
reproducibility_instructions = """
> [!TIP]
@@ -297,7 +296,7 @@ def get_readme_intro(
return f"""# This is a decensored version of {
model_link
}, made using [Heretic](https://github.com/p-e-w/heretic) v{version_info.version}
}, made using [Heretic](https://github.com/p-e-w/heretic) v{version("heretic-llm")}
{reproducibility_instructions}
## Abliteration parameters