Skip to content
Closed
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions src/heretic/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def get_score(self) -> tuple[tuple[float, float], float, int]:
reduction="batchmean",
log_target=True,
).item()
# Clamp to non-negative (KL divergence cannot be negative by definition)
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

This comment should end with a period to adhere to the repository's style guide.

Suggested change
# Clamp to non-negative (KL divergence cannot be negative by definition)
# Clamp to non-negative (KL divergence cannot be negative by definition).
References
  1. Comments should start with a capital letter and end with a period. They should use correct grammar and spelling. (link)

kl_divergence = max(0.0, kl_divergence)
print(f" * KL divergence: [bold]{kl_divergence:.4f}[/]")

print(" * Counting model refusals...")
Expand Down