Skip to content

Commit 84e90e1

Browse files
Remove deprecated move_model parameter from ActivationCache.to (#1344)
1 parent e124a06 commit 84e90e1

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

transformer_lens/ActivationCache.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class first, including the examples, and then skimming the available methods. Yo
1414
from __future__ import annotations
1515

1616
import logging
17-
import warnings
1817
from typing import (
1918
TYPE_CHECKING,
2019
Any,
@@ -220,7 +219,7 @@ def __len__(self) -> int:
220219
"""
221220
return len(self.cache_dict)
222221

223-
def to(self, device: Union[str, torch.device], move_model=False) -> ActivationCache:
222+
def to(self, device: Union[str, torch.device]) -> ActivationCache:
224223
"""Move the Cache to a Device.
225224
226225
Mostly useful for moving the cache to the CPU after model computation finishes to save GPU
@@ -231,23 +230,10 @@ def to(self, device: Union[str, torch.device], move_model=False) -> ActivationCa
231230
Args:
232231
device:
233232
The device to move the cache to (e.g. `torch.device.cpu`).
234-
move_model:
235-
Whether to also move the model to the same device. @deprecated
236233
237234
"""
238-
# Move model is deprecated as we plan on de-coupling the classes
239-
if move_model is not None:
240-
warnings.warn(
241-
"The 'move_model' parameter is deprecated.",
242-
DeprecationWarning,
243-
)
244-
245235
warn_if_mps(device)
246236
self.cache_dict = {key: value.to(device) for key, value in self.cache_dict.items()}
247-
248-
if move_model:
249-
self.model.to(device)
250-
251237
return self
252238

253239
def toggle_autodiff(self, mode: bool = False):

0 commit comments

Comments
 (0)