Skip to content

Latest commit

 

History

History
305 lines (237 loc) · 14.4 KB

cli-reference.md

File metadata and controls

305 lines (237 loc) · 14.4 KB

CLI reference

The installed command is batchalign. Options below are checked against python/batchalign/cli/ for version 0.10.1. Run batchalign COMMAND --help for the help shipped with your installation.

batchalign [GLOBAL OPTIONS] COMMAND [COMMAND OPTIONS] [PATHS...]

Global options

Option Default Meaning
--parallel N 8 Maximum concurrent input files; minimum 1
-v, --verbose Off Increase verbosity; repeat for more detail
-q, --quiet Off Suppress routine output and interactive credential prompts
--plain Automatic Use the non-live renderer
--ansi Automatic Force live rendering; --plain takes precedence if both are supplied
--help Show help

Global options go before the command. Device, model, and engine options belong to their individual commands.

Input selection

Processing commands accept one or more paths, or -i/--input-list/--file-list FILE. Directories are scanned recursively. CHAT commands accept .cha and .chat; media discovery accepts .wav, .mp3, .m4a, .flac, .ogg, .mp4, .mov, and .m4v. Actual decoding support depends on the media backend.

batchalign morphotag first.cha second.cha -o tagged/
batchalign transcribe -i recordings.txt -o transcripts/ --lang eng

A list is a UTF-8 text file containing one path per line. Blank lines and lines whose first non-space character is # are ignored. List entries are resolved relative to the list's directory. Positional paths are relative to the command's working directory. Paths are deduplicated after resolving them; a repeated entry is processed once. Whitespace around list entries is trimmed.

-o/--out DIR selects an output directory. Relative subdirectories are mirrored from the common input root. Without it, CHAT transformation commands write beside or over their input as described below. See Command I/O.

CHAT commands (align, phonetic, diarize, morphotag, translate, utseg, ai, and compare) also accept -m/--media DIR for a separate media hierarchy:

batchalign align transcripts/ -m recordings/ -o aligned/

For transcripts/session/clip.cha, media is searched in recordings/session/, using the @Media basename first, then clip, with a supported audio or video extension. Missing matches report an error. A single transcript uses the media folder directly; multiple paths or an input list use their common input root, as output mirroring does. The explicit media folder takes precedence over media beside transcripts. Transcript headers and output locations are preserved.

Commands

Command Purpose
transcribe Recording to CHAT transcript
align Forced alignment of CHAT against audio
avqi Measure paired sustained-vowel and continuous-speech audio; write avqi.csv
phonetic Add observed IPA to %pho using audio and phone-sequence DP
morphotag Add %mor and %gra
utseg Revise utterance segmentation
translate Add translation tiers
compare Compare CHAT against .gold.cha references
convert Convert media to WAV or MP3
diarize Assign speakers to existing timed CHAT
ai Apply an AI editing instruction to CHAT
cache Inspect or clear the result cache
version Print version and build information
daemon Run the separate HTTP service

transcribe

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--engine rev Choices: rev, whisper, chatwhisper, openai, funaudio, tencent, qwen3, aliyun, malayalam, google, pasketti. Pasketti supports English only.
--lang Required ISO-639-3 alpha_3 code: eng, cmn, yue, spa, … (Required.)
--model Unset ASR model id (engine-specific default if omitted).
--diarize/--no-diarize False Run speaker diarization with --diarize-engine after utterance segmentation.
--diarize-engine pyannote-ai Choices: pyannote-ai, pyannote. Diarization engine: pyannote-ai (cloud, default) or pyannote (local).
--num-speakers, -n 2 Expected speaker count (diarization hint).
--force-cpu False Run local inference, including utterance segmentation, on CPU (BA2's --force-cpu).
--allow-mps False Explicitly allow local ASR and utterance-segmentation models to use Apple MPS. Off by default because sustained MPS inference can be unstable; CHATWhisper remains float32 when selected.
--wor/--nowor False Include word-level timing (%wor and inline word bullets); omitted by default.

align

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--engine wav2vec Choices: wav2vec, whisper_fa, qwen. Forced-alignment engine: wav2vec | whisper_fa | qwen.
--model Unset FA model id (engine-specific default if omitted; wav2vec picks per the file language).
--force-cpu False Run the FA model on CPU (BA2's --force-cpu). Needed for whisper_fa on Apple MPS, where Whisper's bfloat16 attention kernel is unsupported.
--allow-mps False Explicitly allow local alignment models to use Apple MPS. Off by default because sustained MPS inference can be unstable.
--utr-engine rev Choices: off, whisper, rev. Utterance Timing Recovery backend: rev | whisper | off. When non-off, runs Task.Utr before FA to recover utterance bullets on fully-untimed CHATs. Automatically skipped when any utterance already carries a bullet — UTR is intended for fully-untimed transcripts only.
--utr-model Unset UTR model id (only used when --utr-engine=whisper; default is openai/whisper-large-v3 to match BA2's transcribe).

morphotag

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--retokenize/--no-retokenize False
--clear-existing/--keep-existing True If true (default), drop any pre-existing %mor:/%gra: tiers from each input before tagging so re-runs regenerate. Use --keep-existing to preserve them and let the engine skip already-tagged utterances.

utseg

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--stanza-fallback/--no-stanza-fallback False
--language en
--force-cpu False Run utterance segmentation on CPU.
--allow-mps False Use Apple MPS for utterance segmentation when available.

translate

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--target eng Target language code (ISO 639-3).
--engine google Choices: google, nllb, tencent, aliyun.

compare

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details

convert

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--format Required Choices: mp3, wav. Output format: mp3 or wav.

diarize

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
--engine pyannote-ai Choices: pyannote-ai, pyannote. Diarization engine: pyannote-ai (cloud) or pyannote (local).
--num-speakers, -n 0 Expected speaker count; zero auto-detects.

avqi

batchalign [--parallel N] avqi SUSTAINED_VOWEL CONTINUOUS_SPEECH [-o DIRECTORY]

Both arguments must be files or both must be directories. Directory pairing uses mirrored relative stems, optionally stripping terminal .sv / .cs markers. The output is one avqi.csv in DIRECTORY (the current directory by default). This command does not use CHAT inputs, --media, or --input-list. Install batchalign[avqi]; inputs need at least 20 kHz audio and the vowel must be at least three seconds. See AVQI for measurement details, CSV columns, and failure behavior.

phonetic

Accepts timed CHAT and matching audio, using shared input selection and -o/--out. Install the phonetic extra for PhoneticXeus, Pasketti, Piper Plus G2P, and Epitran. Phonetic transcription requires Python 3.11 or newer. The first inference downloads the pinned model revision; building the CLI and displaying help do not download model weights.

just batchalign cli phonetic recording.cha --out phonetic-output --force-cpu

The command recognizes phones from audio and DP-aligns them against reference IPA pronunciations to recover word boundaries. %pho retains the observed IPA, including pronunciation differences. Existing %pho tiers are preserved. The input must have utterance timing bullets. Prepare an aligned transcript with align first if timing is missing. Word-level forced alignment is not required.

The default PhoneticXeus engine groups consecutive utterances into approximately 20-second audio windows, then projects phones back to their original words and utterances. Gaps over two seconds and backwards timings start a new window; an utterance longer than 20 seconds stays whole. Words receiving no phones are marked … (uncoded) and reported with their utterance timing.

Pasketti processes each English utterance separately using a full-precision WavLM CTC model; it does not combine adjacent turns.

Windows of similar duration are batched using padding and real encoder lengths. Normalization is performed independently per window, and padded output frames are excluded from decoding. CPU defaults to one window at a time; CUDA defaults to two. Increase --batch-size to try higher GPU throughput, or decrease it to reduce memory use. Batched and single-window output can differ slightly because the upstream encoder's convolution branches remain sensitive to padding.

Option Default Details
--engine phoneticxeus phoneticxeus or pasketti (English child speech)
--pronunciations None UTF-8 CSV with header word,ipa; one word or whole phonological unit and its IPA per row, overriding the generated pronunciation.
--force-cpu False Use CPU instead of automatic CUDA selection. MPS is not selected.
--batch-size CPU 1, CUDA 2 Maximum audio windows per model batch; must be positive.

The task runner passes the primary @Languages code from CHAT. No separate language option is needed. Piper Plus G2P 0.2.0 handles English, Japanese, Mandarin Chinese, Korean, Spanish, French, Portuguese, and Swedish. Both cmn and zho select Mandarin; Cantonese (yue) is a separate language and uses the fallback.

Other languages use Epitran, with their default script resolved automatically (e.g. Russian rus-Cyrl, Hindi hin-Deva). A failure in a supported Piper backend is reported rather than silently switching providers. English does not require Flite's lex_lookup or eSpeak; Python language packages are included in the extra. Language resources may download on first use.

The DP compares IPA directly, preserving distinctions such as nasalization, vowel length, and tone. Piper's language-specific phone/tone labels are converted to IPA before comparison. References only determine grouping; they never replace the observed phones. Alternate scripts and code-switched words can use pronunciation overrides. Pass --pronunciations pronunciations.csv to supply dialect forms or words in unsupported languages. For example:

word,ipa
wug,wʌɡ
bonjour,bɔ̃ʒuʁ
the cat,ðəkæt

The header is required. Use standard CSV quoting for cells containing commas. Words are matched without case; empty cells and duplicate words are errors. An unknown pronunciation or invalid audio window fails the file without overwriting it. A word without aligned phones receives …. Insertions between word anchors attach to the preceding word; review inferred boundaries, especially around reduced or atypical speech.

Python pipelines can compose recipes.phonetic(phonetic_backend=backend, utr_backend=...) with existing tasks. Custom backends implement the Phonetic marker and typed PhoneticInput/PhoneticOutput contract; the Rust runner owns CHAT extraction, result validation, and tier insertion.

ai

Accepts the shared input selection and -o/--out options above.

Option or argument Default Details
INSTRUCTION Required Instruction applied to every utterance.
--engine dspy Choices: dspy.
--model zai-org/GLM-5.2 DSPy LM model string.
--max-tokens 1024 Maximum output tokens for the DSPy LM call.
--timeout 30 Per-utterance DSPy LM timeout in seconds.

daemon

Option or argument Default Details
--host 127.0.0.1 Bind address. Use 0.0.0.0 to accept off-host connections; default loopback-only so an unsecured daemon can't be exposed accidentally.
--port 8765 Bind port.
--workers 1 Worker process count. Pinned to 1 by default — the in-memory job registry is per-process. Overriding requires a shared registry backend (not yet wired).
--log-level info uvicorn log level: critical/error/warning/info/debug/trace.
--access-log/--no-access-log True Emit HTTP access logs (one line per request).
--proxy-headers/--no-proxy-headers True Trust X-Forwarded-* headers from the upstream reverse proxy. Combine with --forwarded-allow-ips when fronted by nginx/ALB.
--forwarded-allow-ips 127.0.0.1 Comma-separated upstream IPs trusted for X-Forwarded-. Use '' only when the daemon is behind a trusted proxy.
--graceful-timeout 30 Seconds to wait for in-flight requests to drain on SIGTERM.
--dev False Development mode: enable --reload, drop production defaults. Never use in production — disables clean shutdown handling.

cache

batchalign cache path
batchalign cache stats
batchalign cache clear [--yes]

See Manage the result cache.

version

batchalign version

Removed or unregistered interfaces

The current command registry does not expose serve, jobs, logs, setup, doctor, bench, benchmark, eval, or coref. A coreference recipe and backend interface exist in the Python API, but the module under cli/hidden/ is not registered as a public command. Old server and benchmark examples are not current CLI syntax.