Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ src/ libparakeet implementation
common.hpp/cpp , logging helpers
audio_io.hpp/cpp , dr_wav load + linear resample to 16k
model_loader.hpp/cpp, GGUF -> ParakeetConfig + name->tensor
bundle.hpp/cpp , bundle GGUF header: components, licences, default component (docs/bundle.md)
bundle_extract.hpp/cpp, one bundle component as a standalone GGUF (memfd or temporary file) for the path-only ced.cpp and voice-detect.cpp loaders
mel.cpp , log-mel frontend
encoder.cpp / conformer.cpp / relpos_attention.cpp
ctc_decoder.cpp , CTC head + greedy decode
Expand Down Expand Up @@ -112,6 +114,7 @@ examples/cli/ parakeet-cli binary
diarize binary: diarize <diar.gguf> <wav> [--stream]
scripts/ Python tooling
convert_parakeet_to_gguf.py, .nemo/.hf -> GGUF (--dtype f32|f16|q8_0)
bundle_gguf.py , merge GGUFs into one bundle; --list/--verify/--notice with the licence texts of scripts/bundle_licenses/ (docs/bundle.md)
convert_hf_parakeet_to_gguf.py, HF safetensors (moondream/parakeet-ultra, -redux) to GGUF (--template, --ternary keep|dequant, --vad keep|drop)
slice_vad_gguf.py , cut a VAD-only GGUF (parakeet.arch "vad") out of an Ultra or Redux GGUF
gen_nemo_baseline.py , NeMo intermediates -> baseline.gguf
Expand All @@ -129,6 +132,10 @@ tests/ ctest targets
test_pool_stress.cpp , N threads x K backends == single-thread results; PARAKEET_STRESS_QUICK=1 for slow builds (PARAKEET_TEST_GGUF, _ULTRA, _REDUX_KEEP)
test_pool_shutdown.cpp , pool create/destroy leaves no threads, results equal (PARAKEET_TEST_GGUF)
test_model_loader.cpp , config + tensor map (model-dependent)
test_bundle.cpp , bundle header, selection, partial read, Silero component, C-API (model-independent, synthetic files)
test_bundle_models.cpp , real bundle == single-model files: transcript, VAD head, Silero (PARAKEET_TEST_BUNDLE, _ASR, _SILERO)
test_bundle_full.cpp , full bundle (asr, diar, ced, voice, vad) == single-model files, memfd and temporary-file paths (PARAKEET_TEST_BUNDLE_FULL, PARAKEET_TEST_FULL_*)
python/check_bundle.py , bundle_gguf.py build/verify/refusals, licence policy, NOTICE (model-independent)
test_capi.cpp , C-API load -> transcribe -> free (model-dependent)
test_transcribe_speech.cpp, end-to-end CTC transcript (model-dependent)
test_transcribe_tdt.cpp , TDT transcript on speech fixture (model-dependent)
Expand Down Expand Up @@ -188,6 +195,7 @@ models/ output dir for converted GGUFs (gitignored;
MANIFEST.md tracks the expected published set)
docs/
conversion.md , GGUF schema reference
bundle.md , bundle GGUF format: several models in one file, per-component licences
quantization.md , quantization allowlist, policy, measured size + WER per type
parity.md , full model coverage matrix + per-stage tensor parity
concurrency.md , backend pool: concurrent requests, thread rules, measured throughput, TSan recipe
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ set(PARAKEET_SRC
src/vad_head.cpp
src/vad_segmenter.cpp
src/vad_json.cpp
src/bundle.cpp
src/bundle_extract.cpp
src/parakeet_capi.cpp
src/common.cpp
src/audio_io.cpp
Expand Down
399 changes: 399 additions & 0 deletions docs/bundle.md

Large diffs are not rendered by default.

33 changes: 29 additions & 4 deletions examples/cli/diarize.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// Standalone diarize tool: loads a diarization GGUF and diarizes a WAV.
// Usage: diarize <gguf> <wav> [--stream [model|low|very_low|ultra_low]]
// Usage: diarize <gguf> <wav> [--stream [model|low|very_low|ultra_low]] [--component NAME]
// <gguf> may be a bundle GGUF: its only "diar" component is used, or the one named by --component.
// Prints {"speakers":N,"segments":[{"speaker","start","end"}, ...]}.
// --stream feeds the audio through the streaming C-API in 100 ms pieces (NeMo
// cache-aware streaming) instead of the whole-file path, optionally in one of
// the model card's latency modes (default: the checkpoint's configuration).
#include "parakeet_capi.h"
#include "audio_io.hpp"
#include "bundle.hpp"

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>

static int diarize_stream(parakeet_ctx* ctx, const char* wav, int latency) {
Expand Down Expand Up @@ -56,9 +59,12 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "usage: %s <gguf> <wav> [--stream [model|low|very_low|ultra_low]]\n", argv[0]);
return 1;
}
std::string component;
for (int i = 3; i + 1 < argc; ++i)
if (std::strcmp(argv[i], "--component") == 0) { component = argv[i + 1]; break; }
const bool stream = argc > 3 && std::strcmp(argv[3], "--stream") == 0;
int latency = PARAKEET_DIAR_LATENCY_MODEL;
if (stream && argc > 4) {
if (stream && argc > 4 && std::strcmp(argv[4], "--component") != 0) {
const char* names[] = {"model", "low", "very_low", "ultra_low"};
latency = -1;
for (int i = 0; i < 4; ++i)
Expand All @@ -68,9 +74,28 @@ int main(int argc, char** argv) {
return 1;
}
}
parakeet_ctx* ctx = parakeet_capi_load(argv[1]);
if (component.empty() && pk::gguf_is_bundle(argv[1])) {
pk::BundleInfo info;
std::string err;
if (!pk::read_bundle_info(argv[1], info, &err)) { std::fprintf(stderr, "%s\n", err.c_str()); return 1; }
int n = 0;
for (const pk::BundleComponent& c : info.components)
if (c.kind == pk::kBundleKindDiar) { component = c.name; ++n; }
if (n != 1) {
std::fprintf(stderr, "bundle has %s diarization component; name one with --component (components: %s)\n",
n == 0 ? "no" : "several", pk::bundle_component_names(info).c_str());
return 1;
}
}
parakeet_ctx* ctx = component.empty() ? parakeet_capi_load(argv[1])
: parakeet_capi_load_component(argv[1], component.c_str());
if (!ctx) {
std::fprintf(stderr, "failed to load %s\n", argv[1]);
std::fprintf(stderr, "failed to load %s: %s\n", argv[1], parakeet_capi_load_error());
return 1;
}
if (parakeet_capi_model_kind(ctx) != PARAKEET_MODEL_KIND_DIARIZATION) {
std::fprintf(stderr, "%s is not a diarization model\n", argv[1]);
parakeet_capi_free(ctx);
return 1;
}
int rc = 0;
Expand Down
Loading
Loading