-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (49 loc) · 1.84 KB
/
Copy pathmain.py
File metadata and controls
62 lines (49 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import streamlit as st
from utils.state import init_session_state
st.set_page_config(
page_title="InterpLab",
page_icon="🔬",
layout="wide",
initial_sidebar_state="expanded",
)
init_session_state()
# --- Sidebar ---
with st.sidebar:
st.title("InterpLab")
st.caption("Mechanistic Interpretability Explorer")
st.divider()
if st.session_state["model"] is not None:
info = st.session_state["model_info"]
st.success(f"**{info['model_name']}**")
st.caption(
f"{info['num_params_human']} params | {info['num_layers']}L | "
f"{info['device']} | {info['dtype']}"
)
else:
st.warning("No model loaded")
st.divider()
from utils.device import get_device_info
dev = get_device_info()
st.caption(f"**Device:** {dev['device_name']}")
if dev["cuda_available"]:
st.caption(f"VRAM: {dev['vram_used_gb']:.1f} / {dev['vram_total_gb']:.1f} GB")
st.caption(f"PyTorch {dev['torch_version']}")
# --- Main page ---
st.title("InterpLab")
st.markdown("### Local Mechanistic Interpretability Explorer")
st.markdown("""
**InterpLab** lets you explore the internal mechanisms of transformer language models -
attention patterns, residual stream evolution, causal tracing, sparse autoencoders, and ablation studies -
all running locally on your machine.
**Quick Start:**
1. Go to **Model Loader** in the sidebar to load a HuggingFace model
2. Run **Basic Analysis** to see logit lens projections
3. Try **Activation Patching** for causal tracing experiments
4. Train or load a **Sparse Autoencoder** to find interpretable features
5. Run **Ablations** to test component necessity
6. Generate **Reports** via local Ollama for scientific analysis
""")
st.info(
"Navigate using the sidebar pages. Start by loading a model on the **Model Loader** page.",
icon="👈",
)