From 906d1088483418bbe347993fd909af054893fcd8 Mon Sep 17 00:00:00 2001 From: CJ Pais Date: Sun, 28 Jun 2026 21:43:52 +0800 Subject: [PATCH 1/2] format repo + ci gates --- .github/workflows/clang-format.yml | 24 + AGENTS.md | 15 + CONTRIBUTING.md | 21 +- examples/bench/batch_bench.cpp | 157 +- examples/cli/main.cpp | 1120 ++-- examples/common/dr_wav.h | 4553 +++++++++-------- examples/common/wav.cpp | 32 +- examples/common/wav.h | 6 +- examples/hello/main.c | 24 +- examples/hello_stream/main.c | 71 +- include/transcribe.h | 427 +- include/transcribe/parakeet.h | 10 +- include/transcribe/voxtral_realtime.h | 3 +- include/transcribe/whisper.h | 40 +- scripts/ci/clang-format.sh | 101 + src/arch/canary/canary.h | 54 +- src/arch/canary/capabilities.cpp | 4 +- src/arch/canary/decoder.cpp | 750 +-- src/arch/canary/decoder.h | 50 +- src/arch/canary/encoder.cpp | 129 +- src/arch/canary/encoder.h | 36 +- src/arch/canary/model.cpp | 1208 ++--- src/arch/canary/weights.cpp | 530 +- src/arch/canary/weights.h | 192 +- src/arch/canary_qwen/canary_qwen.h | 44 +- src/arch/canary_qwen/capabilities.cpp | 2 +- src/arch/canary_qwen/decoder.cpp | 313 +- src/arch/canary_qwen/decoder.h | 101 +- src/arch/canary_qwen/encoder.cpp | 133 +- src/arch/canary_qwen/encoder.h | 38 +- src/arch/canary_qwen/model.cpp | 1201 +++-- src/arch/canary_qwen/weights.cpp | 363 +- src/arch/canary_qwen/weights.h | 191 +- src/arch/cohere/capabilities.cpp | 2 +- src/arch/cohere/cohere.h | 50 +- src/arch/cohere/decoder.cpp | 940 ++-- src/arch/cohere/decoder.h | 90 +- src/arch/cohere/encoder.cpp | 147 +- src/arch/cohere/encoder.h | 36 +- src/arch/cohere/model.cpp | 1168 ++--- src/arch/cohere/weights.cpp | 433 +- src/arch/cohere/weights.h | 98 +- src/arch/funasr_nano/adaptor.cpp | 125 +- src/arch/funasr_nano/adaptor.h | 26 +- src/arch/funasr_nano/capabilities.cpp | 6 +- src/arch/funasr_nano/decoder.cpp | 307 +- src/arch/funasr_nano/decoder.h | 97 +- src/arch/funasr_nano/encoder.cpp | 41 +- src/arch/funasr_nano/encoder.h | 12 +- src/arch/funasr_nano/funasr_nano.h | 32 +- src/arch/funasr_nano/model.cpp | 1007 ++-- src/arch/funasr_nano/weights.cpp | 567 +- src/arch/funasr_nano/weights.h | 183 +- src/arch/gigaam/capabilities.cpp | 2 +- src/arch/gigaam/decoder.cpp | 202 +- src/arch/gigaam/decoder.h | 22 +- src/arch/gigaam/encoder.cpp | 224 +- src/arch/gigaam/encoder.h | 38 +- src/arch/gigaam/gigaam.h | 22 +- src/arch/gigaam/mel.cpp | 76 +- src/arch/gigaam/mel.h | 16 +- src/arch/gigaam/model.cpp | 553 +- src/arch/gigaam/weights.cpp | 460 +- src/arch/gigaam/weights.h | 121 +- src/arch/granite/capabilities.cpp | 2 +- src/arch/granite/decoder.cpp | 794 ++- src/arch/granite/decoder.h | 93 +- src/arch/granite/encoder.cpp | 236 +- src/arch/granite/encoder.h | 56 +- src/arch/granite/granite.h | 34 +- src/arch/granite/model.cpp | 1135 ++-- src/arch/granite/projector.cpp | 134 +- src/arch/granite/projector.h | 23 +- src/arch/granite/weights.cpp | 600 ++- src/arch/granite/weights.h | 237 +- src/arch/granite_nar/capabilities.cpp | 2 +- src/arch/granite_nar/decoder.cpp | 151 +- src/arch/granite_nar/decoder.h | 21 +- src/arch/granite_nar/encoder.cpp | 336 +- src/arch/granite_nar/encoder.h | 85 +- src/arch/granite_nar/granite_nar.h | 22 +- src/arch/granite_nar/model.cpp | 487 +- src/arch/granite_nar/projector.cpp | 173 +- src/arch/granite_nar/projector.h | 19 +- src/arch/granite_nar/weights.cpp | 538 +- src/arch/granite_nar/weights.h | 165 +- src/arch/medasr/capabilities.cpp | 2 +- src/arch/medasr/encoder.cpp | 206 +- src/arch/medasr/encoder.h | 19 +- src/arch/medasr/medasr.h | 20 +- src/arch/medasr/model.cpp | 677 ++- src/arch/medasr/weights.cpp | 439 +- src/arch/medasr/weights.h | 131 +- src/arch/moonshine/capabilities.cpp | 2 +- src/arch/moonshine/decoder.cpp | 583 +-- src/arch/moonshine/decoder.h | 20 +- src/arch/moonshine/encoder.cpp | 152 +- src/arch/moonshine/encoder.h | 20 +- src/arch/moonshine/model.cpp | 780 ++- src/arch/moonshine/moonshine.h | 56 +- src/arch/moonshine/weights.cpp | 447 +- src/arch/moonshine/weights.h | 122 +- src/arch/moonshine_streaming/capabilities.cpp | 4 +- src/arch/moonshine_streaming/decoder.cpp | 620 +-- src/arch/moonshine_streaming/decoder.h | 92 +- src/arch/moonshine_streaming/encoder.cpp | 246 +- src/arch/moonshine_streaming/encoder.h | 33 +- src/arch/moonshine_streaming/model.cpp | 1601 +++--- .../moonshine_streaming/moonshine_streaming.h | 84 +- src/arch/moonshine_streaming/weights.cpp | 450 +- src/arch/moonshine_streaming/weights.h | 158 +- src/arch/parakeet/capabilities.cpp | 2 +- src/arch/parakeet/decoder.cpp | 902 ++-- src/arch/parakeet/decoder.h | 95 +- src/arch/parakeet/encoder.cpp | 521 +- src/arch/parakeet/encoder.h | 53 +- src/arch/parakeet/model.cpp | 2192 ++++---- src/arch/parakeet/parakeet.h | 90 +- src/arch/parakeet/weights.cpp | 696 +-- src/arch/parakeet/weights.h | 213 +- src/arch/qwen3_asr/capabilities.cpp | 2 +- src/arch/qwen3_asr/decoder.cpp | 320 +- src/arch/qwen3_asr/decoder.h | 133 +- src/arch/qwen3_asr/encoder.cpp | 245 +- src/arch/qwen3_asr/encoder.h | 28 +- src/arch/qwen3_asr/model.cpp | 1296 +++-- src/arch/qwen3_asr/qwen3_asr.h | 26 +- src/arch/qwen3_asr/weights.cpp | 499 +- src/arch/qwen3_asr/weights.h | 103 +- src/arch/sensevoice/capabilities.cpp | 4 +- src/arch/sensevoice/encoder.cpp | 68 +- src/arch/sensevoice/encoder.h | 8 +- src/arch/sensevoice/model.cpp | 559 +- src/arch/sensevoice/sensevoice.h | 16 +- src/arch/sensevoice/weights.cpp | 366 +- src/arch/sensevoice/weights.h | 101 +- src/arch/voxtral/capabilities.cpp | 2 +- src/arch/voxtral/decoder.cpp | 274 +- src/arch/voxtral/decoder.h | 85 +- src/arch/voxtral/encoder.cpp | 250 +- src/arch/voxtral/encoder.h | 16 +- src/arch/voxtral/model.cpp | 1028 ++-- src/arch/voxtral/voxtral.h | 17 +- src/arch/voxtral/weights.cpp | 390 +- src/arch/voxtral/weights.h | 110 +- src/arch/voxtral_realtime/capabilities.cpp | 2 +- src/arch/voxtral_realtime/decoder.cpp | 335 +- src/arch/voxtral_realtime/decoder.h | 103 +- src/arch/voxtral_realtime/encoder.cpp | 391 +- src/arch/voxtral_realtime/encoder.h | 60 +- src/arch/voxtral_realtime/model.cpp | 1915 ++++--- src/arch/voxtral_realtime/voxtral_realtime.h | 89 +- src/arch/voxtral_realtime/weights.cpp | 381 +- src/arch/voxtral_realtime/weights.h | 148 +- src/arch/whisper/bin_load.cpp | 524 +- src/arch/whisper/bin_load.h | 6 +- src/arch/whisper/capabilities.cpp | 8 +- src/arch/whisper/decoder.cpp | 768 ++- src/arch/whisper/decoder.h | 36 +- src/arch/whisper/encoder.cpp | 127 +- src/arch/whisper/encoder.h | 30 +- src/arch/whisper/model.cpp | 2399 +++++---- src/arch/whisper/public.cpp | 67 +- src/arch/whisper/weights.cpp | 565 +- src/arch/whisper/weights.h | 159 +- src/arch/whisper/whisper.h | 90 +- src/causal_lm/causal_lm.cpp | 810 ++- src/causal_lm/causal_lm.h | 189 +- src/conformer/conformer.cpp | 615 +-- src/conformer/conformer.h | 140 +- src/granite_conformer/shaw_attn.cpp | 89 +- src/granite_conformer/shaw_attn.h | 40 +- src/sanm/sanm.cpp | 151 +- src/sanm/sanm.h | 48 +- src/transcribe-abi.h | 5 +- src/transcribe-arch.cpp | 99 +- src/transcribe-arch.h | 79 +- src/transcribe-backend.cpp | 63 +- src/transcribe-backend.h | 10 +- src/transcribe-batch-util.cpp | 314 +- src/transcribe-batch-util.h | 72 +- src/transcribe-bin-loader.cpp | 249 +- src/transcribe-bin-loader.h | 45 +- src/transcribe-debug.cpp | 155 +- src/transcribe-debug.h | 18 +- src/transcribe-env.cpp | 2 +- src/transcribe-env.h | 2 +- src/transcribe-flash-policy.cpp | 5 +- src/transcribe-flash-policy.h | 5 +- src/transcribe-kaldi-fbank.cpp | 122 +- src/transcribe-kaldi-fbank.h | 45 +- src/transcribe-load-common.cpp | 498 +- src/transcribe-load-common.h | 36 +- src/transcribe-loader.cpp | 13 +- src/transcribe-loader.h | 20 +- src/transcribe-log.h | 2 +- src/transcribe-mel.cpp | 383 +- src/transcribe-mel.h | 54 +- src/transcribe-meta.cpp | 125 +- src/transcribe-meta.h | 40 +- src/transcribe-model.cpp | 28 +- src/transcribe-model.h | 34 +- src/transcribe-session.h | 88 +- src/transcribe-tokenizer.cpp | 324 +- src/transcribe-tokenizer.h | 49 +- src/transcribe-unicode.cpp | 192 +- src/transcribe-unicode.h | 16 +- src/transcribe-weights-util.cpp | 50 +- src/transcribe-weights-util.h | 24 +- src/transcribe.cpp | 1503 +++--- tests/api_smoke.c | 541 +- tests/backend_classification_unit.cpp | 54 +- tests/backend_init_unit.cpp | 138 +- tests/cohere_e2e_smoke.cpp | 178 +- tests/cohere_real_smoke.cpp | 165 +- tests/cohere_smoke.cpp | 270 +- tests/conv_pw_promote_unit.cpp | 116 +- tests/debug_dump_unit.cpp | 87 +- tests/decoder_smoke.cpp | 251 +- tests/loader_smoke.cpp | 82 +- tests/log_unit.cpp | 32 +- tests/mel_unit.cpp | 106 +- .../moonshine_streaming_batch_truncation.cpp | 53 +- tests/moonshine_streaming_stream_parity.cpp | 184 +- ...keet_chunked_limited_with_rc_mask_unit.cpp | 86 +- tests/parakeet_real_smoke.cpp | 166 +- tests/parakeet_smoke.cpp | 190 +- tests/parakeet_stream_ext_reject_unit.cpp | 81 +- tests/qwen3_asr_batch_truncation.cpp | 64 +- tests/qwen3_asr_bpe_parity.cpp | 82 +- tests/qwen3_asr_e2e_smoke.cpp | 189 +- tests/qwen3_asr_real_smoke_0_6b.cpp | 189 +- tests/qwen3_asr_real_smoke_1_7b.cpp | 160 +- tests/qwen3_asr_smoke.cpp | 238 +- tests/run_dispatch_unit.cpp | 186 +- tests/stream_capability_unit.cpp | 155 +- tests/stream_committed_pointer_stability.cpp | 75 +- tests/stream_dispatch_unit.cpp | 825 +-- tests/thread_default_unit.cpp | 41 +- tests/threadpool_oversubscription.c | 45 +- tests/tokenizer_decode_only_unit.cpp | 72 +- tests/tokenizer_smoke.cpp | 182 +- tests/voxtral_realtime_real_smoke.cpp | 100 +- tests/wav_loader_smoke.cpp | 26 +- tests/whisper_bin_e2e_smoke.cpp | 192 +- tests/whisper_bin_parser_unit.cpp | 107 +- tests/whisper_bin_tokenize_parity.cpp | 53 +- tests/whisper_e2e_smoke.cpp | 390 +- tests/whisper_tokenize_parity.cpp | 71 +- tools/transcribe-bench/main.cpp | 375 +- tools/transcribe-quantize/main.cpp | 166 +- tools/transcribe-quantize/policy.cpp | 202 +- tools/transcribe-quantize/policy.h | 36 +- 253 files changed, 32351 insertions(+), 31767 deletions(-) create mode 100644 .github/workflows/clang-format.yml create mode 100755 scripts/ci/clang-format.sh diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 00000000..fee45475 --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,24 @@ +name: clang-format + +on: + pull_request: + branches: [main] + push: + branches: [main] + +# Supersede in-flight runs on the same ref. +concurrency: + group: clang-format-${{ github.ref }} + cancel-in-progress: true + +jobs: + clang-format: + runs-on: blacksmith-2vcpu-ubuntu-2404 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v6 + - uses: astral-sh/setup-uv@v8.2.0 + - name: clang-format gate + # Our C/C++ must match the pinned clang-format. Scope (vendored excluded) + # and the pinned version both live in scripts/ci/clang-format.sh. + run: scripts/ci/clang-format.sh --check diff --git a/AGENTS.md b/AGENTS.md index f8655732..c1bf31ed 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,6 +24,21 @@ uv run --project scripts/envs/ scripts/