Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 30, 2024
1 parent 048348a commit 4550e28
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
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

0 comments on commit 4550e28

Please sign in to comment.