Coverage for transformer_lens/model_bridge/sources/inspect/__init__.py: 45%

9 statements  

« prev     ^ index     » next       coverage.py v7.10.1, created at 2026-09-21 19:27 +0000

1"""Inspect driver: turn an ``inspect_ai``-served model into a TransformerLens bridge. 

2 

3We ship our own HF-backed provider (``provider.py``) and a torch-free consumer 

4(``driver.py``). 

5 

6Maintainer note: this package is named ``inspect``, shadowing the stdlib module. 

7Only ever import the stdlib ``inspect`` via an absolute import from outside this 

8package; never write a bare ``import inspect`` inside these modules. 

9""" 

10from __future__ import annotations 

11 

12from typing import Any 

13 

14from .source import boot_inspect 

15 

16__all__ = ["activations_column", "boot_inspect", "capture_activations", "turn_activations"] 

17 

18 

19def __getattr__(name: str) -> Any: 

20 # Lazy so importing the package stays inspect_ai-free; eval.py imports inspect_ai. 

21 if name in ("capture_activations", "activations_column", "turn_activations"): 

22 from . import eval as _eval 

23 

24 return getattr(_eval, name) 

25 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")