Skip to content

Commit e032156

Browse files
committed
Make Kroko ASR model-spec v1 native
1 parent 54c0ced commit e032156

10 files changed

Lines changed: 224 additions & 487 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,12 +426,11 @@ audiocpp_add_model(kroko_asr
426426
src/community_models/kroko_asr/decoder.cpp
427427
src/community_models/kroko_asr/encoder.cpp
428428
src/community_models/kroko_asr/frontend.cpp
429-
src/community_models/kroko_asr/loader.cpp
430429
src/community_models/kroko_asr/session.cpp
431430
src/community_models/kroko_asr/tokenizer.cpp
432431
src/community_models/kroko_asr/zipformer.cpp
433432
INCLUDES
434-
engine/community_models/kroko_asr/loader.h
433+
engine/community_models/kroko_asr/session.h
435434
LOADERS
436435
engine::models::kroko_asr::make_kroko_asr_loader
437436
)

docs/community_models/kroko_asr.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,10 @@ Kroko-SV-Community-64-L-Native/
7979
`-- tokens.txt
8080
```
8181

82-
The package metadata follows the current split catalog:
83-
84-
- `model_specs/kroko_asr.json` contains only the runtime GGUF/safetensors
85-
resource layout used by loaders and embedded standalone GGUF metadata.
86-
- `model_specs_v1/kroko_asr.json` contains the family catalog metadata,
87-
languages, capabilities, options, and converter-package description.
82+
Kroko is v1-native. `model_specs/kroko_asr.json` is the single source of truth
83+
for metadata, capabilities, normalized options, package installation, and the
84+
GGUF/safetensors resource layout. The generic spec-backed loader derives model
85+
inspection and CLI/help metadata from that contract.
8886

8987
The converter supports both public chunk layouts (`141/128` feature frames for
9088
64-L and `269/256` for 128-L). It dequantizes `MatMulInteger` tensors, recovers
@@ -154,14 +152,12 @@ rules as sherpa-onnx:
154152
| `hotwords` | empty | Slash- or newline-separated natural-text phrases |
155153
| `hotwords_score` | `1.5` | Non-negative context boost per hotword token |
156154
| `enable_endpoint` | `false` | Enable automatic speech-segment boundaries |
157-
| `rule1_min_trailing_silence` | `2.4` | Endpoint timeout even without decoded speech |
158-
| `rule2_min_trailing_silence` | `1.2` | Endpoint silence after decoded speech |
159-
| `rule3_min_utterance_length` | `20` | Maximum utterance duration before an endpoint |
160-
161-
Legacy `max_active_paths` and namespaced aliases such as
162-
`kroko_asr.decoding_method` are also accepted.
163-
Hotwords require modified beam search. Greedy remains the backward-compatible
164-
default.
155+
| `rule1_min_trailing_silence_sec` | `2.4` | Endpoint timeout even without decoded speech |
156+
| `rule2_min_trailing_silence_sec` | `1.2` | Endpoint silence after decoded speech |
157+
| `rule3_min_utterance_length_sec` | `20` | Maximum utterance duration before an endpoint |
158+
159+
Request keys use the normalized v1 names directly. Hotwords require modified
160+
beam search. Greedy remains the default.
165161

166162
## Standalone GGUF
167163

docs/reports/kroko_asr_validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ build\windows-cuda-release\bin\audiocpp_cli.exe `
248248
--backend cpu --threads 8 `
249249
--audio ..\outputs\kroko_endpoint_two_utterances.wav --language en `
250250
--request-option enable_endpoint=true `
251-
--request-option rule2_min_trailing_silence=1.2 `
251+
--request-option rule2_min_trailing_silence_sec=1.2 `
252252
--text-out ..\outputs\kroko_endpoint_native.txt `
253253
--segments-out ..\outputs\kroko_endpoint_native_segments.json
254254
```

include/engine/community_models/kroko_asr/loader.h

Lines changed: 0 additions & 36 deletions
This file was deleted.

include/engine/community_models/kroko_asr/session.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "engine/community_models/kroko_asr/encoder.h"
66
#include "engine/community_models/kroko_asr/tokenizer.h"
77
#include "engine/community_models/kroko_asr/zipformer.h"
8+
#include "engine/framework/model_spec/metadata.h"
89
#include "engine/framework/runtime/session_base.h"
910

1011
#include <chrono>
@@ -16,6 +17,8 @@
1617

1718
namespace engine::models::kroko_asr {
1819

20+
std::shared_ptr<runtime::IVoiceModelLoader> make_kroko_asr_loader();
21+
1922
class KrokoASRSession final
2023
: public runtime::RuntimeSessionBase,
2124
public runtime::IOfflineVoiceTaskSession,
@@ -24,7 +27,8 @@ class KrokoASRSession final
2427
KrokoASRSession(
2528
runtime::TaskSpec task,
2629
runtime::SessionOptions options,
27-
std::shared_ptr<const KrokoASRAssets> assets);
30+
std::shared_ptr<const KrokoASRAssets> assets,
31+
std::shared_ptr<const engine::model_spec::ModelContract> contract);
2832
~KrokoASRSession() override;
2933

3034
std::string family() const override;
@@ -65,6 +69,7 @@ class KrokoASRSession final
6569

6670
runtime::TaskSpec task_;
6771
std::shared_ptr<const KrokoASRAssets> assets_;
72+
std::shared_ptr<const engine::model_spec::ModelContract> contract_;
6873
KrokoTokenizer tokenizer_;
6974
KrokoTransducerDecoder decoder_;
7075
KrokoEncoderRuntime subsampling_;

model_specs/kroko_asr.json

Lines changed: 157 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,128 @@
11
{
2+
"schema_version": 1,
23
"family": "kroko_asr",
4+
"display_name": "Kroko Community ASR",
5+
"description": "Native Zipformer2 RNN-T transcription for the public free Kroko Community single-language packages, with offline and stateful streaming inference, greedy and modified beam decoding, hotwords, endpoint segments, partial results, and word timestamps.",
6+
"category": "asr",
7+
"status": "community",
8+
"tasks": [
9+
"asr"
10+
],
11+
"modes": [
12+
"offline",
13+
"streaming"
14+
],
15+
"languages": [
16+
"de",
17+
"en",
18+
"es",
19+
"fr",
20+
"it",
21+
"he",
22+
"nl",
23+
"pt",
24+
"sv",
25+
"tr"
26+
],
27+
"capabilities": {
28+
"asr": [
29+
"word_timestamps",
30+
"partial_results",
31+
"segments"
32+
]
33+
},
34+
"options": {
35+
"request": [
36+
{
37+
"name": "language",
38+
"type": "string",
39+
"description": "Language code matching the selected single-language Kroko package; default auto uses the package language.",
40+
"required": false,
41+
"default": "auto"
42+
},
43+
{
44+
"name": "decoding_method",
45+
"type": "enum",
46+
"description": "RNN-T decoding method; greedy search remains the parity-tested default.",
47+
"values": [
48+
"greedy_search",
49+
"modified_beam_search"
50+
],
51+
"required": false,
52+
"default": "greedy_search"
53+
},
54+
{
55+
"name": "num_beams",
56+
"type": "int",
57+
"description": "Maximum active hypotheses retained by modified beam search.",
58+
"required": false,
59+
"min": 1,
60+
"max": 64,
61+
"default": 4
62+
},
63+
{
64+
"name": "blank_penalty",
65+
"type": "float",
66+
"description": "Non-negative score subtracted from the RNN-T blank logit.",
67+
"required": false,
68+
"min": 0.0,
69+
"default": 0.0
70+
},
71+
{
72+
"name": "hotwords",
73+
"type": "string",
74+
"description": "Slash- or newline-separated natural-text phrases; requires modified beam search.",
75+
"required": false
76+
},
77+
{
78+
"name": "hotwords_score",
79+
"type": "float",
80+
"description": "Non-negative per-token context boost for hotword phrases.",
81+
"required": false,
82+
"min": 0.0,
83+
"default": 1.5
84+
},
85+
{
86+
"name": "enable_endpoint",
87+
"type": "bool",
88+
"description": "Enable automatic endpoint speech segments.",
89+
"required": false,
90+
"default": false
91+
},
92+
{
93+
"name": "rule1_min_trailing_silence_sec",
94+
"type": "float",
95+
"description": "Endpoint timeout in seconds even when no speech token was decoded.",
96+
"required": false,
97+
"min": 0.0,
98+
"default": 2.4
99+
},
100+
{
101+
"name": "rule2_min_trailing_silence_sec",
102+
"type": "float",
103+
"description": "Endpoint silence in seconds after a speech token was decoded.",
104+
"required": false,
105+
"min": 0.0,
106+
"default": 1.2
107+
},
108+
{
109+
"name": "rule3_min_utterance_length_sec",
110+
"type": "float",
111+
"description": "Maximum utterance duration in seconds before an endpoint.",
112+
"required": false,
113+
"min": 0.0,
114+
"default": 20.0
115+
}
116+
],
117+
"session": [],
118+
"load": []
119+
},
120+
"runtime": {
121+
"tags": [
122+
"gguf",
123+
"stream"
124+
]
125+
},
3126
"sources": [
4127
{
5128
"format": "gguf",
@@ -28,5 +151,38 @@
28151
"weights": "model:model.safetensors"
29152
}
30153
}
31-
]
154+
],
155+
"packages": [
156+
{
157+
"id": "kroko_asr_community_converted",
158+
"display_name": "Kroko Community ASR converted layout",
159+
"default": true,
160+
"format": "safetensors",
161+
"precision": "native",
162+
"target_directory": "Kroko-ASR-Community",
163+
"files": [
164+
"config.json",
165+
"model.safetensors",
166+
"tokens.txt"
167+
],
168+
"download": {
169+
"kind": "converter",
170+
"converter": "tools/community_models/convert_kroko_onnx.py",
171+
"description": "Convert a downloaded public free Kroko Community .data package into the native audio.cpp safetensors layout."
172+
}
173+
}
174+
],
175+
"dependencies": [],
176+
"ui": {
177+
"recommended_package": "kroko_asr_community_converted",
178+
"tags": [
179+
"ASR",
180+
"GGUF"
181+
],
182+
"docs": [
183+
"docs/asr.md",
184+
"docs/community_models/kroko_asr.md",
185+
"docs/gguf.md"
186+
]
187+
}
32188
}

0 commit comments

Comments
 (0)