Repository navigation
Conversation
Server-side data path for single-speaker personalization: iPhone records prompted clips → relay presigns R2 PUTs → Modal pulls from R2 into the existing data volume → unchanged prepare/train. macOS/transcription/full auth deferred. cloud/relay (Bun + Hono + bun:sqlite + @aws-sdk R2 presigner), deployable behind Caddy on the relay VPS: - GET prompts (versioned), POST examples (idempotent on idempotency_key; returns presigned PUT; never proxies video), POST examples/complete, - GET status, GET export (what Modal reads), POST presign (batch GETs), DELETE examples (R2 object + row). - SQLite metadata on VPS; R2 S3 creds live ONLY here. Split assigned by session and persisted. clip_id sanitized to prepare's _safe_component rule. - 14 contract tests pass with an injected mock presigner (no network/R2). cloud/modal/ingest.py: ingest_from_r2 on a light image (requests only, no torch/mediapipe/engine; no R2 creds). Reads the relay export, batch-presigns GETs just-in-time, streams clips to /data/<speaker>/clips, atomically writes manifest.csv (id,video,text,split), commits the volume. Idempotent + a manifest_only dry-run. prepare/train untouched. prompts: 300 ASCII, letters-only prompted sentences (rev 2026-07-25) + a deterministic generator. tests/test_ingest proves the generated manifest round-trips through prepare_dataset._load_manifest and that ingest's id sanitizer is byte-identical to prepare_dataset._safe_component. .gitignore: ignore *.mp4/*.mov/*.m4v/*.webm so clips never get committed. Co-Authored-By: Claude <noreply@anthropic.com>
Validated end-to-end against the real Cloudflare R2 bucket (visual-transcription) using the existing caringmind-relay Doppler creds: - config: accept generic S3_* names (S3_ACCESS_KEY/S3_SECRET_KEY/ S3_ENDPOINT/S3_REGION/S3_FORCE_PATH_STYLE) as fallbacks, since the account-wide R2 token already lives there under those names; rename the bind-address env HOSTNAME -> BIND_HOST (HOSTNAME collides with the shell var on the VPS). - r2: honor forcePathStyle so presigned URLs match the existing relay's path-style R2 access. - app: presign the PUT before inserting the example row, so an R2/presign failure no longer leaves an orphan DB row. Verified: presigned PUT returns HTTP 200 to visual-transcription; the smoke dataset (s01/s02/s03) ingests via cloud/modal/ingest.py into the data volume with a correct manifest (id,video,text,split; splits train/val/test). Co-Authored-By: Claude <noreply@anthropic.com>
The prompt generator now enforces coverage by construction instead of random sampling, for a hybrid assistant+general deployment (~750 prompts): - Each of 10 viseme groups (bilabial/labiodental/dental/alveolar/postalveolar/ r-l/velar/front-vowel/back-vowel/diphthong) has dedicated minimal-pair contrastive sentences included before any fill — these are where lip-reading actually fails. All 31 digit sentences and all curated general/assistant sentences are guaranteed; varied verb/object/place templates fill the rest (~650 unique words, lengths 2-10). - Prints a coverage report (per-group counts, length histogram, top words). - docs/data-coverage.md: the coverage plan — viseme targets, the 4-5 environment session matrix (place/lighting/device/background/split), silent mouthing, session-disjoint held-out test for honest WER, QC rules, and a concrete recording schedule wired to the relay + Modal ingest/prepare/train. Regenerate: `bun cloud/relay/prompts/generate.ts --count 750 --rev <date>` (bump --rev when the set changes; the relay serves the newest rev file). Redeployed to the relay VPS (now serving 750). Co-Authored-By: Claude <noreply@anthropic.com>
Wire --pretrained-model into the personalization pipeline so any base can be A/B-tested against the default, per docs/pretrained-models.md. (The research log predicts same-arch swaps are neutral-to-worse; this makes the test cheap.) train (Modal): - new params: pretrained_model (default|lrs3-visual-only|hf:..|r2:..|path), transfer_frontend, transfer_encoder. - resolves the selector to a concrete checkpoint path in-container, then passes --pretrained-model-path + transfer flags to train_personal.py (unchanged except the two new optional flags). "default" stays None and train_personal downloads the pinned, checksum-verified Auto-AVSR base. cloud/modal/pretrained_resolver.py: the selector->path mapping. - default -> None; lrs3-visual-only -> reads pretraining/.../source.json and FAILS CLOSED with the pin procedure until revision+checksums are resolved; - hf:repo[@rev]:file -> huggingface_hub; r2:key -> relay POST /v1/presign -> presigned GET; bare path -> the path. Keeps training/ free of relay/HF I/O. evaluate (Modal) + training/eval_personal.py: score a checkpoint (a trained run's personalized_model.pt OR the base) on the held-out test split -> WER, for base-vs-personalized A/B (train already reports personalized test WER). relay: POST /v1/presign (raw R2 keys) so r2: model resolution works; auth widened to /v1/*. +2 contract tests (relay 16/16, tsc clean). tests/test_pretrained_resolver.py: 6 tests (default/None, path existing/missing, lrs3-unpinned-fails-closed, r2-without-creds). 15/15 python tests pass. docs/pretrained-models.md: catalog of bases + alternatives evaluated + the A/B recipe + the promotion gate for adding a new base. Co-Authored-By: Claude <noreply@anthropic.com>
The relay README and config comment referenced an internal VPS/project by name. This is a public repo, so use generic phrasing instead. No behavior change. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A full personalization data pipeline for Open-Alterego, plus coverage planning and pretrained-base selectability. Builds on #1 (includes the same engine-install fix commit, so merging this supersedes #1 — or merge #1 first and this PR's diff shrinks to the new work).
What's in it
cloud/relay/— Bun + Hono + bun:sqlite + R2-presign gateway. The iOS app (Phase B, not here) never holds R2 creds; it gets short-lived scoped presigned PUTs from this relay. Endpoints (bearer-auth):GET prompts(versioned),POST examples(idempotent → presigned PUT, never proxies video),POST examples/complete,GET status,GET export(what Modal reads),POST presign(batch clip GETs),POST /v1/presign(raw R2 keys, for model fetch),DELETE. SQLite metadata on the host; R2 S3 creds live only here. 16 contract tests,tscclean.cloud/modal/ingest.py—ingest_from_r2(speaker, …)on a light image (requestsonly; no torch/mediapipe/engine; no R2 creds in Modal). Reads the relay export, batch-presigns GETs on demand, streams clips to/data/<speaker>/clips, atomically writesmanifest.csv(id,video,text,split), commits the volume. Idempotent +manifest_onlydry-run.prepare/trainare unchanged.Coverage —
cloud/relay/prompts/generate.tsnow enforces coverage by construction: every viseme group has dedicated minimal-pair sentences, plus digits + hybrid assistant/general vocabulary (750 prompts).docs/data-coverage.mdis the recording plan (viseme targets, 4–5 environment session matrix, session-disjoint held-out test, QC, recording schedule).Base-selectability + eval —
--pretrained-model default|lrs3-visual-only|hf:..|r2:..|pathwired through Modaltrain/evaluate(cloud/modal/pretrained_resolver.py);lrs3-visual-onlyfails closed untilpretraining/.../source.jsonis pinned.training/eval_personal.py+ Modalevaluatescore a checkpoint on the test split for base-vs-personalized A/B.docs/pretrained-models.mdcatalogs the bases + alternatives evaluated + the verdict.Validation status (honest)
tscclean; python 15/15 (ingest manifest round-trips throughprepare's real_load_manifest; resolver unit tests).train_personal/eval_personal--helpshow the new flags;cloud.modal.appimports clean.prepare/train/evaluateon real face clips, and thehf:/r2:/transfer-flag runtime with a non-default base, are code-complete but not yet run — they need (a) real personalization recordings and (b) a pinned candidate checkpoint.default+ good coverage + personalization remains the recommended path. The switch is there to prove that cheaply.Security
Full-branch secret audit before push: no secrets/keys leak. No relay token, no R2 access/secret keys, no bucket name, no real R2 account id (only
<account_id>placeholder), no public IP (only127.0.0.1/0.0.0.0), no internal project names (sanitized). All credentials are runtime-injected via Doppler / Modal secrets / env. The test bearer is"test-bearer-token"(fake); "wifi password" is a prompt sentence.🤖 Generated with Claude Code