File size: 3,738 Bytes
9a6ea76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "jlens-materials"
version = "0.1.0"
description = "Jacobian-lens interpretability toolkit for materials science and protein prompts — fit/apply the lens, plot publication figures, run causal swaps, and write an LLM-authored LaTeX report."
readme = "README.md"
requires-python = ">=3.10"
license = { text = "Apache-2.0" }
authors = [{ name = "Markus J. Buehler", email = "mbuehler@mit.edu" }]
keywords = [
    "interpretability", "jacobian-lens", "mechanistic-interpretability",
    "transformers", "materials-science", "protein", "fracture-mechanics",
]
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: Apache Software License",
    "Intended Audience :: Science/Research",
    "Topic :: Scientific/Engineering :: Artificial Intelligence",
]

# Core runtime — everything the fit -> apply -> figures -> analysis -> report
# pipeline needs. Providers (anthropic/openai) are included so the LLM analysis
# works out of the box; the --offline path does not require them at runtime.
dependencies = [
    "torch>=2.2",
    "transformers>=4.45",      # Gemma-3/4 need a recent release (dev env: 5.9)
    "accelerate>=0.30",        # device_map + efficient model loading
    "sentencepiece>=0.2",      # Gemma / Llama / Qwen tokenizers
    "datasets>=2.19",          # wikitext prompts for lens fitting (--fit)
    "huggingface_hub>=0.30",   # private Hub storage for fitted lens bundles
    "numpy>=1.24",
    "matplotlib>=3.7",
    "wordfreq==3.1.1",        # frozen English-frequency screen for 31B SI streams
    "pillow>=10.0",            # GIF export for the "thinking" animation
    "tqdm>=4.66",              # progress bars for the slow lens fit
    "anthropic>=0.40",         # analysis provider: Claude (Messages API)
    "openai>=1.66",            # analysis provider: OpenAI (Responses API)
]

[project.optional-dependencies]
# Everything above already covers a full run; `dev` adds tooling only.
dev = ["ruff>=0.6", "ipython>=8.0", "pytest>=8.0"]

[project.urls]
Homepage = "https://github.com/lamm-mit/Substrates"
Repository = "https://github.com/lamm-mit/Substrates"
"Jacobian lens (upstream)" = "https://github.com/lamm-mit/jacobian-lens"

# ---------------------------------------------------------------------------
# Layout: the toolkit modules live flat in jlens_materials/ and import each
# other by bare name (import matviz, ...). We expose them as top-level modules
# and ship the vendored `jlens` (with its data/ resources) as a package, so an
# editable install makes `import run_lens`, `import matviz`, `import jlens`
# resolve from anywhere — while the scripts still run in-place from the dir.
# ---------------------------------------------------------------------------
[tool.setuptools]
py-modules = [
    "analyze", "animate", "artifacts", "auto_swap", "compare", "domain_prompts",
    "lens_hub", "llm", "matviz", "paper_protocol", "report", "report_latex", "run_lens", "swap",
]
packages = ["jlens", "explorer"]

[tool.setuptools.package-dir]
"" = "jlens_materials"
"jlens" = "jlens_materials/_vendor_jlens/jlens"

[tool.setuptools.package-data]
jlens = ["data/*"]
explorer = ["README.md", "launch.sh", "static/*", "skills/**/*"]

# Convenience entry points — same as `python <module>.py`, runnable anywhere.
[project.scripts]
jlens-run = "run_lens:main"
jlens-analyze = "analyze:main"
jlens-report = "report_latex:main"
jlens-report-md = "report:main"
jlens-compare = "compare:main"
jlens-animate = "animate:main"
jlens-swap = "swap:main"
jlens-auto-swap = "auto_swap:main"
jlens-artifacts = "artifacts:main"
jlens-explorer = "explorer.server:main"