Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ repos:
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.11.0
rev: 26.1.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.14.4'
rev: 'v0.14.13'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
6 changes: 2 additions & 4 deletions delphi/latents/latents.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,9 @@ def _to_string(toks, activations: Float[Tensor, "ctx_len"]) -> str:
for tok in toks
]
highlighted_text = []
highlighted_text.append(
"""
highlighted_text.append("""
<body style="background-color: black; color: white;">
"""
)
""")
max_value = max([max(activ) for activ in activations])
min_value = min([min(activ) for activ in activations])
# Add color bar
Expand Down
2 changes: 1 addition & 1 deletion delphi/latents/neighbours.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _compute_similarity_neighbours(
assert isinstance(
self.autoencoder, Sae
), "Autoencoder must be a sparsify.Sae for decoder similarity"
decoder = self.autoencoder.W_dec.data.cuda() # type:ignore
decoder = self.autoencoder.W_dec.data.cuda() # type: ignore
weight_matrix_normalized = decoder / decoder.norm(dim=1, keepdim=True)
else:
raise ValueError(f"Unknown method: {method}. Use 'encoder' or 'decoder'")
Expand Down
6 changes: 2 additions & 4 deletions delphi/log/result_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,8 @@ def log_results(
)
)
]
print(
f"""Average fraction of failed examples: \
{sum(fractions_failed) / len(fractions_failed)}"""
)
print(f"""Average fraction of failed examples: \
{sum(fractions_failed) / len(fractions_failed)}""")

print("\nConfusion Matrix:")
print(
Expand Down
6 changes: 2 additions & 4 deletions examples/latent_contexts_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,9 @@ def tokens_and_activations_to_html(
print(len(toks))

highlighted_text = []
highlighted_text.append(
"""
highlighted_text.append("""
<body style="background-color: black; color: white;">
"""
)
""")
max_value = max([max(activ) for activ in activations])
min_value = min([min(activ) for activ in activations])

Expand Down
Loading