Describe the bug
ActivationCache.to(device) emits DeprecationWarning("The 'move_model' parameter is deprecated.") on every call, even when the caller does not pass move_model. The guard at ActivationCache.py:208 is if move_model is not None:, but the parameter defaults to False, and False is not None, so the warning fires unconditionally. The normal cache-offload idiom cache.to("cpu") therefore prints a noisy deprecation warning.
Relatedly, the v3.0 release notes state this parameter was already removed: "Two deprecations announced in 2.0 have now been removed - the move_model parameter in ActivationCache.to..." (release-3.0.md). But it is still present in the code on main (v3.2.1) and dev, so this is also a stale-deprecation issue.
Code example
import warnings
from transformer_lens.model_bridge import TransformerBridge
model = TransformerBridge.boot_transformers("distilgpt2", device="cpu")
_, cache = model.run_with_cache(model.to_tokens("hello world"))
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
cache.to("cpu")
print([str(x.message) for x in w])
# -> ["The 'move_model' parameter is deprecated."]
The warning is also visible under Python's default filter (no simplefilter needed): a plain cache.to("cpu") prints ActivationCache.py:209: DeprecationWarning: The 'move_model' parameter is deprecated. to stderr.
System Info
- Installed from source (
main @ v3.2.1; dev also affected), uv
- macOS arm64 (also: any OS, this is a pure-Python guard bug)
- Python 3.12
Additional context
Found while implementing generate(return_cache=True) (#697), the #1337's device-offload path writes cache_dict directly rather than calling cache.to, in part to avoid this warning. The buggy guard was introduced in #432 and has shipped in every tag from v1.10.0 through v3.2.1.
Open question for the maintainer: given the v3.0 release notes already announced removal of move_model, shouldn't this parameter simply be removed (and the warning along with it), or is there a deliberate reason to keep the deprecated path?
Checklist
Describe the bug
ActivationCache.to(device)emitsDeprecationWarning("The 'move_model' parameter is deprecated.")on every call, even when the caller does not passmove_model. The guard atActivationCache.py:208isif move_model is not None:, but the parameter defaults toFalse, andFalseis notNone, so the warning fires unconditionally. The normal cache-offload idiomcache.to("cpu")therefore prints a noisy deprecation warning.Relatedly, the v3.0 release notes state this parameter was already removed: "Two deprecations announced in 2.0 have now been removed - the
move_modelparameter inActivationCache.to..." (release-3.0.md). But it is still present in the code onmain(v3.2.1) anddev, so this is also a stale-deprecation issue.Code example
The warning is also visible under Python's default filter (no
simplefilterneeded): a plaincache.to("cpu")printsActivationCache.py:209: DeprecationWarning: The 'move_model' parameter is deprecated.to stderr.System Info
main@ v3.2.1;devalso affected), uvAdditional context
Found while implementing
generate(return_cache=True)(#697), the #1337's device-offload path writescache_dictdirectly rather than callingcache.to, in part to avoid this warning. The buggy guard was introduced in #432 and has shipped in every tag from v1.10.0 through v3.2.1.Open question for the maintainer: given the v3.0 release notes already announced removal of
move_model, shouldn't this parameter simply be removed (and the warning along with it), or is there a deliberate reason to keep the deprecated path?Checklist