api: derived codec left context, chunk width hoisted to qt_init
The left context of the buffered chunked decode is no longer a caller knob: it derives from the codec's own sliding window (2x144 frames), placing the default decode at the residual floor of the split. codec_chunk_sec moves from qt_tts_params to qt_init_params, resolved once to frames at load. The mid-struct removal bumps the ABI to a closed range [QT_ABI_MIN_VERSION, QT_ABI_VERSION] = [4, 4]; the probe asserts both bounds reject through the range check.
This commit is contained in:
+29
-3
@@ -68,12 +68,15 @@ int main(void) {
|
||||
qt_tts_default_params(¶ms);
|
||||
|
||||
/* Sanity-check a few default values, including the abi_version and
|
||||
* the new use_fa / clamp_fp16 / on_chunk / codec_chunk_sec /
|
||||
* codec_left_context_sec slots. */
|
||||
if (params.max_new_tokens != 2048 || params.codec_chunk_sec <= 0.0f || params.codec_left_context_sec < 0.0f) {
|
||||
* the use_fa / clamp_fp16 / on_chunk / codec framing slots. */
|
||||
if (params.max_new_tokens != 2048) {
|
||||
fprintf(stderr, "[Probe] default values do not match\n");
|
||||
return 1;
|
||||
}
|
||||
if (iparams.codec_chunk_sec <= 0.0f || iparams.max_batch != 1) {
|
||||
fprintf(stderr, "[Probe] init_params chunk / max_batch defaults do not match\n");
|
||||
return 1;
|
||||
}
|
||||
if (iparams.abi_version != QT_ABI_VERSION || params.abi_version != QT_ABI_VERSION) {
|
||||
fprintf(stderr, "[Probe] abi_version not set by qt_*_default_params\n");
|
||||
return 1;
|
||||
@@ -148,6 +151,29 @@ int main(void) {
|
||||
qt_free(rejected);
|
||||
return 8;
|
||||
}
|
||||
/* The paths point at a file that does not exist, so a NULL return
|
||||
* alone does not prove the ABI gate fired : the error string must
|
||||
* name the range check, not a failed GGUF open. */
|
||||
if (strstr(qt_last_error(), "supported range") == NULL) {
|
||||
fprintf(stderr, "[Probe] future abi_version rejection did not come from the range check: '%s'\n",
|
||||
qt_last_error());
|
||||
return 8;
|
||||
}
|
||||
|
||||
/* The floor is the other half of the range check : a struct laid out
|
||||
* by a pre-QT_ABI_MIN_VERSION header must be rejected just as hard. */
|
||||
future_iparams.abi_version = QT_ABI_MIN_VERSION - 1;
|
||||
rejected = qt_init(&future_iparams);
|
||||
if (rejected != NULL) {
|
||||
fprintf(stderr, "[Probe] qt_init accepted an abi_version below the floor\n");
|
||||
qt_free(rejected);
|
||||
return 8;
|
||||
}
|
||||
if (strstr(qt_last_error(), "supported range") == NULL) {
|
||||
fprintf(stderr, "[Probe] floor abi_version rejection did not come from the range check: '%s'\n",
|
||||
qt_last_error());
|
||||
return 8;
|
||||
}
|
||||
|
||||
enum qt_status rc = qt_synthesize(NULL, ¶ms, &audio);
|
||||
if (rc != QT_STATUS_INVALID_PARAMS) {
|
||||
|
||||
Reference in New Issue
Block a user