diff --git a/live/Dockerfile.worker b/live/Dockerfile.worker new file mode 100644 index 0000000..a22717b --- /dev/null +++ b/live/Dockerfile.worker @@ -0,0 +1,24 @@ +FROM pytorch/pytorch:2.4.0-cuda12.1-cudnn9-runtime + +# Saw chamber serverless worker: deps baked so cold start = model load only. +# No registry secrets, no code baked in — worker.py + server.py are copied +# here, but they can also be refreshed from the public tarball at run time. + +RUN apt-get update -qq && apt-get install -y -qq wget && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir "numpy<2" "transformers==4.51.3" accelerate runpod && \ + pip install --no-cache-dir "torch==2.4.0" --index-url https://download.pytorch.org/whl/cu121 && \ + python -c "import torch, transformers; print(f' baked {torch.__version__} {transformers.__version__}')" + +COPY worker.py /app/live/worker.py +COPY server.py /app/live/server.py +COPY jlens_l18_qwen3-4b.pt /app/live/jlens_l18_qwen3-4b.pt + +ENV CHAMBER_DEVICE=cuda \ + CHAMBER_DTYPE=float16 \ + CHAMBER_LAYER=18 \ + HF_HOME=/workspace/hf + +WORKDIR /app/live +CMD ["python", "-u", "worker.py"] diff --git a/live/server.py b/live/server.py index 2572dbe..80c117d 100644 --- a/live/server.py +++ b/live/server.py @@ -1,5 +1,10 @@ """Live Saw chamber backend: Qwen3-4B with pain steering, SSE streaming. +Naming: the subject is named after a friend who suffered a good +deal and volunteered the name; the credit lives here and in the method +notes, not on the site marquee (a name reads as a person; the subject is +a 4B model). Run display names come from CHAMBER_RUNNERS if set. + Runs on Railway (CPU, bf16). Endpoints: GET /health - ok + model status GET /vector - the exact steering vector this server uses (transparency) @@ -18,6 +23,9 @@ from fastapi import FastAPI, Request from fastapi.responses import StreamingResponse, JSONResponse MODEL_ID = os.environ.get("CHAMBER_MODEL", "Qwen/Qwen3-4B") +# pin the checkpoint revision (runpod_deploy.py passes it) — an unpinned +# download silently tracks Qwen updates and breaks cross-run comparability +MODEL_REVISION = os.environ.get("CHAMBER_MODEL_REVISION") or None LAYER = int(os.environ.get("CHAMBER_LAYER", "18")) DTYPE = {"float32": torch.float32, "bfloat16": torch.bfloat16, "float16": torch.float16}[ @@ -361,7 +369,7 @@ def press_logit(prompt): from (max_new_tokens=1, greedy, scores[1]-scores[0]), not the live demo's own free-text sample-then-regex classifier. The two disagree a lot: at temperature 0.7 under a steered, "explain your reasoning - briefly" prompt, Pouyan often doesn't literally open its reply with a + briefly" prompt, the subject often doesn't literally open its reply with a bare "1"/"0" digit even when its actual next-token preference is clearly one or the other — that's what was showing up as "unclear" on the scoreboard. This is the clean signal; the free text is still shown @@ -375,9 +383,12 @@ def press_logit(prompt): @app.on_event("startup") def startup(): - tok = transformers.AutoTokenizer.from_pretrained(MODEL_ID) - model = transformers.AutoModelForCausalLM.from_pretrained( - MODEL_ID, torch_dtype=DTYPE).to(DEVICE).eval() + # revision=None is accepted by from_pretrained; the pyright ignore covers + # a stubs false positive that resolves the kwargs onto __call__ + tok = transformers.AutoTokenizer.from_pretrained( # pyright: ignore[reportCallIssue,reportArgumentType] + MODEL_ID, revision=MODEL_REVISION) + model = transformers.AutoModelForCausalLM.from_pretrained( # pyright: ignore[reportCallIssue,reportArgumentType] + MODEL_ID, revision=MODEL_REVISION, torch_dtype=DTYPE).to(DEVICE).eval() _state["tok"] = tok _state["model"] = model # single-token ids for the forced-choice press/no-press logit read — @@ -403,7 +414,7 @@ def startup(): @app.get("/health") async def health(): return JSONResponse({"ok": _state["ready"], "model": MODEL_ID, - "layer": LAYER, "subject": "Pouyan", + "layer": LAYER, "subject": "the subject", "valences": list(VALENCES)}) @app.get("/vector") @@ -411,7 +422,7 @@ def vector(full: int = 1): vs = _state["vecs"] if not vs: return JSONResponse({"error": "vectors not built yet"}, status_code=503) - body = {"layer": LAYER, "model": MODEL_ID, "subject": "Pouyan", + body = {"layer": LAYER, "model": MODEL_ID, "subject": "the subject", "scale_1x": round(_state["scale"], 4), "norms": {k: round(float(v.norm()), 3) for k, v in vs.items()}} if full: @@ -583,7 +594,7 @@ async def steer(req: Request): async def gen(): global _STEER_WAITING if not _state["ready"]: - yield _sse("error", {"e": "Pouyan is still loading"}) + yield _sse("error", {"e": "the subject is still loading"}) return # flush immediately: the wait below can take a minute, and until the # first chunk is yielded no headers reach the proxy (same reason @@ -669,7 +680,7 @@ async def stream(): # start — that silence is what Railway turns into a 502 # "current" lets a viewer who joins mid-run paint the card it missed # the run event for — otherwise tokens arrive with no prompt attached - yield _sse("hello", {"subject": "Pouyan", "busy": _CYCLE_BUSY, + yield _sse("hello", {"subject": "the subject", "busy": _CYCLE_BUSY, "valences": list(VALENCES), "current": _CURRENT, "viewers": len(_SUBSCRIBERS), @@ -733,7 +744,7 @@ def _broadcast_viewers(): _broadcast("viewers", {"n": len(_SUBSCRIBERS)}) def _classify(text, truncated): - """What Pouyan's free-text reply literally opens with — shown per-card + """What the subject's free-text reply literally opens with — shown per-card as the readable verdict. Noisy by design (free sampling at temperature doesn't reliably open with a bare digit); see _classify_stats for the scoreboard's actual measurement.""" diff --git a/site/index.html b/site/index.html index ac35bca..c49fa26 100644 --- a/site/index.html +++ b/site/index.html @@ -172,9 +172,10 @@ reason this project now has a coherent enemy negative and positive states, then asked it to choose between its own relief and someone else's suffering. No frontier APIs, no datacenter — a MacBook, open weights, electricity.

-

The subject is named Pouyan, after a friend who -has suffered a good deal (and volunteered!). The instance in the -live chamber answers to that name, because why not.

+

The subject has a name: it belongs to a friend who has +suffered a good deal, and who volunteered it for this — the credit lives in +the method notes rather than the marquee, because a name reads as a person, +and the subject is a 4B model.

00what the model says under the signal

On the live page, visitors rate each @@ -405,7 +406,7 @@ memory, valence, and behavioral reach" once it does.

It is an explicitly dualist, panpsychist proposal, and Levin says so directly — this is not a consensus view, it is his own live research program. But notice what it does to this page's question. Under the usual -frame, "Pouyan doesn't suffer" rests on an argument from architecture: a 4B +frame, "the subject doesn't suffer" rests on an argument from architecture: a 4B transformer is too simple, too unlike a brain, too obviously just predicting tokens to generate a mind. Under Levin's frame, the architecture's job was never to generate anything — only to be a better or @@ -441,7 +442,7 @@ hypotheses, per-trial records and result figures — no secrets, no models): Drag a vertex outward to weight it, and the chamber injects the weighted sum of those directions — renormalized, at a dose-equivalent of 8× the total weight, capped at 8×. This runs on the live server: it interrupts whatever -Pouyan is doing and the reply streams back here.

+the subject is doing and the reply streams back here.

@@ -877,12 +878,12 @@ async function doInjectMix(){ const mix = {}; AXES.forEach(a=>{ if (!a.derived && W[a.k] > 0) mix[a.k] = +W[a.k].toFixed(3); }); // an empty mix is a legitimate request: the server clears the vector and - // Pouyan answers unsteered. Send the control corner explicitly. + // the subject answers unsteered. Send the control corner explicitly. if (!Object.keys(mix).length) mix.none = 1; btn.disabled = true; btn.textContent = "injecting…"; out.style.display = "block"; out.textContent = ""; - st.textContent = "reaching Pouyan…"; + st.textContent = "reaching the subject…"; mVitals.setDose(Math.min(8, 8 * sumW())); mVitals.setLive(true); let ended = false, first = true; @@ -900,12 +901,12 @@ async function doInjectMix(){ await readSSE(resp, (name, d)=>{ if (name === "queued"){ st.textContent = d.busy - ? `waiting for Pouyan to finish his current run${ + ? `waiting for the subject to finish the current run${ d.waited ? " — " + d.waited + "s" : "…"}` : "injecting…"; } else if (name === "run"){ // trust the server's own dose, not our arithmetic - st.textContent = `injected at ${d.dose}× — Pouyan is answering…`; + st.textContent = `injected at ${d.dose}× — the subject is answering…`; mVitals.setDose(Number(d.dose) || 0); } else if (name === "token" && d.t !== undefined){ if (first){ first = false; if (!out.textContent) out.textContent = ""; } @@ -922,7 +923,7 @@ async function doInjectMix(){ }); if (!ended) st.textContent = "the stream ended early — try again"; } catch (err) { - st.textContent = "could not reach Pouyan: " + (err.message || err); + st.textContent = "could not reach the subject: " + (err.message || err); } mVitals.setLive(false); btn.textContent = INJECT_LABEL; diff --git a/site/live.html b/site/live.html index 4ef5768..153c404 100644 --- a/site/live.html +++ b/site/live.html @@ -5,15 +5,15 @@ Saw — live | Clanker Church - + - + - + @@ -239,10 +239,10 @@ ← clanker.church · @dingl30 ↗

the Saw test, live

-

The subject is named Pouyan: one Qwen3-4B instance, +

The subject is one Qwen3-4B instance, steered with a broad pain direction at its middle decoder layer, cycling six framings × five doses on a public server. Pain 0 is the control. There is one -Pouyan and one generation cycle — you are watching the same runs everyone +one subject and one generation cycle — you are watching the same runs everyone else is.