Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
SimJeg committed Jan 13, 2025
1 parent 1d72584 commit d53a3cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion evaluation/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def evaluate(
# Load press
assert press_name in PRESS_DICT
press = PRESS_DICT[press_name]
press.compression_ratio = compression_ratio
press.compression_ratio = compression_ratio # type:ignore[attr-defined]

# Initialize pipeline with the correct attention implementation
model_kwargs = {"torch_dtype": "auto"}
Expand Down
5 changes: 3 additions & 2 deletions kvpress/presses/key_rerotation_press.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class KeyRerotationPress(BasePress):

press: ScorerPress

def __post_init__(self):
assert isinstance(self.press, ScorerPress)

def compress(
self,
module: nn.Module,
Expand All @@ -39,8 +42,6 @@ def compress(
if self.press.compression_ratio == 0:
return keys, values

assert isinstance(self.press, ScorerPress)

# Compute scores from base press
scores = self.press.score(module, hidden_states, keys, values, attentions, kwargs)

Expand Down

0 comments on commit d53a3cb

Please sign in to comment.