@tryhamster/gerbil 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/{architectures-BH_z6k9d.mjs → architectures-DHwj9AQD.mjs} +37 -27
- package/dist/architectures-DHwj9AQD.mjs.map +1 -0
- package/dist/cli.mjs +8 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/{defaults-DfGx4d1m.mjs → defaults-B0aQZJTM.mjs} +3 -2
- package/dist/defaults-B0aQZJTM.mjs.map +1 -0
- package/dist/frameworks/express.mjs +1 -1
- package/dist/frameworks/fastify.mjs +1 -1
- package/dist/frameworks/hono.mjs +1 -1
- package/dist/frameworks/next.d.mts +2 -2
- package/dist/frameworks/next.mjs +1 -1
- package/dist/frameworks/trpc.mjs +1 -1
- package/dist/gerbil-Bw6do78d.mjs +4 -0
- package/dist/{gerbil-DF009Waa.d.mts → gerbil-CD_skiL3.d.mts} +2 -2
- package/dist/{gerbil-DF009Waa.d.mts.map → gerbil-CD_skiL3.d.mts.map} +1 -1
- package/dist/{gerbil-CpS3P240.mjs → gerbil-DAz_a4Jh.mjs} +22 -13
- package/dist/{gerbil-CpS3P240.mjs.map → gerbil-DAz_a4Jh.mjs.map} +1 -1
- package/dist/gpu/hooks.d.mts +1 -1
- package/dist/gpu/hooks.mjs +1 -1
- package/dist/gpu/index.d.mts +2 -2
- package/dist/gpu/index.mjs +5 -5
- package/dist/{gpu-DRFhiv4R.mjs → gpu-CU_Mldk0.mjs} +1275 -195
- package/dist/gpu-CU_Mldk0.mjs.map +1 -0
- package/dist/index-B3tjyDJI.d.mts.map +1 -1
- package/dist/{index-CNYoTRgr.d.mts → index-Fj2XkP-o.d.mts} +374 -3
- package/dist/index-Fj2XkP-o.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/integrations/ai-sdk.mjs +1 -1
- package/dist/integrations/langchain.mjs +1 -1
- package/dist/integrations/llamaindex.mjs +1 -1
- package/dist/integrations/mcp.d.mts +2 -2
- package/dist/integrations/mcp.mjs +4 -4
- package/dist/{mcp-DAbWO8VS.mjs → mcp-CdMvLQ_9.mjs} +3 -3
- package/dist/{mcp-DAbWO8VS.mjs.map → mcp-CdMvLQ_9.mjs.map} +1 -1
- package/dist/{moonshine-stt-B1kV5n1c.mjs → moonshine-stt-COJeK2Zb.mjs} +778 -3
- package/dist/moonshine-stt-COJeK2Zb.mjs.map +1 -0
- package/dist/moonshine-stt-Dp4j5JEB.mjs +4 -0
- package/dist/{one-liner-CmP9ktUn.mjs → one-liner-CMiGNWJ7.mjs} +2 -2
- package/dist/{one-liner-CmP9ktUn.mjs.map → one-liner-CMiGNWJ7.mjs.map} +1 -1
- package/dist/repl-BhaLCJFb.mjs +9 -0
- package/dist/skills/index.d.mts +2 -2
- package/dist/skills/index.mjs +3 -3
- package/dist/{skills-BDOEbHSx.mjs → skills-BXybFWlG.mjs} +2 -2
- package/dist/{skills-BDOEbHSx.mjs.map → skills-BXybFWlG.mjs.map} +1 -1
- package/dist/tune/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/architectures-BH_z6k9d.mjs.map +0 -1
- package/dist/defaults-DfGx4d1m.mjs.map +0 -1
- package/dist/gerbil-CZvoFo0T.mjs +0 -4
- package/dist/gpu-DRFhiv4R.mjs.map +0 -1
- package/dist/index-CNYoTRgr.d.mts.map +0 -1
- package/dist/moonshine-stt-B1kV5n1c.mjs.map +0 -1
- package/dist/moonshine-stt-DA1WuiZb.mjs +0 -4
- package/dist/repl-17NVeIaJ.mjs +0 -9
package/README.md
CHANGED
|
@@ -349,6 +349,30 @@ const engine = await WebGPUEngine.create({ repo: "nineninesix/kani-tts-2-en" });
|
|
|
349
349
|
const { pcm, sampleRate } = await engine.speak("Hello, I'm Gerbil!"); // sampleRate === 22050
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
+
**Streaming TTS** — native **Gepard-1.0** (Apache-2.0). Gepard is a stock Qwen3.5
|
|
353
|
+
codec-LM with 32 parallel FSQ classifier heads that emit one whole audio frame per
|
|
354
|
+
forward pass, so speech is frame synchronous: audio streams out chunk by chunk while
|
|
355
|
+
the model is still generating. Pass `onChunk` to receive PCM as it is produced.
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
const engine = await WebGPUEngine.create({ repo: "nineninesix/gepard-1.0" });
|
|
359
|
+
const { pcm, sampleRate } = await engine.speak("Hello from Gepard.", {
|
|
360
|
+
temperature: 0.4,
|
|
361
|
+
onChunk: ({ pcm, frameIndex, isFinal }) => {
|
|
362
|
+
// play or buffer each ~1.5s chunk as soon as it is decoded
|
|
363
|
+
},
|
|
364
|
+
}); // sampleRate === 22050
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Run the end to end example and write a .wav:
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
node scripts/engine/example-gepard-tts.mjs "The quick brown fox jumps over the lazy dog."
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Voice cloning (the reference speaker compressor) is present in the checkpoint but not
|
|
374
|
+
wired yet, so Gepard ships a single default voice for now.
|
|
375
|
+
|
|
352
376
|
**Speech-to-text** — native **Moonshine** (raw-waveform encoder/decoder, no FFT/log-mel)
|
|
353
377
|
via the dedicated `MoonshineSTT` class.
|
|
354
378
|
|
|
@@ -569,6 +593,7 @@ via `WebGPUEngine.create({ repo })`.
|
|
|
569
593
|
| Model | Type | Repo | Notes |
|
|
570
594
|
|-------|------|------|-------|
|
|
571
595
|
| **Kani-TTS-2** | TTS | `nineninesix/kani-tts-2-en` | `engine.speak()` → 22.05 kHz PCM |
|
|
596
|
+
| **Gepard-1.0** | TTS | `nineninesix/gepard-1.0` | Streaming `engine.speak({ onChunk })` → 22.05 kHz PCM, Apache-2.0 |
|
|
572
597
|
| **Moonshine** | STT | `UsefulSensors/moonshine-base` | `MoonshineSTT.transcribe()`, raw-waveform |
|
|
573
598
|
|
|
574
599
|
### Quantization & dtype
|
|
@@ -445,6 +445,8 @@ function ncWeight(name) {
|
|
|
445
445
|
}
|
|
446
446
|
function generateNanoCodecDecoderGraph(opts) {
|
|
447
447
|
const T = opts.numFrames;
|
|
448
|
+
const upSampleRates = opts.geometry?.upSampleRates ?? NANOCODEC_UP_SAMPLE_RATES;
|
|
449
|
+
const inputDim = opts.geometry?.inputDim ?? NANOCODEC_INPUT_DIM;
|
|
448
450
|
const tensors = {};
|
|
449
451
|
const nodes = [];
|
|
450
452
|
const executionOrder = [];
|
|
@@ -455,31 +457,39 @@ function generateNanoCodecDecoderGraph(opts) {
|
|
|
455
457
|
nodes.push(node);
|
|
456
458
|
executionOrder.push(node.id);
|
|
457
459
|
};
|
|
458
|
-
addTensor({
|
|
459
|
-
name: "audio_codes",
|
|
460
|
-
shape: [FSQ_NUM_GROUPS, T],
|
|
461
|
-
dtype: "u32",
|
|
462
|
-
storage: "activation"
|
|
463
|
-
});
|
|
464
|
-
addTensor({
|
|
460
|
+
if (opts.latentInput) addTensor({
|
|
465
461
|
name: "nc_latent",
|
|
466
|
-
shape: [
|
|
462
|
+
shape: [inputDim, T],
|
|
467
463
|
dtype: "f32",
|
|
468
464
|
storage: "activation"
|
|
469
465
|
});
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
466
|
+
else {
|
|
467
|
+
addTensor({
|
|
468
|
+
name: "audio_codes",
|
|
469
|
+
shape: [FSQ_NUM_GROUPS, T],
|
|
470
|
+
dtype: "u32",
|
|
471
|
+
storage: "activation"
|
|
472
|
+
});
|
|
473
|
+
addTensor({
|
|
474
|
+
name: "nc_latent",
|
|
475
|
+
shape: [inputDim, T],
|
|
476
|
+
dtype: "f32",
|
|
477
|
+
storage: "activation"
|
|
478
|
+
});
|
|
479
|
+
addNode({
|
|
480
|
+
id: "nc_fsq",
|
|
481
|
+
opType: "FSQDequant",
|
|
482
|
+
inputs: ["audio_codes"],
|
|
483
|
+
outputs: ["nc_latent"],
|
|
484
|
+
attributes: {
|
|
485
|
+
groups: FSQ_NUM_GROUPS,
|
|
486
|
+
dims: FSQ_DIMS_PER_GROUP,
|
|
487
|
+
T,
|
|
488
|
+
levels: [...FSQ_LEVELS],
|
|
489
|
+
base: [...FSQ_BASE]
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
483
493
|
/** Emit a causal Conv1dFull (padding = (K-1)*dilation, Lout = L). */
|
|
484
494
|
function causalConv(id, input, weightKey, biasKey, Cin, Cout, K, L, dilation, output) {
|
|
485
495
|
addTensor({
|
|
@@ -619,11 +629,11 @@ function generateNanoCodecDecoderGraph(opts) {
|
|
|
619
629
|
});
|
|
620
630
|
}
|
|
621
631
|
let cur = "nc_pre_conv_out";
|
|
622
|
-
causalConv("nc_pre_conv", "nc_latent", ncWeight("pre_conv.weight"), ncWeight("pre_conv.bias"),
|
|
632
|
+
causalConv("nc_pre_conv", "nc_latent", ncWeight("pre_conv.weight"), ncWeight("pre_conv.bias"), inputDim, NANOCODEC_BASE_CHANNELS, 7, T, 1, cur);
|
|
623
633
|
let channels = NANOCODEC_BASE_CHANNELS;
|
|
624
634
|
let length = T;
|
|
625
|
-
for (let stage = 0; stage <
|
|
626
|
-
const rate =
|
|
635
|
+
for (let stage = 0; stage < upSampleRates.length; stage++) {
|
|
636
|
+
const rate = upSampleRates[stage];
|
|
627
637
|
const outCh = channels / 2;
|
|
628
638
|
const upK = 2 * rate;
|
|
629
639
|
const hsOut = `nc_s${stage}_act`;
|
|
@@ -681,7 +691,7 @@ function generateNanoCodecDecoderGraph(opts) {
|
|
|
681
691
|
architecture: "NanoCodecDecoder",
|
|
682
692
|
config: {
|
|
683
693
|
hidden_size: NANOCODEC_BASE_CHANNELS,
|
|
684
|
-
num_layers:
|
|
694
|
+
num_layers: upSampleRates.length,
|
|
685
695
|
num_heads: 0,
|
|
686
696
|
num_kv_heads: 0,
|
|
687
697
|
head_dim: 0,
|
|
@@ -704,7 +714,7 @@ function generateNanoCodecDecoderGraph(opts) {
|
|
|
704
714
|
tensors,
|
|
705
715
|
nodes,
|
|
706
716
|
executionOrder,
|
|
707
|
-
inputs: ["audio_codes"],
|
|
717
|
+
inputs: [opts.latentInput ? "nc_latent" : "audio_codes"],
|
|
708
718
|
outputs: [postConv]
|
|
709
719
|
};
|
|
710
720
|
}
|
|
@@ -6769,4 +6779,4 @@ function isArchitectureSupported(name) {
|
|
|
6769
6779
|
|
|
6770
6780
|
//#endregion
|
|
6771
6781
|
export { kaniSinTensor as A, computeKaniPositions as C, kaniAttentionLayerIndices as D, generateNanoCodecDecoderGraph as E, CANONICAL_KEYS as F, DTYPE_BYTES as I, GEMMA4_VIS_KEYS as L, parseKaniConfig as M, DEFAULT_GROUP_SIZE as N, kaniCosTensor as O, quantizeInt4 as P, createDefaultHFKeyMapper as R, buildKaniLayerCosSin as S, generateKaniTtsGraph as T, moonshineEncoderFrames as _, PARLER_DAC_LATENT_DIM as a, KANI_START_OF_HUMAN as b, PARLER_SAMPLE_RATE as c, generateParlerEncoderGraph as d, parseParlerConfig as f, generateMoonshineEncoderGraph as g, generateMoonshineDecoderGraph as h, PARLER_DAC_DECODER_DIM as i, nanoCodecWeightMap as j, kaniLayerAlpha as k, buildT5RelativeBias as l, MOONSHINE_REMAINING_WORK as m, isArchitectureSupported as n, PARLER_DECODER_RATES as o, revertDelayPattern as p, PARLER_BOS_TOKEN_ID as r, PARLER_EOS_TOKEN_ID as s, generateGraph as t, generateParlerDecoderGraph as u, parseMoonshineConfig as v, foldNanoCodecWeightNorm as w, audioTokensToCodes as x, KANI_END_OF_HUMAN as y };
|
|
6772
|
-
//# sourceMappingURL=architectures-
|
|
6782
|
+
//# sourceMappingURL=architectures-DHwj9AQD.mjs.map
|