diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7fd52917..142473b1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/delphi/latents/latents.py b/delphi/latents/latents.py index 0f4ff94d..362146bc 100644 --- a/delphi/latents/latents.py +++ b/delphi/latents/latents.py @@ -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(""" - """ - ) + """) max_value = max([max(activ) for activ in activations]) min_value = min([min(activ) for activ in activations]) # Add color bar diff --git a/delphi/latents/neighbours.py b/delphi/latents/neighbours.py index 12a711a1..43b27840 100644 --- a/delphi/latents/neighbours.py +++ b/delphi/latents/neighbours.py @@ -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'") diff --git a/delphi/log/result_analysis.py b/delphi/log/result_analysis.py index 9937bd96..19aa111a 100644 --- a/delphi/log/result_analysis.py +++ b/delphi/log/result_analysis.py @@ -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( diff --git a/examples/latent_contexts_visualization.py b/examples/latent_contexts_visualization.py index 78c38ffa..842ad5d8 100644 --- a/examples/latent_contexts_visualization.py +++ b/examples/latent_contexts_visualization.py @@ -130,11 +130,9 @@ def tokens_and_activations_to_html( print(len(toks)) highlighted_text = [] - highlighted_text.append( - """ + highlighted_text.append(""" -""" - ) +""") max_value = max([max(activ) for activ in activations]) min_value = min([min(activ) for activ in activations])