Follow up after recent PRs

This commit is contained in:
Philipp Emanuel Weidmann
2025-11-19 11:19:47 +05:30
parent c9c022a143
commit 694edf18d3
2 changed files with 9 additions and 3 deletions
+6 -3
View File
@@ -201,7 +201,7 @@ def run():
p=2,
dim=1,
)
# we don't need the residuals after computing refusal directions
# We don't need the residuals after computing refusal directions.
del good_residuals, bad_residuals
empty_cache()
@@ -420,8 +420,11 @@ def run():
continue
user = huggingface_hub.whoami(token)
fullname = user.get("fullname", user.get("name", "Unknown"))
email = user.get("email", "Not provided")
fullname = user.get(
"fullname",
user.get("name", "unknown user"),
)
email = user.get("email", "no email found")
print(f"Logged in as [bold]{fullname} ({email})[/]")
repo_id = questionary.text(
+3
View File
@@ -48,6 +48,9 @@ def batchify(items: list[T], batch_size: int) -> list[list[T]]:
def empty_cache():
# Collecting garbage is not an idempotent operation, and to avoid OOM errors,
# gc.collect() has to be called both before and after emptying the backend cache.
# See https://github.com/p-e-w/heretic/pull/17 for details.
gc.collect()
if torch.cuda.is_available():