@qvac/inference 0.19.1 → 0.20.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/NOTICE +43 -11
- package/dist/api/audio-gen.d.ts +42 -1
- package/dist/api/audio-gen.js +137 -51
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/text-to-speech.d.ts +31 -4
- package/dist/api/text-to-speech.js +117 -21
- package/dist/api/vector-index.d.ts +142 -0
- package/dist/api/vector-index.js +168 -0
- package/dist/api/world.d.ts +2 -2
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.js +21 -0
- package/dist/handlers/vector-index.d.ts +2 -0
- package/dist/handlers/vector-index.js +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/models/registry/models.d.ts +351 -12
- package/dist/models/registry/models.js +2271 -1957
- package/dist/models/registry/resource-profiles.js +135 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +2 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +65 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.d.ts +9 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.js +24 -7
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +46 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +218 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +1 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +56 -225
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +8 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +28 -0
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +248 -0
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +17 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +5 -2
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +1 -2
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.js +1 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +6 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.d.ts +1 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +0 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +1 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +3 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +9 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +96 -89
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +0 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +0 -31
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +40 -24
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +187 -123
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.d.ts +11 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.js +18 -16
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +8 -4
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +1 -2
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +1 -2
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +2 -38
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +9 -0
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +42 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +1 -1
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +1 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +1 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +1 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +8 -2
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +9 -4
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +51 -19
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +29 -0
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +66 -0
- package/dist/plugins/builtin/tts-ggml/ops/parler-options.js +10 -0
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +3 -5
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +143 -28
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +5 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +182 -66
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +267 -22
- package/dist/plugins/builtin/tts-ggml/plugin.js +94 -35
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/ops/load-model.js +22 -2
- package/dist/plugins/ops/translate.js +58 -12
- package/dist/plugins/ops/translatepsy-utils.d.ts +17 -0
- package/dist/plugins/ops/translatepsy-utils.js +32 -0
- package/dist/plugins/registry.d.ts +15 -0
- package/dist/plugins/registry.js +133 -15
- package/dist/plugins/turbovec-backend.d.ts +17 -0
- package/dist/plugins/turbovec-backend.js +99 -0
- package/dist/registry.js +4 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +46 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.js +214 -0
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.d.ts +26 -0
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.js +171 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +42 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +192 -0
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +70 -0
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +372 -0
- package/dist/runtime/env.d.ts +2 -0
- package/dist/runtime/env.js +9 -2
- package/dist/runtime/lifecycle.js +2 -0
- package/dist/runtime/model-registry.d.ts +3 -1
- package/dist/runtime/model-registry.js +2 -1
- package/dist/runtime/request-context.js +17 -0
- package/dist/runtime/vector-index-backend.d.ts +25 -0
- package/dist/runtime/vector-index-backend.js +1 -0
- package/dist/runtime/vector-index-registry.d.ts +76 -0
- package/dist/runtime/vector-index-registry.js +161 -0
- package/dist/schemas/assess-model-fit.d.ts +44 -0
- package/dist/schemas/assess-model-fit.js +40 -0
- package/dist/schemas/audio-gen.d.ts +479 -4
- package/dist/schemas/audio-gen.js +376 -17
- package/dist/schemas/batch-completion-stream.d.ts +7 -0
- package/dist/schemas/batch-completion-stream.js +5 -3
- package/dist/schemas/common.d.ts +749 -15
- package/dist/schemas/common.js +8 -1
- package/dist/schemas/completion-event.d.ts +11 -1
- package/dist/schemas/completion-event.js +3 -0
- package/dist/schemas/completion-stream.d.ts +20 -0
- package/dist/schemas/completion-stream.js +41 -4
- package/dist/schemas/config.d.ts +48 -30
- package/dist/schemas/errors.d.ts +4 -0
- package/dist/schemas/errors.js +22 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/llamacpp-config.d.ts +4 -8
- package/dist/schemas/llamacpp-config.js +4 -4
- package/dist/schemas/load-model.d.ts +2503 -139
- package/dist/schemas/model-config-schemas.d.ts +228 -5
- package/dist/schemas/plugin.d.ts +10 -0
- package/dist/schemas/sdcpp-config.d.ts +221 -4
- package/dist/schemas/sdcpp-config.js +128 -22
- package/dist/schemas/text-to-speech.d.ts +780 -19
- package/dist/schemas/text-to-speech.js +298 -44
- package/dist/schemas/transcription-config.js +7 -4
- package/dist/schemas/vector-index.d.ts +194 -0
- package/dist/schemas/vector-index.js +185 -0
- package/dist/utils/addon-responses.d.ts +29 -3
- package/dist/utils/aggregate-events.d.ts +3 -1
- package/dist/utils/aggregate-events.js +7 -1
- package/dist/utils/tts-stats.d.ts +15 -11
- package/dist/utils/tts-stats.js +33 -11
- package/package.json +28 -25
|
@@ -427,6 +427,26 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
427
427
|
engine: 'nmtcpp-translation',
|
|
428
428
|
artifactBytes: 2248
|
|
429
429
|
},
|
|
430
|
+
'166226feb6144f6e416e4936706eb5f9183526a05141410156c578c48b4bd4f1': {
|
|
431
|
+
schemaVersion: 1,
|
|
432
|
+
engine: 'llamacpp-completion',
|
|
433
|
+
artifactBytes: 3066385344,
|
|
434
|
+
ggufFacts: {
|
|
435
|
+
architecture: 'qwen35',
|
|
436
|
+
blockCount: 32,
|
|
437
|
+
headCount: 16,
|
|
438
|
+
headCountKv: 4,
|
|
439
|
+
keyLength: 256,
|
|
440
|
+
valueLength: 256,
|
|
441
|
+
embeddingLength: 2560,
|
|
442
|
+
contextLength: 262144,
|
|
443
|
+
fullAttentionInterval: 4,
|
|
444
|
+
ssmStateSize: 128,
|
|
445
|
+
ssmConvKernel: 4,
|
|
446
|
+
ssmInnerSize: 4096,
|
|
447
|
+
ssmGroupCount: 16
|
|
448
|
+
}
|
|
449
|
+
},
|
|
430
450
|
'1686f94838ace314719e945606a09a66dafd40847dd3fd352ad3f7a969aac62f': {
|
|
431
451
|
schemaVersion: 1,
|
|
432
452
|
engine: 'nmtcpp-translation',
|
|
@@ -745,6 +765,26 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
745
765
|
engine: 'nmtcpp-translation',
|
|
746
766
|
artifactBytes: 653915115
|
|
747
767
|
},
|
|
768
|
+
'296d6426b922a09c6615a81dee6e0aaae6f1f608fd2c320316f1e6ce09314aac': {
|
|
769
|
+
schemaVersion: 1,
|
|
770
|
+
engine: 'llamacpp-completion',
|
|
771
|
+
artifactBytes: 5157833664,
|
|
772
|
+
ggufFacts: {
|
|
773
|
+
architecture: 'qwen35',
|
|
774
|
+
blockCount: 32,
|
|
775
|
+
headCount: 16,
|
|
776
|
+
headCountKv: 4,
|
|
777
|
+
keyLength: 256,
|
|
778
|
+
valueLength: 256,
|
|
779
|
+
embeddingLength: 2560,
|
|
780
|
+
contextLength: 262144,
|
|
781
|
+
fullAttentionInterval: 4,
|
|
782
|
+
ssmStateSize: 128,
|
|
783
|
+
ssmConvKernel: 4,
|
|
784
|
+
ssmInnerSize: 4096,
|
|
785
|
+
ssmGroupCount: 16
|
|
786
|
+
}
|
|
787
|
+
},
|
|
748
788
|
'29940d98d42b91fbd05ce489f3ecf7c72f0a42f027e4875919a28fb4c04ea2cf': {
|
|
749
789
|
schemaVersion: 1,
|
|
750
790
|
engine: 'whispercpp-transcription',
|
|
@@ -1425,6 +1465,26 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
1425
1465
|
artifactBytes: 37014606,
|
|
1426
1466
|
assumptions: ['artifactBytes sums 4 companion-set files']
|
|
1427
1467
|
},
|
|
1468
|
+
'4af8ee1df3ec9008f763ebe95e6f21df3acd8d42c541feeb13314ca22e560afc': {
|
|
1469
|
+
schemaVersion: 1,
|
|
1470
|
+
engine: 'llamacpp-completion',
|
|
1471
|
+
artifactBytes: 672329792,
|
|
1472
|
+
ggufFacts: {
|
|
1473
|
+
architecture: 'qwen35',
|
|
1474
|
+
blockCount: 24,
|
|
1475
|
+
headCount: 8,
|
|
1476
|
+
headCountKv: 2,
|
|
1477
|
+
keyLength: 256,
|
|
1478
|
+
valueLength: 256,
|
|
1479
|
+
embeddingLength: 1024,
|
|
1480
|
+
contextLength: 262144,
|
|
1481
|
+
fullAttentionInterval: 4,
|
|
1482
|
+
ssmStateSize: 128,
|
|
1483
|
+
ssmConvKernel: 4,
|
|
1484
|
+
ssmInnerSize: 2048,
|
|
1485
|
+
ssmGroupCount: 16
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1428
1488
|
'4b0ce319e7c8f7e1836ce18cb6522c83268e8cff54f2a7f5dcef270250a44475': {
|
|
1429
1489
|
schemaVersion: 1,
|
|
1430
1490
|
engine: 'nmtcpp-translation',
|
|
@@ -2804,6 +2864,26 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
2804
2864
|
engine: 'nmtcpp-translation',
|
|
2805
2865
|
artifactBytes: 3075948
|
|
2806
2866
|
},
|
|
2867
|
+
'940436f99196c1183d0a38addbbb2c643cb5edfcb939003dacc8c4bd68079f85': {
|
|
2868
|
+
schemaVersion: 1,
|
|
2869
|
+
engine: 'llamacpp-completion',
|
|
2870
|
+
artifactBytes: 2552356928,
|
|
2871
|
+
ggufFacts: {
|
|
2872
|
+
architecture: 'qwen35',
|
|
2873
|
+
blockCount: 24,
|
|
2874
|
+
headCount: 8,
|
|
2875
|
+
headCountKv: 2,
|
|
2876
|
+
keyLength: 256,
|
|
2877
|
+
valueLength: 256,
|
|
2878
|
+
embeddingLength: 2048,
|
|
2879
|
+
contextLength: 262144,
|
|
2880
|
+
fullAttentionInterval: 4,
|
|
2881
|
+
ssmStateSize: 128,
|
|
2882
|
+
ssmConvKernel: 4,
|
|
2883
|
+
ssmInnerSize: 2048,
|
|
2884
|
+
ssmGroupCount: 16
|
|
2885
|
+
}
|
|
2886
|
+
},
|
|
2807
2887
|
'94b660f37c9c29a904b48498a7202846faaeef16f30668f356336c29cefc0f63': {
|
|
2808
2888
|
schemaVersion: 1,
|
|
2809
2889
|
engine: 'nmtcpp-translation',
|
|
@@ -3263,6 +3343,11 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
3263
3343
|
engine: 'nmtcpp-translation',
|
|
3264
3344
|
artifactBytes: 4197836
|
|
3265
3345
|
},
|
|
3346
|
+
af090772797632dcea0546985b112f86a9a10e0d87d10a2b74bd6ae57464aded: {
|
|
3347
|
+
schemaVersion: 1,
|
|
3348
|
+
engine: 'parakeet-transcription',
|
|
3349
|
+
artifactBytes: 1429807168
|
|
3350
|
+
},
|
|
3266
3351
|
af151db26e3b0a87e805d899d3f105aa0a11f9124893d47ca3f39e47b27cfa8f: {
|
|
3267
3352
|
schemaVersion: 1,
|
|
3268
3353
|
engine: 'sdcpp-generation',
|
|
@@ -3436,6 +3521,26 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
3436
3521
|
engine: 'parakeet-transcription',
|
|
3437
3522
|
artifactBytes: 1371674432
|
|
3438
3523
|
},
|
|
3524
|
+
b5056635be0c9bb832f0c964dc063bd4b4462e253f9f9d94eebf0aa0960b7798: {
|
|
3525
|
+
schemaVersion: 1,
|
|
3526
|
+
engine: 'llamacpp-completion',
|
|
3527
|
+
artifactBytes: 1082015808,
|
|
3528
|
+
ggufFacts: {
|
|
3529
|
+
architecture: 'qwen35',
|
|
3530
|
+
blockCount: 24,
|
|
3531
|
+
headCount: 8,
|
|
3532
|
+
headCountKv: 2,
|
|
3533
|
+
keyLength: 256,
|
|
3534
|
+
valueLength: 256,
|
|
3535
|
+
embeddingLength: 1024,
|
|
3536
|
+
contextLength: 262144,
|
|
3537
|
+
fullAttentionInterval: 4,
|
|
3538
|
+
ssmStateSize: 128,
|
|
3539
|
+
ssmConvKernel: 4,
|
|
3540
|
+
ssmInnerSize: 2048,
|
|
3541
|
+
ssmGroupCount: 16
|
|
3542
|
+
}
|
|
3543
|
+
},
|
|
3439
3544
|
b5310340b3a23d31655d7119d100d5df1b2d8ee17b3ca8b0a23ad7e9eb5fa705: {
|
|
3440
3545
|
schemaVersion: 1,
|
|
3441
3546
|
engine: 'llamacpp-completion',
|
|
@@ -4664,6 +4769,11 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
4664
4769
|
engine: 'nmtcpp-translation',
|
|
4665
4770
|
artifactBytes: 4724124
|
|
4666
4771
|
},
|
|
4772
|
+
f6ad1b9912c03c95b3377eaf0fc2fee635a4e4904409d8efac1944343d9f3360: {
|
|
4773
|
+
schemaVersion: 1,
|
|
4774
|
+
engine: 'parakeet-transcription',
|
|
4775
|
+
artifactBytes: 761593408
|
|
4776
|
+
},
|
|
4667
4777
|
f6b6c6d5cfa6f00d964eeb7add28eb14ce7481734d506b90681007678cd2c484: {
|
|
4668
4778
|
schemaVersion: 1,
|
|
4669
4779
|
engine: 'llamacpp-completion',
|
|
@@ -4783,6 +4893,26 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
4783
4893
|
engine: 'whispercpp-transcription',
|
|
4784
4894
|
artifactBytes: 77691730
|
|
4785
4895
|
},
|
|
4896
|
+
fc2a80532e58e0655efd9e68c5b7cb2c4373222e736bcc88de648502a4e30361: {
|
|
4897
|
+
schemaVersion: 1,
|
|
4898
|
+
engine: 'llamacpp-completion',
|
|
4899
|
+
artifactBytes: 1560461376,
|
|
4900
|
+
ggufFacts: {
|
|
4901
|
+
architecture: 'qwen35',
|
|
4902
|
+
blockCount: 24,
|
|
4903
|
+
headCount: 8,
|
|
4904
|
+
headCountKv: 2,
|
|
4905
|
+
keyLength: 256,
|
|
4906
|
+
valueLength: 256,
|
|
4907
|
+
embeddingLength: 2048,
|
|
4908
|
+
contextLength: 262144,
|
|
4909
|
+
fullAttentionInterval: 4,
|
|
4910
|
+
ssmStateSize: 128,
|
|
4911
|
+
ssmConvKernel: 4,
|
|
4912
|
+
ssmInnerSize: 2048,
|
|
4913
|
+
ssmGroupCount: 16
|
|
4914
|
+
}
|
|
4915
|
+
},
|
|
4786
4916
|
fc70a6c6eed7d2f82ed48cbd52cc7118b249eff8b91112ef9cbfca6813a1eefa: {
|
|
4787
4917
|
schemaVersion: 1,
|
|
4788
4918
|
engine: 'llamacpp-completion',
|
|
@@ -4858,6 +4988,11 @@ export const MODEL_RESOURCE_PROFILES = {
|
|
|
4858
4988
|
ssmGroupCount: 16
|
|
4859
4989
|
}
|
|
4860
4990
|
},
|
|
4991
|
+
fee699b3257ce0cfd249f490ab9f9791d9e0f6f8781e4354db2aa5584e594c82: {
|
|
4992
|
+
schemaVersion: 1,
|
|
4993
|
+
engine: 'parakeet-transcription',
|
|
4994
|
+
artifactBytes: 405212736
|
|
4995
|
+
},
|
|
4861
4996
|
fefd91bc5551877762cd0d0cbe583080f8e636d5aa65a9a5f42b369654df778b: {
|
|
4862
4997
|
schemaVersion: 1,
|
|
4863
4998
|
engine: 'llamacpp-completion',
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { RepaintMode } from '@qvac/audiogen-ggml';
|
|
2
|
+
import { AUDIOGEN_INPUT_CHANNELS, AUDIOGEN_INPUT_SAMPLE_RATE } from '../../../../schemas/audio-gen.js';
|
|
3
|
+
import { resolveAudioGenPcm } from './audio-gen-input.js';
|
|
4
|
+
import { streamAudioGenRun } from './audio-gen-run.js';
|
|
5
|
+
// The wire vocabulary is the addon's own enum values; the map keeps the
|
|
6
|
+
// string-enum typing honest instead of casting across the boundary.
|
|
7
|
+
const REPAINT_MODES = {
|
|
8
|
+
conservative: RepaintMode.Conservative,
|
|
9
|
+
balanced: RepaintMode.Balanced,
|
|
10
|
+
aggressive: RepaintMode.Aggressive
|
|
11
|
+
};
|
|
12
|
+
export function audioEditStream(request) {
|
|
13
|
+
return streamAudioGenRun({
|
|
14
|
+
type: 'audioEditStream',
|
|
15
|
+
request,
|
|
16
|
+
async start(model, ctx) {
|
|
17
|
+
// The source is decoded before the run is admitted so the model slot is
|
|
18
|
+
// never held by a request that fails on input decoding. Editing is the
|
|
19
|
+
// one path where the addon demands normalized samples, so the resolver
|
|
20
|
+
// settles `[-1, 1]` here for raw and decoded input alike.
|
|
21
|
+
const pcm = await resolveAudioGenPcm(request.sourceAudio, 'sourceAudio', {
|
|
22
|
+
requireNormalized: true
|
|
23
|
+
});
|
|
24
|
+
if (ctx.signal.aborted)
|
|
25
|
+
return undefined;
|
|
26
|
+
// The addon validates each operation as it is chained (Flow-Edit on a
|
|
27
|
+
// turbo DiT, repaint ranges inside the source, ...); those throws
|
|
28
|
+
// surface as the request's error before any native work starts.
|
|
29
|
+
const session = model.edit({
|
|
30
|
+
pcm,
|
|
31
|
+
sampleRate: AUDIOGEN_INPUT_SAMPLE_RATE,
|
|
32
|
+
channels: AUDIOGEN_INPUT_CHANNELS
|
|
33
|
+
});
|
|
34
|
+
for (const operation of request.operations)
|
|
35
|
+
appendOperation(session, operation);
|
|
36
|
+
return session.run({ ...(request.seed !== undefined && { seed: request.seed }) });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function appendOperation(session, operation) {
|
|
41
|
+
if (operation.type === 'flow-edit') {
|
|
42
|
+
session.flowEdit({
|
|
43
|
+
from: {
|
|
44
|
+
caption: operation.from.caption,
|
|
45
|
+
...(operation.from.lyrics !== undefined && { lyrics: operation.from.lyrics })
|
|
46
|
+
},
|
|
47
|
+
to: {
|
|
48
|
+
caption: operation.to.caption,
|
|
49
|
+
...(operation.to.lyrics !== undefined && { lyrics: operation.to.lyrics })
|
|
50
|
+
},
|
|
51
|
+
...(operation.nMin !== undefined && { nMin: operation.nMin }),
|
|
52
|
+
...(operation.nMax !== undefined && { nMax: operation.nMax }),
|
|
53
|
+
...(operation.nAvg !== undefined && { nAvg: operation.nAvg })
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
session.repaint({
|
|
58
|
+
caption: operation.caption,
|
|
59
|
+
...(operation.lyrics !== undefined && { lyrics: operation.lyrics }),
|
|
60
|
+
start: operation.start,
|
|
61
|
+
...(operation.end !== undefined && { end: operation.end }),
|
|
62
|
+
...(operation.mode !== undefined && { mode: REPAINT_MODES[operation.mode] }),
|
|
63
|
+
...(operation.strength !== undefined && { strength: operation.strength })
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -15,5 +15,13 @@ export type AudioGenAudioInputName = 'referenceAudio' | 'sourceAudio';
|
|
|
15
15
|
* Every path is bounded by `AUDIOGEN_INPUT_MAX_SECONDS` and rejects
|
|
16
16
|
* non-finite samples, so malformed or oversized input fails with
|
|
17
17
|
* `InvalidAudioInputError` before the engine is invoked.
|
|
18
|
+
*
|
|
19
|
+
* `requireNormalized` additionally holds samples to `[-1, 1]`. Only the edit
|
|
20
|
+
* path needs it — the addon vets an edit source with `requireNormalizedPcm`
|
|
21
|
+
* and everything else with `requireFinitePcm`, which takes any finite sample.
|
|
22
|
+
* It applies to decoded files as much as to raw PCM: decoding does not
|
|
23
|
+
* normalize, so a loud source comes back above 1.0 either way.
|
|
18
24
|
*/
|
|
19
|
-
export declare function resolveAudioGenPcm(input: AudioGenAudioInput, name: AudioGenAudioInputName
|
|
25
|
+
export declare function resolveAudioGenPcm(input: AudioGenAudioInput, name: AudioGenAudioInputName, { requireNormalized }?: {
|
|
26
|
+
requireNormalized?: boolean;
|
|
27
|
+
}): Promise<Float32Array>;
|
|
@@ -23,18 +23,24 @@ const MAX_DECODED_MONO_BYTES = AUDIOGEN_INPUT_MAX_SECONDS * AUDIOGEN_INPUT_SAMPL
|
|
|
23
23
|
* Every path is bounded by `AUDIOGEN_INPUT_MAX_SECONDS` and rejects
|
|
24
24
|
* non-finite samples, so malformed or oversized input fails with
|
|
25
25
|
* `InvalidAudioInputError` before the engine is invoked.
|
|
26
|
+
*
|
|
27
|
+
* `requireNormalized` additionally holds samples to `[-1, 1]`. Only the edit
|
|
28
|
+
* path needs it — the addon vets an edit source with `requireNormalizedPcm`
|
|
29
|
+
* and everything else with `requireFinitePcm`, which takes any finite sample.
|
|
30
|
+
* It applies to decoded files as much as to raw PCM: decoding does not
|
|
31
|
+
* normalize, so a loud source comes back above 1.0 either way.
|
|
26
32
|
*/
|
|
27
|
-
export async function resolveAudioGenPcm(input, name) {
|
|
33
|
+
export async function resolveAudioGenPcm(input, name, { requireNormalized = false } = {}) {
|
|
28
34
|
switch (input.type) {
|
|
29
35
|
case 'base64':
|
|
30
|
-
return toStereoFloat32(Buffer.from(input.value, 'base64'), name);
|
|
36
|
+
return toStereoFloat32(Buffer.from(input.value, 'base64'), name, requireNormalized);
|
|
31
37
|
case 'filePath': {
|
|
32
38
|
const filePath = input.value;
|
|
33
39
|
if (!needsDecoding(filePath)) {
|
|
34
|
-
return toStereoFloat32(await readRawPcmFile(filePath, name), name);
|
|
40
|
+
return toStereoFloat32(await readRawPcmFile(filePath, name), name, requireNormalized);
|
|
35
41
|
}
|
|
36
42
|
await assertDecodableFileSize(filePath, name);
|
|
37
|
-
return monoToStereo(await decodeMonoFloat32(filePath, name), name);
|
|
43
|
+
return monoToStereo(await decodeMonoFloat32(filePath, name), name, requireNormalized);
|
|
38
44
|
}
|
|
39
45
|
default:
|
|
40
46
|
throw new InvalidAudioInputError(`${name} must be a file path or raw PCM bytes`);
|
|
@@ -103,7 +109,7 @@ async function decodeMonoFloat32(filePath, name) {
|
|
|
103
109
|
}
|
|
104
110
|
return asFloat32(chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, total));
|
|
105
111
|
}
|
|
106
|
-
function monoToStereo(mono, name) {
|
|
112
|
+
function monoToStereo(mono, name, requireNormalized) {
|
|
107
113
|
if (mono.length === 0) {
|
|
108
114
|
throw new InvalidAudioInputError(`${name} decoded to no usable audio`);
|
|
109
115
|
}
|
|
@@ -112,21 +118,29 @@ function monoToStereo(mono, name) {
|
|
|
112
118
|
const sample = mono[frame];
|
|
113
119
|
if (!Number.isFinite(sample))
|
|
114
120
|
throw nonFiniteError(name);
|
|
121
|
+
if (requireNormalized && (sample < -1 || sample > 1))
|
|
122
|
+
throw outOfRangeError(name, sample);
|
|
115
123
|
stereo[frame * AUDIOGEN_INPUT_CHANNELS] = sample;
|
|
116
124
|
stereo[frame * AUDIOGEN_INPUT_CHANNELS + 1] = sample;
|
|
117
125
|
}
|
|
118
126
|
return stereo;
|
|
119
127
|
}
|
|
120
|
-
function toStereoFloat32(bytes, name) {
|
|
128
|
+
function toStereoFloat32(bytes, name, requireNormalized) {
|
|
121
129
|
if (bytes.byteLength === 0 || bytes.byteLength % STEREO_FRAME_BYTES !== 0) {
|
|
122
130
|
throw new InvalidAudioInputError(`${name} must be non-empty interleaved stereo ${AUDIOGEN_INPUT_SAMPLE_RATE} Hz Float32 PCM ` +
|
|
123
131
|
`(byte length a multiple of ${STEREO_FRAME_BYTES}, got ${bytes.byteLength})`);
|
|
124
132
|
}
|
|
125
133
|
assertWithinLimit(bytes.byteLength, MAX_STEREO_BYTES, STEREO_FRAME_BYTES, name);
|
|
126
134
|
const pcm = asFloat32(bytes);
|
|
135
|
+
// One pass settles every sample-level invariant this input needs: at the
|
|
136
|
+
// documented 600 s cap a second walk would be tens of millions of extra
|
|
137
|
+
// comparisons.
|
|
127
138
|
for (let index = 0; index < pcm.length; index++) {
|
|
128
|
-
|
|
139
|
+
const sample = pcm[index];
|
|
140
|
+
if (!Number.isFinite(sample))
|
|
129
141
|
throw nonFiniteError(name);
|
|
142
|
+
if (requireNormalized && (sample < -1 || sample > 1))
|
|
143
|
+
throw outOfRangeError(name, sample);
|
|
130
144
|
}
|
|
131
145
|
return pcm;
|
|
132
146
|
}
|
|
@@ -151,3 +165,6 @@ function assertWithinLimit(bytes, limit, frameBytes, name, filePath) {
|
|
|
151
165
|
function nonFiniteError(name) {
|
|
152
166
|
return new InvalidAudioInputError(`${name} must contain only finite samples`);
|
|
153
167
|
}
|
|
168
|
+
function outOfRangeError(name, sample) {
|
|
169
|
+
return new InvalidAudioInputError(`${name} must contain samples in [-1, 1] (got ${sample})`);
|
|
170
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AudioGen } from '@qvac/audiogen-ggml';
|
|
2
|
+
import { type AudioGenStreamResponse, type AudioUnderstandResponse } from '../../../../schemas/audio-gen.js';
|
|
3
|
+
import { type Logger } from '../../../../logging/index.js';
|
|
4
|
+
import { type RequestContext } from '../../../../runtime/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Wire types that stream an AudioGen run: generation, source-driven editing,
|
|
7
|
+
* and the reverse pipeline behind `audioUnderstand()`.
|
|
8
|
+
*/
|
|
9
|
+
export type AudioGenRunType = 'audioGenStream' | 'audioEditStream' | 'audioUnderstand';
|
|
10
|
+
/**
|
|
11
|
+
* A stream frame for `TType`. Generation and editing share every field but
|
|
12
|
+
* `type`; understanding carries a description instead of PCM.
|
|
13
|
+
*
|
|
14
|
+
* The frames below are built as object literals inside a generic function, so
|
|
15
|
+
* TypeScript cannot match them to the narrowed conditional type on its own —
|
|
16
|
+
* each `yield` asserts the frame it just built. The shapes are pinned at the
|
|
17
|
+
* boundary regardless: every frame is parsed against this handler's response
|
|
18
|
+
* schema before it reaches a caller.
|
|
19
|
+
*/
|
|
20
|
+
export type AudioGenRunFrame<TType extends AudioGenRunType> = TType extends 'audioUnderstand' ? AudioUnderstandResponse : Omit<AudioGenStreamResponse, 'type'> & {
|
|
21
|
+
type: TType;
|
|
22
|
+
};
|
|
23
|
+
export type AudioGenRunResponse = Awaited<ReturnType<AudioGen['run']>>;
|
|
24
|
+
export interface AudioGenRunOptions<TType extends AudioGenRunType> {
|
|
25
|
+
type: TType;
|
|
26
|
+
request: {
|
|
27
|
+
modelId: string;
|
|
28
|
+
requestId?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Prepares the inputs and admits the native job once the request holds the
|
|
32
|
+
* model slot. Preparation (decoding audio) can take real time, so the
|
|
33
|
+
* callback must re-check `ctx.signal` after it and return `undefined`
|
|
34
|
+
* without starting the job when an abort fired mid-way: that abort found no
|
|
35
|
+
* active native job to cancel, and starting the run afterwards would leave
|
|
36
|
+
* a ghost generation on the slot.
|
|
37
|
+
*/
|
|
38
|
+
start: (model: AudioGen, ctx: RequestContext, logger: Logger) => Promise<AudioGenRunResponse | undefined>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Runs one AudioGen job under the request registry and streams it as
|
|
42
|
+
* `TType` frames: progress ticks, PCM chunks, then the terminal frame with
|
|
43
|
+
* stats and backend diagnostics. Owns admission (`kind: 'audiogen'`, one
|
|
44
|
+
* active job per model), abort-to-cancel wiring, and the cancelled terminal.
|
|
45
|
+
*/
|
|
46
|
+
export declare function streamAudioGenRun<TType extends AudioGenRunType>(options: AudioGenRunOptions<TType>): AsyncGenerator<AudioGenRunFrame<TType>>;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { AudioGen, audiogenBackendName, audiogenGpuFallbackReason } from '@qvac/audiogen-ggml';
|
|
54
|
+
import { z } from 'zod';
|
|
55
|
+
import { audioGenStatsSchema } from '../../../../schemas/audio-gen.js';
|
|
56
|
+
import { graphicsDriverSchema } from '../../../../schemas/index.js';
|
|
57
|
+
import { getEngineLogger } from '../../../../logging/index.js';
|
|
58
|
+
import { attachBackendDiagnostics } from '../../../../profiling/backend-diagnostics.js';
|
|
59
|
+
import { getModel } from '../../../../runtime/model-registry.js';
|
|
60
|
+
import { getRequestRegistry, withRequestContext } from '../../../../runtime/index.js';
|
|
61
|
+
import { generateRequestId } from '../../../../runtime/request-id.js';
|
|
62
|
+
import { ModelOperationNotSupportedError } from '../../../../errors/index.js';
|
|
63
|
+
/**
|
|
64
|
+
* Runs one AudioGen job under the request registry and streams it as
|
|
65
|
+
* `TType` frames: progress ticks, PCM chunks, then the terminal frame with
|
|
66
|
+
* stats and backend diagnostics. Owns admission (`kind: 'audiogen'`, one
|
|
67
|
+
* active job per model), abort-to-cancel wiring, and the cancelled terminal.
|
|
68
|
+
*/
|
|
69
|
+
export async function* streamAudioGenRun(options) {
|
|
70
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
71
|
+
try {
|
|
72
|
+
const { type, request } = options;
|
|
73
|
+
const ctx = __addDisposableResource(env_1, await getRequestRegistry().begin({
|
|
74
|
+
requestId: request.requestId ?? generateRequestId(),
|
|
75
|
+
kind: 'audiogen',
|
|
76
|
+
modelId: request.modelId
|
|
77
|
+
}), true);
|
|
78
|
+
const logger = withRequestContext(getEngineLogger(), ctx);
|
|
79
|
+
const candidate = getModel(request.modelId);
|
|
80
|
+
if (!(candidate instanceof AudioGen)) {
|
|
81
|
+
throw new ModelOperationNotSupportedError(request.modelId, 'audiogen-ggml', type, [], []);
|
|
82
|
+
}
|
|
83
|
+
const model = candidate;
|
|
84
|
+
// A queued request can resume from begin() already aborted. It never owned
|
|
85
|
+
// the model slot, so calling the model-scoped cancel here would interrupt
|
|
86
|
+
// the earlier same-model generation that still owns it.
|
|
87
|
+
if (ctx.signal.aborted) {
|
|
88
|
+
yield { type, done: true, stopReason: 'cancelled' };
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
let cancelPromise;
|
|
92
|
+
const onAbort = () => {
|
|
93
|
+
cancelPromise ??= model.cancel().catch((error) => {
|
|
94
|
+
logger.warn(`[cancel] model.cancel() rejected during abort for modelId=${request.modelId}: ${error instanceof Error ? error.message : String(error)}`);
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
ctx.signal.addEventListener('abort', onAbort, { once: true });
|
|
98
|
+
if (ctx.signal.aborted)
|
|
99
|
+
onAbort();
|
|
100
|
+
ctx.scope.defer(async () => {
|
|
101
|
+
ctx.signal.removeEventListener('abort', onAbort);
|
|
102
|
+
await cancelPromise;
|
|
103
|
+
});
|
|
104
|
+
let response;
|
|
105
|
+
let streamedUnderstand;
|
|
106
|
+
try {
|
|
107
|
+
response = await options.start(model, ctx, logger);
|
|
108
|
+
if (response !== undefined) {
|
|
109
|
+
for await (const chunk of response.iterate()) {
|
|
110
|
+
if (ctx.signal.aborted)
|
|
111
|
+
break;
|
|
112
|
+
if ('progress' in chunk) {
|
|
113
|
+
yield { type, progress: chunk.progress, done: false };
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
// `understand()` reports a description instead of audio; generation
|
|
117
|
+
// and editing never produce this item.
|
|
118
|
+
if ('understand' in chunk) {
|
|
119
|
+
// The engine repeats this result on the terminal stats, so the
|
|
120
|
+
// converted form is kept rather than rebuilt from the raw codes.
|
|
121
|
+
streamedUnderstand = toUnderstandResult(chunk.understand);
|
|
122
|
+
yield {
|
|
123
|
+
type,
|
|
124
|
+
understand: streamedUnderstand,
|
|
125
|
+
done: false
|
|
126
|
+
};
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (!('outputArray' in chunk))
|
|
130
|
+
continue;
|
|
131
|
+
const pcm = new Uint8Array(chunk.outputArray.buffer, chunk.outputArray.byteOffset, chunk.outputArray.byteLength);
|
|
132
|
+
yield {
|
|
133
|
+
type,
|
|
134
|
+
data: Buffer.from(pcm).toString('base64'),
|
|
135
|
+
sampleRate: chunk.sampleRate,
|
|
136
|
+
channels: chunk.channels,
|
|
137
|
+
bitsPerSample: Int16Array.BYTES_PER_ELEMENT * 8,
|
|
138
|
+
done: false
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (!ctx.signal.aborted)
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
if (ctx.signal.aborted || response === undefined) {
|
|
148
|
+
yield { type, done: true, stopReason: 'cancelled' };
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const raw = await response.await();
|
|
152
|
+
// `understand.audioCodes` arrives as an Int32Array, which the wire schema —
|
|
153
|
+
// and anything downstream of JSON — needs as a plain array of integers.
|
|
154
|
+
// Both parses below read the normalized object: handing the raw one to
|
|
155
|
+
// either schema fails its `z.array` check on the typed array.
|
|
156
|
+
const normalized = raw.understand
|
|
157
|
+
? { ...raw, understand: streamedUnderstand ?? toUnderstandResult(raw.understand) }
|
|
158
|
+
: raw;
|
|
159
|
+
const stats = audioGenStatsSchema.parse(normalized);
|
|
160
|
+
const diagnostics = buildBackendDiagnostics(audiogenStats.parse(normalized));
|
|
161
|
+
const terminal = {
|
|
162
|
+
type,
|
|
163
|
+
done: true,
|
|
164
|
+
stopReason: 'completed',
|
|
165
|
+
stats,
|
|
166
|
+
...(diagnostics && { diagnostics })
|
|
167
|
+
};
|
|
168
|
+
yield diagnostics ? attachBackendDiagnostics(terminal, diagnostics) : terminal;
|
|
169
|
+
}
|
|
170
|
+
catch (e_1) {
|
|
171
|
+
env_1.error = e_1;
|
|
172
|
+
env_1.hasError = true;
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
const result_1 = __disposeResources(env_1);
|
|
176
|
+
if (result_1)
|
|
177
|
+
await result_1;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// The addon reports gpuFallbackReason, which the wire shape deliberately does
|
|
181
|
+
// not carry: it reaches callers named, on diagnostics.fallback.reason.
|
|
182
|
+
const audiogenStats = audioGenStatsSchema.extend({
|
|
183
|
+
gpuFallbackReason: z.number().optional()
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* Normalizes the addon's understand result for the wire: `audioCodes` arrives
|
|
187
|
+
* as an `Int32Array`, which neither the schema nor a JSON transport accepts.
|
|
188
|
+
*/
|
|
189
|
+
function toUnderstandResult(result) {
|
|
190
|
+
return { ...result, audioCodes: Array.from(result.audioCodes) };
|
|
191
|
+
}
|
|
192
|
+
/** An unrecognized GPU id yields no diagnostics rather than a guessed backend name. */
|
|
193
|
+
function buildBackendDiagnostics(stats) {
|
|
194
|
+
if (stats.backendDevice === undefined)
|
|
195
|
+
return undefined;
|
|
196
|
+
if (stats.backendDevice !== 1) {
|
|
197
|
+
const fallback = gpuFallbackDetail(stats);
|
|
198
|
+
return { selectedBackend: 'cpu', selectedDevice: 'cpu', ...(fallback && { fallback }) };
|
|
199
|
+
}
|
|
200
|
+
// A 'cpu' name against backendDevice 1 is the addon contradicting itself.
|
|
201
|
+
const selectedBackend = audiogenBackendName(stats.backendId);
|
|
202
|
+
if (selectedBackend === undefined || selectedBackend === 'cpu')
|
|
203
|
+
return undefined;
|
|
204
|
+
const graphicsApi = graphicsDriverSchema.safeParse(selectedBackend);
|
|
205
|
+
return {
|
|
206
|
+
selectedBackend,
|
|
207
|
+
selectedDevice: 'gpu',
|
|
208
|
+
...(graphicsApi.success && { graphicsApi: graphicsApi.data })
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// `none` and `not-requested` describe a run that never lost a GPU, and an
|
|
212
|
+
// unmapped code must not become a guessed reason.
|
|
213
|
+
function gpuFallbackDetail(stats) {
|
|
214
|
+
const reason = audiogenGpuFallbackReason(stats.gpuFallbackReason);
|
|
215
|
+
if (reason === undefined || reason === 'none' || reason === 'not-requested')
|
|
216
|
+
return undefined;
|
|
217
|
+
return { requestedDevice: 'gpu', reason };
|
|
218
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AudioGenStreamRequest, AudioGenStreamResponse } from '../../../../schemas/audio-gen.js';
|
|
2
2
|
export declare function audioGenStream(request: AudioGenStreamRequest): AsyncGenerator<AudioGenStreamResponse>;
|