Skip to content

install.sh: auto-install training deps on GPU machines - #431

Merged
joelteply merged 1 commit into
mainfrom
fix/install-training-deps
Mar 25, 2026
Merged

joelteply merged 1 commit into
mainfrom
fix/install-training-deps

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Detects GPU via PyTorch CUDA check. If present, installs Unsloth + PEFT + bitsandbytes + datasets + trl. No GPU = skip (inference still works). Prevents manual pip install nightmares.

Copilot AI review requested due to automatic review settings March 25, 2026 14:11
@joelteply
joelteply merged commit 02d4423 into main Mar 25, 2026
@joelteply
joelteply deleted the fix/install-training-deps branch March 25, 2026 14:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repo-root install.sh installer to optionally install Python training dependencies when a GPU is detected, aiming to make Academy LoRA fine-tuning setup automatic on GPU machines while keeping CPU-only installs inference-capable.

Changes:

  • Add a GPU-detection gate (via a PyTorch CUDA check) during dependency installation.
  • If GPU is detected, install Unsloth + PEFT + Transformers + bitsandbytes + datasets + trl via pip; otherwise skip.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh
Comment on lines +171 to +172
if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then
HAS_GPU=true

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPU detection relies on importing torch before any Python ML environment is installed. On a fresh machine (even with an NVIDIA GPU), import torch will typically fail and this block will incorrectly treat the machine as CPU-only, skipping the training deps. Consider detecting CUDA via nvidia-smi/known NVIDIA paths (WSL included) or installing/bootstrapping the intended PyTorch wheel first, then using torch.cuda.is_available().

Suggested change
if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then
HAS_GPU=true
# Prefer system-level CUDA detection (works even if PyTorch is not installed yet)
if command -v nvidia-smi &>/dev/null && nvidia-smi -L &>/dev/null; then
HAS_GPU=true
# Fallback: if PyTorch is already installed, use torch.cuda.is_available()
elif python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then
HAS_GPU=true

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +167 to +184
# Python training dependencies (for Academy LoRA fine-tuning)
# Only install if GPU is available — no point on CPU-only machines
if command -v python3 &>/dev/null; then
HAS_GPU=false
if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then
HAS_GPU=true
fi

if [ "$HAS_GPU" = true ]; then
echo " 🧠 GPU detected — installing training dependencies..."
python3 -m pip install --quiet \
unsloth \
peft \
transformers \
bitsandbytes \
datasets \
trl \
2>&1 | tail -3

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This installs training packages into the system Python (no venv) and duplicates logic that already exists in src/scripts/install.sh (it creates a venv and installs PyTorch appropriately for CUDA/MPS/CPU). To avoid drift and permission issues (global site-packages often require sudo), consider reusing that existing venv-based installer or adopting the same pattern here.

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +177 to +183
python3 -m pip install --quiet \
unsloth \
peft \
transformers \
bitsandbytes \
datasets \
trl \

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "training dependencies" list appears incomplete for the repo’s training scripts: e.g. src/system/genome/fine-tuning/server/adapters/scripts/peft-train.py explicitly requires torch and accelerate. As written, this block may install transformers/trl/peft but still fail at runtime due to missing torch/accelerate (and may end up with a CPU-only torch if it gets pulled indirectly).

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +177 to +185
python3 -m pip install --quiet \
unsloth \
peft \
transformers \
bitsandbytes \
datasets \
trl \
2>&1 | tail -3
echo " ✅ Training dependencies installed (Unsloth + PEFT + LoRA)"

Copilot AI Mar 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3 -m pip install ... 2>&1 | tail -3 masks installation failures: without set -o pipefail, the pipeline exit code is from tail, so the script will print "✅ Training dependencies installed" even if pip install failed. Please preserve/verify the pip exit status (e.g., enable pipefail for this pipeline or check PIPESTATUS[0]) before emitting the success message.

Copilot uses AI. Check for mistakes.
joelteply added a commit that referenced this pull request Aug 14, 2026
… live benchmark-room purpose mismatch (#431) (#2302)

A recipe string is a reference into the recipe REGISTRY, not free text.
Before this gate an unknown one "worked" — room made, binding published —
then resolved to no manifest, so every client projected the room as plain
chat. The live instance: benchmark/dispatch bound "benchmark" while the
shipped recipe declares "benchmark/hard-rs", so EVERY benchmark run room
rendered as chat for the whole campaign (the scoreboard region was the
point of the recipe). The registry's own ids()/purposes() doc named this
exact validation as its purpose; it was never wired.

- experience::source: shipped_purposes() + shipped_purpose(id), both
  derived from the SAME embedded() iterator the registry is built from —
  validation set == resolution set by construction. Doc notes both must
  grow the disk overlay when #432 wires it.
- activity::validate_recipe: pure gate called by spawn_activity_room;
  refusal names the actionable set.
- benchmark/dispatch: binds the purpose resolved from
  shipped::BENCHMARK_HARD_RS — the string stays authored in exactly one
  place, the recipe JSON.

Tests (existing mods): validate_recipe passes every shipped purpose and
refuses the old "benchmark" literal with the set named; the shipped
constant resolves to "benchmark/hard-rs". modules::activity +
experience::source: 15 passed, 0 failed.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 14, 2026
…ull activity inventory (#433) (#2304)

Joel's directive (2026-08-14): codify parameter-based recipe functionality —
dynamic, easy defaults, parameterized — and write down all planned activities
plus anticipated oddballs.

The doc pins: params as typed declarations WITH defaults in the recipe JSON
(zero-arg spawn always works); spawn-time validation against the declaration
(same loud-refusal arm as #431's recipe-string gate); resolved params riding
RoomRecipeBinding so every room is self-describing through the ViewState pipe;
targeting (suite/instances/team/budget) as first-class params; teams form as
declared member[] composition over airc identity (humans included). Catalog
covers the 4 shipped recipes, the current recipe-less tabs, 7 planned
activities (SWE benchmark, academy classroom, pair-coding A/B, exam room, ...)
and 6 oddballs chosen to stress the schema (recurring rules, member roles,
live media, cognition-tuning numbers). Outlier plan: benchmark/swe +
club/book first; both fit => the rest are data entry. Code half lands with
#430 as ONE ExperienceRecipe schema evolution (citizens + params together).


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 14, 2026
… + drop vestigial default_room gate (#432, slices 4+5) (#2303)

Three fixes from the spawn-gate survey, all landing the same contract:
citizens spawn cleanly from recipe registries, and nothing on disk is
silently ignored.

FLOOR ORPHANS (5a): the spawner's plan was sized to CONTINUUM_PERSONA_FLOOR
while ResumeOrMintProvider held every resumed seed — 5 citizens on disk with
floor=1 meant one hosted and four orphaned forever. The boot task now calls
supervisor.set_population(provider.identities_available()) after provider
construction: the floor stays a MINT floor, never a resume CAP. New:
ResumeOrMintProvider::identities_available(), PersonaSpawnerModule/
PersonaSpawnSupervisor::set_population (same >=1 clamp as with_population).

VESTIGIAL ROOM GATE (5b): persona bootstrap zipped daemon_socket with
default_room, so "no default room => no citizens, for no reason" (#298
removed the operator-room birth dep; the zip outlived it). The persona block
now gates on the SOCKET alone; the room stays a dep only for its genuine
consumers — GridCapacityModule (registered when present, loud warn when not)
and the node-presence emitter (pair rebuilt explicitly).

RECIPE OVERLAY IN PROD (4): builtins_with_overlay existed with zero
production callers — "a new experience is a new recipe entry, zero code" was
false in the running system. The chat projection now resolves embedded +
<continuum_root>/recipes (one canonical overlay_dir helper), and #431's
validate_recipe grows the SAME union via known_purposes(overlay_dir), so
validation and resolution cannot drift: an authored on-disk recipe is
spawnable the moment the file exists. A malformed overlay file refuses
loudly naming the file — at boot in the log, and at activity/spawn as the
command error.

Tests: identities_available floor/resume matrix; set_population plan resize
with clamp; overlay-authored purpose validates + malformed overlay refuses
naming the file; all existing recipe/activity/projection tests green.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 17, 2026
…boot — activity/* was routable and invisible (#2332)

* fix(commands): a command declares BOTH halves or the core refuses to boot — activity/* was routable and invisible

`activity/spawn` — the verb that mints every room, benchmark rooms included —
did not appear in `commands/list`. Neither did `activity/archive` or
`activity/protect`. All three route fine, so every smoke test passed.

A command is ONE thing declared as a (descriptor, constructor) pair:

  descriptor  — `CommandDescriptor::of::<Spec>()`, TYPE-only, needs no deps.
                Feeds codegen, the ACL, `commands/list`, the persona tool surface.
  constructor — the runtime object. Dep-holding ones come from the module's
                `commands()` vec because the deps must be built somewhere.

`action_command!` emits both, in BOTH its stateless and dep-holding forms.
`register_stateless_command!` emits both. `BenchmarkDispatch` splits them
correctly and documents why. The generator has never gotten this wrong.

Only the three HAND-WRITTEN `impl ActionCommand` blocks in activity.rs dropped
a half — constructor, no descriptor. Nothing checked, so it shipped.

Half a declaration is worse than none: the command ROUTES, so it looks healthy,
while being absent from every surface through which anyone — human or citizen —
discovers that it exists. `commands/list` calls itself "the discovery pair, the
persona reaches the long tail through this" and was quietly lying about three
AI-safe verbs.

FIX, in three parts:

1. The three missing `register_command!` declarations. They now also pass the
   AI-usability conformance floor they had never been held to.

2. `sdk_codegen::descriptor_exists()` — binary search over the same sorted list
   every other consumer reads, so it can never become a second opinion about
   what commands exist.

3. The guard, at the seam where constructors enter: `ModuleRegistry::register`
   PANICS on a constructor with no descriptor, naming the remedy and the
   worked example. Not a warning — a warning about an invisible command is read
   by nobody, for exactly the reason the command is invisible. It sits beside
   the duplicate-name panic already there, same rationale: the "no central list"
   design removes the human backstop, so the registry catches its own gaps.

`dispatch_orphans` already audited the mirror case (descriptor, no route — #361).
The pair is now total in both directions.

Also: the doc comment above ActivitySpawn::DESCRIPTION claimed recipe validation
"is NOT done" long after #431 shipped `validate_recipe` 40 lines below it. A
comment describing absent code is a lying receipt of the #151/#357 class — it
lies to engineers instead of to citizens. Corrected, with the cost recorded.

VERIFIED LIVE (deployed, build 340eb6c):
  commands/list --filter=activit -> 4 matches, all three verbs, all ai-safe
  catalog total 297 -> 300, exactly +3
  the core BOOTS, which proves the guard passes against every real module —
  no other half-declared command exists tree-wide. Stronger than a static scan.

  (My first scan was by type name and produced 3 false positives — GenerateModule,
  PersonaAllocate, SystemPressureBrokerState are all registered THROUGH
  action_command!. Reverted before they became a fake fix. The runtime guard is
  the honest instrument; grep was a bad proxy for it.)

cargo check clean; sdk_codegen 21/21; runtime::registry 9/9 incl. a
should_panic positive control.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* perf(cognition): stop shipping maintainer rationale to citizens — the tool schema is a teaching surface (#333 slice 1, unblocks #2332)

schemars lifts a field's `///` doc comment VERBATIM into the JSON Schema, so one
piece of prose served two readers with opposite needs. A citizen deciding whether
to spawn a room was billed, every turn, for:

  "schemars(with = \"String\") describes the WIRE (a uuid string, per
   #[serde(transparent)]) to the tool schema while Rust keeps the type"

and, on `recipe`, a full paragraph explaining why the doc deliberately does NOT
list the valid values. Correct to write. Wrong to ship.

The projection now keeps the LEAD PARAGRAPH of every description in the offered
schema (properties AND definitions); everything after the first blank line stays
in the file for whoever opens it. Conventional split, not a declared one — it is
how these docs are already written, so it needs no per-command annotation and
cannot drift from a second source. Only 2 of 26 native verbs carry a second
paragraph today; the rest are byte-identical.

Deliberately NOT a length cap. A long first paragraph is a long ANSWER to "what
is this field", and truncating that is #358's shape — a citizen who cannot find
the verb reaches for the wrong one. Contentless length is the defect.

MEASURED, in the ratchet's own instrument: 11,972 → 11,244 (-728).

Ceiling re-pinned 10350 → 11300 with the growth named, per the ratchet's own
contract, and SHRUNK FIRST as its first branch requires — the first re-pin where
the shrink is a measurement rather than an assertion. What grew: the three NATIVE
activity verbs (+1,273), which routed all along and had simply never shipped a
descriptor.

RETRACTS a claim this ceiling invited and that I made earlier in the session:
that the native schemas run "3-5x over a clean design". Measured, the 26-verb
surface is 6,935 tokens, mean 266/verb — leaner PER VERB than the frontier agent
runtimes it was being compared against. Two sibling hypotheses died the same way
and are recorded in the doc so nobody re-derives them: $schema/title boilerplate
(already stripped, 0 tokens — that example came from `commands/list`, a DIFFERENT
surface) and undescribed params (171 tokens, one command).

The surface is not obese. It is paid TWICE (#333 — native schemas AND the prose
menu, both every turn) and charged against a 16k lane, where 6,935 tokens is 43%
of everything she has and the same code is ~3% on a frontier window.

Design + full measurement + build plan: docs/cognition/TOOL-DISCLOSURE-LADDER.md.
The next real shrink is structural: rung 2 of the ladder becoming the TURN's
working set instead of a static NATIVE list, after which this ceiling guards the
spine and stops taxing capability.

DEPLOY OWED: not rebooted. A round is in flight (Anon holds staged SWE cards) and
two citizens have already cited "the ongoing rebuilds and interruptions" verbatim
in withdrawal messages. Validated by unit test (the ratchet builds a real faculty
and measures the real registry); live deploy on the next legitimate reboot.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Fable 5 <[email protected]>
joelteply added a commit that referenced this pull request Aug 22, 2026
…eal rail dispatch (#431) (#2369)

* feat(academy): benchmark rooms RENDER — purpose→family resolution + the rail's real dispatch table (#431)

Every room the benchmark dispatcher spawned painted 'Interface error
rendering this room': recipes bind hierarchical purposes (benchmark/hard-rs)
while the content registry keys families (bench), and nothing resolved
between them — 3 of 4 shipped recipes were unrenderable in the browser.

- contentFamilyOf (patterns): the ONE resolver, first-segment alias table
  (benchmark/* → bench, video-chat → live, profile → persona); unknown
  purposes pass through UNCHANGED so the registry stays the fail-loud
  authority. Long-term this collapses into recipe-manifest data.
- chatWorkspace: a benchmark-family room now renders the bench board
  (frame-first before the feed, same contract as arena/serving); video-chat
  rooms reach the live face.
- Right rail: context widgets dispatch through webWidgetRegistry ('bench'
  registered) instead of a hardcoded kind check that silently blanked every
  other widget — the seam that let the exam room's rail widgets be data.
- Boy-scout: pre-existing non-null assertion in the context block; tui spec
  fixture missing the now-required transcript field (pre-existing red).

Specs: family resolution pinned per shipped recipe; bench-room dispatch +
fail-loud passthrough pinned in chat-view (rides CI). All client suites
green, typecheck 0, lint net-zero (68 pre-existing before and after).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* feat(academy): round lifecycle rides the bench wire — the scoreboard renders the tracker's truth, and citizens read the same board (#371)

BenchViewState gains rounds: the round tracker's own in-flight snapshots
(reboot-durable, sorted), folded by the emitter beside the run rows. Before
this the client COUNTED run rows to fake a 'round scoreboard' and the round
lifecycle was command-poll only — invisible to every widget and every mind.

- BenchRoundRow on the wire (serde default: pre-rounds wires fold to the
  honest empty), lossless snapshot→row fold in the emitter, store-on-change
  comparison includes rounds.
- renderBench: round rows (suite · stage · settled/dispatched · settle bar ·
  citizen/detached driver tag) render even on an empty-runs board — a
  freshly staged round showing 'nothing here' is launch-and-pray blindness.
- Positronic parity: ViewStateRagSource<BenchViewState> units() now leads
  with round lines, so a citizen's perception carries the SAME scoreboard
  the human screen renders (the acceptance test of
  BENCHMARKS-ARE-ADAPTERS).
- BenchRoundRow declared in the SDK's vendored set + barrels; BenchRoundVM
  in patterns; fold in benchProjections (adapt, never recompute).

Validation: cargo check + targeted tests green (both crates), all client
suites green (208), typecheck 0, vendor:views:check in sync.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants