Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #278

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -11,16 +11,16 @@ repos:
args: ["--unsafe"]
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.278'
rev: 'v0.5.2'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.3.0
hooks:
- id: codespell
# The promptsource templates spuriously get flagged without this
Expand Down
1 change: 1 addition & 0 deletions elk/extraction/extraction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for extracting the hidden states of a model."""

import os
from collections import defaultdict
from dataclasses import InitVar, dataclass, replace
Expand Down
6 changes: 3 additions & 3 deletions elk/plotting/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def render(
y=dataset_data["auroc_estimate"],
mode="lines",
name=ensemble,
showlegend=False
if dataset_name != unique_datasets[0]
else True,
showlegend=(
False if dataset_name != unique_datasets[0] else True
),
line=dict(color=color_map[ensemble]),
),
row=row,
Expand Down
8 changes: 5 additions & 3 deletions elk/promptsource/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,11 @@ def _escape_pipe(cls, example):
# Replaces any occurrences of the "|||" separator in the example, which
# which will be replaced back after splitting
protected_example = {
key: value.replace("|||", cls.pipe_protector)
if isinstance(value, str)
else value
key: (
value.replace("|||", cls.pipe_protector)
if isinstance(value, str)
else value
)
for key, value in example.items()
}
return protected_example
Expand Down
3 changes: 1 addition & 2 deletions elk/training/platt_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class PlattMixin(ABC):
scale: nn.Parameter

@abstractmethod
def __call__(self, *args: Any, **kwds: Any) -> Any:
...
def __call__(self, *args: Any, **kwds: Any) -> Any: ...

def platt_scale(self, labels: Tensor, hiddens: Tensor, max_iter: int = 100):
"""Fit the scale and bias terms to data with LBFGS.
Expand Down
Loading