Coverage for transformer_lens/tools/analysis/direct_path_patching.py: 100%
12 statements
« prev ^ index » next coverage.py v7.10.1, created at 2026-10-23 20:45 +0000
« prev ^ index » next coverage.py v7.10.1, created at 2026-10-23 20:45 +0000
1"""Deprecated location of direct path patching, now in :mod:`transformer_lens.patching`."""
3import warnings
4from typing import Any
6from transformer_lens import patching
8_MOVED = ("get_act_patch_direct_path", "get_act_patch_direct_path_all_sources")
10# Star-import resolves these through __getattr__, so it binds the moved names and warns.
11__all__ = list(_MOVED)
14def __getattr__(name: str) -> Any:
15 if name not in _MOVED:
16 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
17 # FutureWarning is shown by default: the results changed, not only the import path.
18 warnings.warn(
19 f"{__name__}.{name} is deprecated; import it from transformer_lens.patching. It now "
20 "computes the exact edge patch instead of a frozen-LayerNorm-scale approximation, so "
21 "its results differ from earlier releases.",
22 FutureWarning,
23 stacklevel=2,
24 )
25 return getattr(patching, name)
28def __dir__() -> list[str]:
29 return sorted(set(globals()) | set(_MOVED))