SETUP.md
Language Markdown4.7 KB118 lines
# SetupWritten for a Mac (Apple Silicon or Intel). Linux works the same apart fromthe Keychain and launchd steps.## 1. Install```bashgit clone https://github.com/mattrguerra/transcription-pipeline.git ~/transcription-pipelinecd ~/transcription-pipelinepython3.12 -m venv .venv # brew install python@3.12 if you don't have it.venv/bin/pip install -e ".[test]"```Use Python 3.10 to 3.13; 3.12 is the safest. WhisperX does not support 3.14yet, and a newer Homebrew `python3` may be 3.14, so name the version.This pulls in WhisperX, faster-whisper, pyannote.audio and PyTorch (a few GB).No system ffmpeg is needed: the `imageio-ffmpeg` package ships its own binary,and a Homebrew `ffmpeg` is used instead when there is one.The first transcription downloads the models into `~/.cache/huggingface`:faster-whisper large-v3-turbo (about 1.6 GB), the wav2vec2 alignment model forthe language, and the diarization model. Alignment also fetches NLTK's`punkt_tab` sentence data once. After that everything runs offline, exceptthe DeepInfra engine if you choose it.## 2. Speaker separation: a Hugging Face tokenpyannote's models are free but gated behind their terms.1. Make a Hugging Face account and a **read** token (Settings, Access Tokens).2. While signed in, open[pyannote/speaker-diarization-community-1](https://huggingface.co/pyannote/speaker-diarization-community-1)and accept the terms. (If you set `TP_DIARIZE_MODEL=pyannote/speaker-diarization-3.1`,accept that model's terms and those of[pyannote/segmentation-3.0](https://huggingface.co/pyannote/segmentation-3.0) instead.)3. Put the token in the Keychain:```bashsecurity add-generic-password -a "$USER" -s transcription-pipeline.huggingface -w````-w` with no value prompts for it, so the token never lands in shell history.The pipeline reads `HF_TOKEN` from the environment first, then the Keychain.Nothing is ever read from a file in the repo.Without a token, run with `--no-diarize`: you get the transcript withoutspeaker labels.## 3. Optional: DeepInfraLocal transcription is the default and nothing leaves the machine. DeepInfra'shosted Whisper large-v3-turbo is **recommended when quality matters most**: inuse it has transcribed noticeably better than faster-whisper running locallywith int8. The trade is that the audio is uploaded for thatone step (as 16 kHz FLAC). Alignment and speaker separation still run locally.```bashsecurity add-generic-password -a "$USER" -s transcription-pipeline.deepinfra -wtranscribe call.m4a --engine deepinfra```or set `TP_ENGINE=deepinfra` for the watch folder. Errors come back in plainwords: a rejected or rotated key (401/403), rate limited or out of credit(429), file too large (413).## 4. Check it works```bash.venv/bin/pytest -q # unit tier, no modelsTP_INTEGRATION=1 .venv/bin/pytest -q tests/integration # real models on real speech```The integration tier transcribes `tests/fixtures/two-speakers.flac` (twoLibriSpeech readers, four turns). With the Hugging Face token in theKeychain it also runs real pyannote diarization and checks that it finds bothvoices and switches at the right words.## 5. The watch folder```bashmkdir -p ~/Transcription/inbox```1. Edit `scheduling/run-inbox.sh`: `TP_ROOT`, `TP_VAULT_INBOX` (or delete thatline), `TP_ENGINE`.2. Copy `scheduling/com.example.transcription-pipeline.plist` to`~/Library/LaunchAgents/`, replace `YOU` with your user name, and load it:```bashlaunchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.transcription-pipeline.plist```Now anything dropped in `~/Transcription/inbox` is transcribed. The layout:| Folder | What goes there ||---|---|| `inbox/` | Drop recordings here: any audio or video ffmpeg reads. || `transcripts/` | `.txt`, `.md`, `.json` (plus `.srt` / `.vtt` if you add them to `TP_FORMATS`). || `done/` | The recording, once transcribed. || `failed/` | The recording plus `<name>.error.txt` saying why. Move it back to `inbox/` to retry. |The vault inbox gets a copy of the `.md` transcript, with frontmatter(`type: transcript`, `recorded`, `duration`, `speakers`, `engine`, `source`),so it flows into the rest of the vault like any other note.To stop it: `launchctl bootout gui/$(id -u)/com.example.transcription-pipeline`.The log is `~/Transcription/pipeline.log`.## Apple Silicon notes- faster-whisper runs on the **CPU with int8**. CTranslate2 has no Metalbackend, so there is no GPU path for this step on a Mac.- pyannote runs on the CPU. It supports MPS, but WhisperX's CPU path is theone tested here.- Keep the inbox outside iCloud Drive. With "Optimize Mac Storage" on, asynced file can be a placeholder rather than the audio itself.