@qvac/sdk 0.11.0 → 0.12.1
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 +1423 -43
- package/README.md +2 -0
- package/dist/client/api/classify.d.ts +23 -0
- package/dist/client/api/classify.js +43 -0
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/index.d.ts +4 -0
- package/dist/client/api/index.js +4 -0
- package/dist/client/api/load-model.js +24 -1
- package/dist/client/api/transcribe.d.ts +3 -0
- package/dist/client/api/transcribe.js +13 -2
- package/dist/client/api/video.d.ts +64 -0
- package/dist/client/api/video.js +147 -0
- package/dist/client/api/vla-helpers.d.ts +45 -0
- package/dist/client/api/vla-helpers.js +130 -0
- package/dist/client/api/vla.d.ts +65 -0
- package/dist/client/api/vla.js +109 -0
- package/dist/client/config-loader/resolve-config.node.d.ts +16 -0
- package/dist/client/config-loader/resolve-config.node.js +77 -23
- package/dist/client/plugins-factory.d.ts +8 -0
- package/dist/client/plugins-factory.js +10 -0
- package/dist/client/rpc/bare-client.d.ts +1 -0
- package/dist/client/rpc/bare-client.js +66 -66
- package/dist/client/rpc/ensure-worker-ready.d.ts +9 -0
- package/dist/client/rpc/ensure-worker-ready.js +17 -0
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -0
- package/dist/client/rpc/expo-rpc-client.js +4 -0
- package/dist/client/rpc/node-rpc-client.d.ts +1 -0
- package/dist/client/rpc/node-rpc-client.js +97 -5
- package/dist/client/rpc/rpc-client.js +115 -8
- package/dist/client/rpc/rpc-error.js +14 -1
- package/dist/commands/bundle/bare-pack.d.ts +13 -0
- package/dist/commands/bundle/bare-pack.js +54 -0
- package/dist/commands/bundle/constants.d.ts +7 -0
- package/dist/commands/bundle/constants.js +23 -0
- package/dist/commands/bundle/entry-gen.d.ts +2 -0
- package/dist/commands/bundle/entry-gen.js +48 -0
- package/dist/commands/bundle/index.d.ts +20 -0
- package/dist/commands/bundle/index.js +141 -0
- package/dist/commands/bundle/manifest.d.ts +21 -0
- package/dist/commands/bundle/manifest.js +193 -0
- package/dist/commands/bundle/plugins.d.ts +9 -0
- package/dist/commands/bundle/plugins.js +51 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/verify/abi.d.ts +52 -0
- package/dist/commands/verify/abi.js +125 -0
- package/dist/commands/verify/addon-source.d.ts +43 -0
- package/dist/commands/verify/addon-source.js +75 -0
- package/dist/commands/verify/bundle-source.d.ts +12 -0
- package/dist/commands/verify/bundle-source.js +53 -0
- package/dist/commands/verify/index.d.ts +59 -0
- package/dist/commands/verify/index.js +371 -0
- package/dist/commands/verify/node-modules-source.d.ts +11 -0
- package/dist/commands/verify/node-modules-source.js +76 -0
- package/dist/commands/verify/prebuilds.d.ts +15 -0
- package/dist/commands/verify/prebuilds.js +39 -0
- package/dist/examples/classification/classify-image.d.ts +2 -0
- package/dist/examples/classification/classify-image.js +23 -0
- package/dist/examples/diffusion-txt2vid.d.ts +2 -0
- package/dist/examples/diffusion-txt2vid.js +81 -0
- package/dist/examples/plugins.js +3 -7
- package/dist/examples/tools/llamacpp-tools-gemma4.js +2 -5
- package/dist/examples/tools/llamacpp-tools-qwen35.js +2 -3
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +18 -12
- package/dist/examples/transcription/parakeet-microphone-record.js +7 -12
- package/dist/examples/transcription/parakeet-microphone-stream.d.ts +2 -0
- package/dist/examples/transcription/parakeet-microphone-stream.js +79 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.d.ts +2 -0
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +121 -0
- package/dist/examples/transcription/parakeet-sortformer.js +58 -55
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +18 -15
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +6 -1
- package/dist/examples/tts/chatterbox.js +7 -16
- package/dist/examples/tts/llm-to-tts-streaming.js +3 -10
- package/dist/examples/tts/supertonic-multilingual.js +4 -12
- package/dist/examples/tts/supertonic.js +5 -12
- package/dist/examples/vla-smolvla.d.ts +2 -0
- package/dist/examples/vla-smolvla.js +75 -0
- package/dist/examples/voice-assistant/voice-assistant.js +3 -10
- package/dist/expo/plugins/find-in-ancestor-node-modules.d.ts +14 -0
- package/dist/expo/plugins/find-in-ancestor-node-modules.js +24 -0
- package/dist/expo/plugins/get-project-root.d.ts +22 -0
- package/dist/expo/plugins/get-project-root.js +23 -0
- package/dist/expo/plugins/index.d.ts +4 -0
- package/dist/expo/plugins/index.js +4 -0
- package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +9 -2
- package/dist/expo/plugins/resolve-sdk-package-dir.js +38 -11
- package/dist/expo/plugins/withDeviceInfo.js +2 -1
- package/dist/expo/plugins/withMobileBundle.d.ts +2 -17
- package/dist/expo/plugins/withMobileBundle.js +31 -85
- package/dist/index.d.ts +5 -3
- package/dist/index.js +9 -3
- package/dist/models/registry/models.d.ts +3711 -368
- package/dist/models/registry/models.js +7066 -3562
- package/dist/models/update-models/naming.js +22 -8
- package/dist/pear/pre.js +6 -2
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/classification.d.ts +53 -0
- package/dist/schemas/classification.js +33 -0
- package/dist/schemas/common.d.ts +1001 -1739
- package/dist/schemas/common.js +6 -1
- package/dist/schemas/completion-event.d.ts +3 -0
- package/dist/schemas/completion-event.js +1 -0
- package/dist/schemas/completion-stream.d.ts +1 -0
- package/dist/schemas/download-asset.d.ts +13 -3
- package/dist/schemas/engine-addon-map.d.ts +3 -0
- package/dist/schemas/engine-addon-map.js +18 -5
- package/dist/schemas/get-model-info.d.ts +4 -0
- package/dist/schemas/get-model-info.js +2 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/llamacpp-config.d.ts +12 -2
- package/dist/schemas/load-model.d.ts +6152 -10764
- package/dist/schemas/load-model.js +75 -7
- package/dist/schemas/model-src-utils.d.ts +22 -2
- package/dist/schemas/model-types.d.ts +46 -6
- package/dist/schemas/model-types.js +28 -5
- package/dist/schemas/ocr.d.ts +5 -0
- package/dist/schemas/plugin.d.ts +20 -5
- package/dist/schemas/plugin.js +21 -4
- package/dist/schemas/registry.d.ts +44 -0
- package/dist/schemas/registry.js +5 -0
- package/dist/schemas/reload-config.d.ts +22 -2
- package/dist/schemas/sdcpp-config.d.ts +316 -1
- package/dist/schemas/sdcpp-config.js +232 -33
- package/dist/schemas/sdk-config.d.ts +654 -1324
- package/dist/schemas/sdk-config.js +16 -1
- package/dist/schemas/sdk-errors-client.d.ts +7 -0
- package/dist/schemas/sdk-errors-client.js +36 -1
- package/dist/schemas/sdk-errors-server.d.ts +3 -1
- package/dist/schemas/sdk-errors-server.js +20 -5
- package/dist/schemas/text-to-speech.d.ts +79 -696
- package/dist/schemas/text-to-speech.js +46 -19
- package/dist/schemas/transcription-config.d.ts +37 -226
- package/dist/schemas/transcription-config.js +76 -15
- package/dist/schemas/transcription.d.ts +63 -11
- package/dist/schemas/transcription.js +56 -2
- package/dist/schemas/translation-config.d.ts +60 -10
- package/dist/schemas/vla.d.ts +87 -0
- package/dist/schemas/vla.js +108 -0
- package/dist/scripts/run-unit-tests.js +8 -2
- package/dist/server/bare/ops/transcribe.d.ts +2 -1
- package/dist/server/bare/ops/transcribe.js +59 -34
- package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +6 -0
- package/dist/server/bare/plugins/ggml-classification/ops/classify.js +30 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +32 -0
- package/dist/server/bare/plugins/ggml-classification/plugin.js +55 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +12 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +3 -0
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +75 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +54 -0
- package/dist/server/bare/plugins/ggml-vla/plugin.js +57 -0
- package/dist/server/bare/plugins/index.d.ts +3 -1
- package/dist/server/bare/plugins/index.js +3 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +3 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.d.ts +29 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +65 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +6 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +26 -0
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +25 -0
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +5 -0
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +67 -246
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +66 -97
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +3 -0
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +199 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +200 -2
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +61 -8
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.js +2 -15
- package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.js +2 -1
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +75 -0
- package/dist/server/bare/plugins/tts-ggml/plugin.js +189 -0
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +29 -4
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +12 -1
- package/dist/server/bare/registry/model-config-utils.js +7 -0
- package/dist/server/bare/runtime/request-context.d.ts +1 -1
- package/dist/server/bare/runtime-lifecycle.js +9 -9
- package/dist/server/bare/types/addon-responses.d.ts +1 -0
- package/dist/server/env.js +4 -1
- package/dist/server/plugins/index.d.ts +1 -1
- package/dist/server/plugins/index.js +1 -1
- package/dist/server/plugins/registry.d.ts +1 -0
- package/dist/server/plugins/registry.js +5 -0
- package/dist/server/rpc/handler-registry.js +4 -0
- package/dist/server/rpc/handler-selection.d.ts +9 -0
- package/dist/server/rpc/handler-selection.js +14 -0
- package/dist/server/rpc/handler-utils.js +5 -13
- package/dist/server/rpc/handlers/classify.d.ts +3 -0
- package/dist/server/rpc/handlers/classify.js +4 -0
- package/dist/server/rpc/handlers/index.d.ts +2 -0
- package/dist/server/rpc/handlers/index.js +2 -0
- package/dist/server/rpc/handlers/load-model/handler.js +4 -1
- package/dist/server/rpc/handlers/load-model/resolve.js +9 -0
- package/dist/server/rpc/handlers/video-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/video-stream.js +4 -0
- package/dist/server/rpc/profiling/operation-metrics.js +23 -0
- package/dist/server/utils/config-transform.js +1 -1
- package/dist/server/utils/tools/parsers/qwen35.js +7 -3
- package/dist/server/worker.js +14 -11
- package/dist/utils/errors-client.d.ts +23 -0
- package/dist/utils/errors-client.js +40 -0
- package/dist/utils/errors-server.d.ts +30 -2
- package/dist/utils/errors-server.js +51 -3
- package/package.json +66 -80
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -490
- package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -272
- package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
- package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech-stream.d.ts +0 -0
- /package/dist/server/bare/plugins/{onnx-tts → tts-ggml}/ops/text-to-speech.d.ts +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { type CreateModelParams, type PluginModelResult, type ResolveContext, type ResolveResult, type SdcppConfig } from "../../../../schemas/index";
|
|
2
|
-
type DiffusionArtifactKey = "clipLModelPath" | "clipGModelPath" | "t5XxlModelPath" | "llmModelPath" | "vaeModelPath" | "esrganModelPath";
|
|
2
|
+
type DiffusionArtifactKey = "clipLModelPath" | "clipGModelPath" | "t5XxlModelPath" | "llmModelPath" | "vaeModelPath" | "highNoiseDiffusionModelPath" | "esrganModelPath";
|
|
3
|
+
/**
|
|
4
|
+
* Stable-diffusion.cpp plugin for image diffusion, upscaling, and Wan video.
|
|
5
|
+
*
|
|
6
|
+
* Video mode is supported on React Native, but the SDK-published Wan model
|
|
7
|
+
* set is too large to load on typical mobile devices. Mobile apps should
|
|
8
|
+
* pass a `delegate` to `loadModel(...)` to run video generation on a
|
|
9
|
+
* desktop peer instead of loading the model on-device.
|
|
10
|
+
*/
|
|
3
11
|
export declare const diffusionPlugin: {
|
|
4
12
|
modelType: "sdcpp-generation";
|
|
5
13
|
displayName: string;
|
|
@@ -8,6 +16,7 @@ export declare const diffusionPlugin: {
|
|
|
8
16
|
mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
9
17
|
diffusion: "diffusion";
|
|
10
18
|
upscale: "upscale";
|
|
19
|
+
video: "video";
|
|
11
20
|
}>>;
|
|
12
21
|
threads: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
13
22
|
device: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
@@ -20,7 +29,6 @@ export declare const diffusionPlugin: {
|
|
|
20
29
|
v: "v";
|
|
21
30
|
edm_v: "edm_v";
|
|
22
31
|
flow: "flow";
|
|
23
|
-
flux_flow: "flux_flow";
|
|
24
32
|
flux2_flow: "flux2_flow";
|
|
25
33
|
}>>;
|
|
26
34
|
type: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
@@ -52,7 +60,9 @@ export declare const diffusionPlugin: {
|
|
|
52
60
|
clip_on_cpu: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
53
61
|
vae_on_cpu: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
54
62
|
vae_tiling: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
63
|
+
offload_to_cpu: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
55
64
|
flash_attn: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
65
|
+
diffusion_fa: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
56
66
|
lora_apply_mode: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
57
67
|
auto: "auto";
|
|
58
68
|
immediately: "immediately";
|
|
@@ -75,18 +85,23 @@ export declare const diffusionPlugin: {
|
|
|
75
85
|
diffusion: "diffusion";
|
|
76
86
|
tts: "tts";
|
|
77
87
|
ocr: "ocr";
|
|
88
|
+
vla: "vla";
|
|
78
89
|
"llamacpp-completion": "llamacpp-completion";
|
|
79
90
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
80
91
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
81
92
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
82
93
|
"onnx-tts": "onnx-tts";
|
|
94
|
+
"tts-ggml": "tts-ggml";
|
|
83
95
|
"parakeet-transcription": "parakeet-transcription";
|
|
84
96
|
"onnx-ocr": "onnx-ocr";
|
|
85
97
|
"sdcpp-generation": "sdcpp-generation";
|
|
98
|
+
"ggml-vla": "ggml-vla";
|
|
99
|
+
"ggml-classification": "ggml-classification";
|
|
86
100
|
llm: "llm";
|
|
87
101
|
whisper: "whisper";
|
|
88
102
|
nmt: "nmt";
|
|
89
103
|
parakeet: "parakeet";
|
|
104
|
+
classification: "classification";
|
|
90
105
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
91
106
|
}, import("zod/v4/core").$strip>]>>;
|
|
92
107
|
clipGModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
@@ -105,18 +120,23 @@ export declare const diffusionPlugin: {
|
|
|
105
120
|
diffusion: "diffusion";
|
|
106
121
|
tts: "tts";
|
|
107
122
|
ocr: "ocr";
|
|
123
|
+
vla: "vla";
|
|
108
124
|
"llamacpp-completion": "llamacpp-completion";
|
|
109
125
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
110
126
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
111
127
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
112
128
|
"onnx-tts": "onnx-tts";
|
|
129
|
+
"tts-ggml": "tts-ggml";
|
|
113
130
|
"parakeet-transcription": "parakeet-transcription";
|
|
114
131
|
"onnx-ocr": "onnx-ocr";
|
|
115
132
|
"sdcpp-generation": "sdcpp-generation";
|
|
133
|
+
"ggml-vla": "ggml-vla";
|
|
134
|
+
"ggml-classification": "ggml-classification";
|
|
116
135
|
llm: "llm";
|
|
117
136
|
whisper: "whisper";
|
|
118
137
|
nmt: "nmt";
|
|
119
138
|
parakeet: "parakeet";
|
|
139
|
+
classification: "classification";
|
|
120
140
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
121
141
|
}, import("zod/v4/core").$strip>]>>;
|
|
122
142
|
t5XxlModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
@@ -135,18 +155,23 @@ export declare const diffusionPlugin: {
|
|
|
135
155
|
diffusion: "diffusion";
|
|
136
156
|
tts: "tts";
|
|
137
157
|
ocr: "ocr";
|
|
158
|
+
vla: "vla";
|
|
138
159
|
"llamacpp-completion": "llamacpp-completion";
|
|
139
160
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
140
161
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
141
162
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
142
163
|
"onnx-tts": "onnx-tts";
|
|
164
|
+
"tts-ggml": "tts-ggml";
|
|
143
165
|
"parakeet-transcription": "parakeet-transcription";
|
|
144
166
|
"onnx-ocr": "onnx-ocr";
|
|
145
167
|
"sdcpp-generation": "sdcpp-generation";
|
|
168
|
+
"ggml-vla": "ggml-vla";
|
|
169
|
+
"ggml-classification": "ggml-classification";
|
|
146
170
|
llm: "llm";
|
|
147
171
|
whisper: "whisper";
|
|
148
172
|
nmt: "nmt";
|
|
149
173
|
parakeet: "parakeet";
|
|
174
|
+
classification: "classification";
|
|
150
175
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
151
176
|
}, import("zod/v4/core").$strip>]>>;
|
|
152
177
|
llmModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
@@ -165,18 +190,23 @@ export declare const diffusionPlugin: {
|
|
|
165
190
|
diffusion: "diffusion";
|
|
166
191
|
tts: "tts";
|
|
167
192
|
ocr: "ocr";
|
|
193
|
+
vla: "vla";
|
|
168
194
|
"llamacpp-completion": "llamacpp-completion";
|
|
169
195
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
170
196
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
171
197
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
172
198
|
"onnx-tts": "onnx-tts";
|
|
199
|
+
"tts-ggml": "tts-ggml";
|
|
173
200
|
"parakeet-transcription": "parakeet-transcription";
|
|
174
201
|
"onnx-ocr": "onnx-ocr";
|
|
175
202
|
"sdcpp-generation": "sdcpp-generation";
|
|
203
|
+
"ggml-vla": "ggml-vla";
|
|
204
|
+
"ggml-classification": "ggml-classification";
|
|
176
205
|
llm: "llm";
|
|
177
206
|
whisper: "whisper";
|
|
178
207
|
nmt: "nmt";
|
|
179
208
|
parakeet: "parakeet";
|
|
209
|
+
classification: "classification";
|
|
180
210
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
181
211
|
}, import("zod/v4/core").$strip>]>>;
|
|
182
212
|
vaeModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
@@ -195,18 +225,58 @@ export declare const diffusionPlugin: {
|
|
|
195
225
|
diffusion: "diffusion";
|
|
196
226
|
tts: "tts";
|
|
197
227
|
ocr: "ocr";
|
|
228
|
+
vla: "vla";
|
|
198
229
|
"llamacpp-completion": "llamacpp-completion";
|
|
199
230
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
200
231
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
201
232
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
202
233
|
"onnx-tts": "onnx-tts";
|
|
234
|
+
"tts-ggml": "tts-ggml";
|
|
203
235
|
"parakeet-transcription": "parakeet-transcription";
|
|
204
236
|
"onnx-ocr": "onnx-ocr";
|
|
205
237
|
"sdcpp-generation": "sdcpp-generation";
|
|
238
|
+
"ggml-vla": "ggml-vla";
|
|
239
|
+
"ggml-classification": "ggml-classification";
|
|
206
240
|
llm: "llm";
|
|
207
241
|
whisper: "whisper";
|
|
208
242
|
nmt: "nmt";
|
|
209
243
|
parakeet: "parakeet";
|
|
244
|
+
classification: "classification";
|
|
245
|
+
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
246
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
247
|
+
highNoiseDiffusionModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
248
|
+
src: import("zod").ZodString;
|
|
249
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
250
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
251
|
+
registryPath: import("zod").ZodOptional<import("zod").ZodString>;
|
|
252
|
+
registrySource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
253
|
+
blobCoreKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
254
|
+
blobIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
255
|
+
engine: import("zod").ZodOptional<import("zod").ZodString>;
|
|
256
|
+
expectedSize: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
257
|
+
sha256Checksum: import("zod").ZodOptional<import("zod").ZodString>;
|
|
258
|
+
addon: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
259
|
+
embeddings: "embeddings";
|
|
260
|
+
diffusion: "diffusion";
|
|
261
|
+
tts: "tts";
|
|
262
|
+
ocr: "ocr";
|
|
263
|
+
vla: "vla";
|
|
264
|
+
"llamacpp-completion": "llamacpp-completion";
|
|
265
|
+
"whispercpp-transcription": "whispercpp-transcription";
|
|
266
|
+
"llamacpp-embedding": "llamacpp-embedding";
|
|
267
|
+
"nmtcpp-translation": "nmtcpp-translation";
|
|
268
|
+
"onnx-tts": "onnx-tts";
|
|
269
|
+
"tts-ggml": "tts-ggml";
|
|
270
|
+
"parakeet-transcription": "parakeet-transcription";
|
|
271
|
+
"onnx-ocr": "onnx-ocr";
|
|
272
|
+
"sdcpp-generation": "sdcpp-generation";
|
|
273
|
+
"ggml-vla": "ggml-vla";
|
|
274
|
+
"ggml-classification": "ggml-classification";
|
|
275
|
+
llm: "llm";
|
|
276
|
+
whisper: "whisper";
|
|
277
|
+
nmt: "nmt";
|
|
278
|
+
parakeet: "parakeet";
|
|
279
|
+
classification: "classification";
|
|
210
280
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
211
281
|
}, import("zod/v4/core").$strip>]>>;
|
|
212
282
|
upscaler: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -227,18 +297,23 @@ export declare const diffusionPlugin: {
|
|
|
227
297
|
diffusion: "diffusion";
|
|
228
298
|
tts: "tts";
|
|
229
299
|
ocr: "ocr";
|
|
300
|
+
vla: "vla";
|
|
230
301
|
"llamacpp-completion": "llamacpp-completion";
|
|
231
302
|
"whispercpp-transcription": "whispercpp-transcription";
|
|
232
303
|
"llamacpp-embedding": "llamacpp-embedding";
|
|
233
304
|
"nmtcpp-translation": "nmtcpp-translation";
|
|
234
305
|
"onnx-tts": "onnx-tts";
|
|
306
|
+
"tts-ggml": "tts-ggml";
|
|
235
307
|
"parakeet-transcription": "parakeet-transcription";
|
|
236
308
|
"onnx-ocr": "onnx-ocr";
|
|
237
309
|
"sdcpp-generation": "sdcpp-generation";
|
|
310
|
+
"ggml-vla": "ggml-vla";
|
|
311
|
+
"ggml-classification": "ggml-classification";
|
|
238
312
|
llm: "llm";
|
|
239
313
|
whisper: "whisper";
|
|
240
314
|
nmt: "nmt";
|
|
241
315
|
parakeet: "parakeet";
|
|
316
|
+
classification: "classification";
|
|
242
317
|
}>, import("zod").ZodLiteral<"vad">]>>;
|
|
243
318
|
}, import("zod/v4/core").$strip>]>>;
|
|
244
319
|
tile_size: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
@@ -324,6 +399,125 @@ export declare const diffusionPlugin: {
|
|
|
324
399
|
seed: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
325
400
|
}, import("zod/v4/core").$strip>>;
|
|
326
401
|
}, import("zod/v4/core").$strip>>;
|
|
402
|
+
videoStream: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
403
|
+
modelId: import("zod").ZodString;
|
|
404
|
+
requestId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
405
|
+
mode: import("zod").ZodEnum<{
|
|
406
|
+
txt2vid: "txt2vid";
|
|
407
|
+
}>;
|
|
408
|
+
prompt: import("zod").ZodString;
|
|
409
|
+
negative_prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
410
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
411
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
412
|
+
video_frames: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
413
|
+
fps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
414
|
+
seed: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
415
|
+
steps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
416
|
+
sampling_method: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
417
|
+
euler: "euler";
|
|
418
|
+
euler_a: "euler_a";
|
|
419
|
+
heun: "heun";
|
|
420
|
+
dpm2: "dpm2";
|
|
421
|
+
"dpm++2m": "dpm++2m";
|
|
422
|
+
"dpm++2mv2": "dpm++2mv2";
|
|
423
|
+
"dpm++2s_a": "dpm++2s_a";
|
|
424
|
+
lcm: "lcm";
|
|
425
|
+
ipndm: "ipndm";
|
|
426
|
+
ipndm_v: "ipndm_v";
|
|
427
|
+
ddim_trailing: "ddim_trailing";
|
|
428
|
+
tcd: "tcd";
|
|
429
|
+
res_multistep: "res_multistep";
|
|
430
|
+
res_2s: "res_2s";
|
|
431
|
+
}>>;
|
|
432
|
+
scheduler: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
433
|
+
lcm: "lcm";
|
|
434
|
+
discrete: "discrete";
|
|
435
|
+
karras: "karras";
|
|
436
|
+
exponential: "exponential";
|
|
437
|
+
ays: "ays";
|
|
438
|
+
gits: "gits";
|
|
439
|
+
sgm_uniform: "sgm_uniform";
|
|
440
|
+
simple: "simple";
|
|
441
|
+
smoothstep: "smoothstep";
|
|
442
|
+
kl_optimal: "kl_optimal";
|
|
443
|
+
bong_tangent: "bong_tangent";
|
|
444
|
+
}>>;
|
|
445
|
+
cfg_scale: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
446
|
+
flow_shift: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
447
|
+
high_noise_steps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
448
|
+
high_noise_sampler: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
449
|
+
euler: "euler";
|
|
450
|
+
euler_a: "euler_a";
|
|
451
|
+
heun: "heun";
|
|
452
|
+
dpm2: "dpm2";
|
|
453
|
+
"dpm++2m": "dpm++2m";
|
|
454
|
+
"dpm++2mv2": "dpm++2mv2";
|
|
455
|
+
"dpm++2s_a": "dpm++2s_a";
|
|
456
|
+
lcm: "lcm";
|
|
457
|
+
ipndm: "ipndm";
|
|
458
|
+
ipndm_v: "ipndm_v";
|
|
459
|
+
ddim_trailing: "ddim_trailing";
|
|
460
|
+
tcd: "tcd";
|
|
461
|
+
res_multistep: "res_multistep";
|
|
462
|
+
res_2s: "res_2s";
|
|
463
|
+
}>>;
|
|
464
|
+
high_noise_scheduler: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
465
|
+
lcm: "lcm";
|
|
466
|
+
discrete: "discrete";
|
|
467
|
+
karras: "karras";
|
|
468
|
+
exponential: "exponential";
|
|
469
|
+
ays: "ays";
|
|
470
|
+
gits: "gits";
|
|
471
|
+
sgm_uniform: "sgm_uniform";
|
|
472
|
+
simple: "simple";
|
|
473
|
+
smoothstep: "smoothstep";
|
|
474
|
+
kl_optimal: "kl_optimal";
|
|
475
|
+
bong_tangent: "bong_tangent";
|
|
476
|
+
}>>;
|
|
477
|
+
high_noise_cfg_scale: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
478
|
+
high_noise_flow_shift: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
479
|
+
moe_boundary: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
480
|
+
vace_strength: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
481
|
+
control_frames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
482
|
+
vae_tiling: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
483
|
+
vae_tile_size: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodString]>>;
|
|
484
|
+
vae_tile_overlap: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
485
|
+
cache_mode: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
486
|
+
disabled: "disabled";
|
|
487
|
+
easycache: "easycache";
|
|
488
|
+
ucache: "ucache";
|
|
489
|
+
dbcache: "dbcache";
|
|
490
|
+
taylorseer: "taylorseer";
|
|
491
|
+
"cache-dit": "cache-dit";
|
|
492
|
+
}>>;
|
|
493
|
+
cache_preset: import("zod").ZodOptional<import("zod").ZodString>;
|
|
494
|
+
cache_threshold: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
495
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
496
|
+
type: import("zod").ZodLiteral<"videoStream">;
|
|
497
|
+
step: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
498
|
+
totalSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
499
|
+
elapsedMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
500
|
+
data: import("zod").ZodOptional<import("zod").ZodString>;
|
|
501
|
+
outputIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
502
|
+
done: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
503
|
+
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
504
|
+
seed: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
505
|
+
modelLoadMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
506
|
+
generationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
507
|
+
totalGenerationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
508
|
+
totalWallMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
509
|
+
totalSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
510
|
+
totalGenerations: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
511
|
+
totalImages: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
512
|
+
totalPixels: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
513
|
+
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
514
|
+
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
515
|
+
totalVideos: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
516
|
+
totalVideoFrames: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
517
|
+
videoFrames: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
518
|
+
fps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
519
|
+
}, import("zod/v4/core").$strip>>;
|
|
520
|
+
}, import("zod/v4/core").$strip>>;
|
|
327
521
|
upscaleStream: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
328
522
|
modelId: import("zod").ZodString;
|
|
329
523
|
image: import("zod").ZodString;
|
|
@@ -344,6 +538,10 @@ export declare const diffusionPlugin: {
|
|
|
344
538
|
width: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
345
539
|
height: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
346
540
|
repeats: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
541
|
+
backendDevice: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
542
|
+
cpu: "cpu";
|
|
543
|
+
gpu: "gpu";
|
|
544
|
+
}>>;
|
|
347
545
|
}, import("zod/v4/core").$strip>>;
|
|
348
546
|
}, import("zod/v4/core").$strip>>;
|
|
349
547
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import ImgStableDiffusion, { EsrganUpscaler, } from "@qvac/diffusion-cpp";
|
|
1
|
+
import ImgStableDiffusion, { EsrganUpscaler, VideoStableDiffusion, } from "@qvac/diffusion-cpp";
|
|
2
2
|
import addonLogging from "@qvac/diffusion-cpp/addonLogging.js";
|
|
3
|
-
import { definePlugin, defineHandler, sdcppConfigSchema, diffusionRequestSchema, diffusionStreamResponseSchema, upscaleRequestSchema, upscaleStreamResponseSchema, ModelType, ADDON_DIFFUSION, } from "../../../../schemas/index.js";
|
|
3
|
+
import { definePlugin, defineHandler, sdcppConfigSchema, diffusionRequestSchema, diffusionStreamResponseSchema, videoRequestSchema, videoStreamResponseSchema, upscaleRequestSchema, upscaleStreamResponseSchema, ModelType, ADDON_DIFFUSION, } from "../../../../schemas/index.js";
|
|
4
4
|
import { createStreamLogger, registerAddonLogger } from "../../../../logging/index.js";
|
|
5
5
|
import { ModelLoadFailedError } from "../../../../utils/errors-server.js";
|
|
6
6
|
import { diffusion } from "./ops/diffusion.js";
|
|
7
|
+
import { video } from "./ops/video.js";
|
|
7
8
|
import { upscale } from "./ops/upscale.js";
|
|
8
9
|
// Single source of truth for `SdcppConfig.upscaler.*` → addon-config key
|
|
9
10
|
// mapping. Used by both the diffusion-mode (post-generation upscaler) and the
|
|
@@ -27,12 +28,24 @@ function flattenUpscalerKeys(upscaler) {
|
|
|
27
28
|
}),
|
|
28
29
|
};
|
|
29
30
|
}
|
|
31
|
+
// `mode: "upscale"` builds an EsrganUpscaler directly (not via SdCtx), so the
|
|
32
|
+
// top-level `device` field has to be forwarded explicitly — it is not part of
|
|
33
|
+
// the `upscaler.*` block.
|
|
30
34
|
function toEsrganAddonConfig(config) {
|
|
31
35
|
return {
|
|
32
36
|
...flattenUpscalerKeys(config.upscaler),
|
|
37
|
+
...(config.device !== undefined && { device: config.device }),
|
|
33
38
|
...(config.verbosity !== undefined && { verbosity: config.verbosity }),
|
|
34
39
|
};
|
|
35
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Stable-diffusion.cpp plugin for image diffusion, upscaling, and Wan video.
|
|
43
|
+
*
|
|
44
|
+
* Video mode is supported on React Native, but the SDK-published Wan model
|
|
45
|
+
* set is too large to load on typical mobile devices. Mobile apps should
|
|
46
|
+
* pass a `delegate` to `loadModel(...)` to run video generation on a
|
|
47
|
+
* desktop peer instead of loading the model on-device.
|
|
48
|
+
*/
|
|
36
49
|
export const diffusionPlugin = definePlugin({
|
|
37
50
|
modelType: ModelType.sdcppGeneration,
|
|
38
51
|
displayName: "Image Generation & Upscaling (stable-diffusion.cpp)",
|
|
@@ -45,27 +58,30 @@ export const diffusionPlugin = definePlugin({
|
|
|
45
58
|
if (cfg.mode === "upscale") {
|
|
46
59
|
return { config: cfg };
|
|
47
60
|
}
|
|
48
|
-
const { clipLModelSrc, clipGModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc, upscaler, ...rest } = cfg;
|
|
49
|
-
|
|
61
|
+
const { clipLModelSrc, clipGModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc, highNoiseDiffusionModelSrc, upscaler, ...rest } = cfg;
|
|
62
|
+
// Video jobs do not apply ESRGAN so we drop the whole `upscaler` object.
|
|
63
|
+
const effectiveUpscaler = cfg.mode === "video" ? undefined : upscaler;
|
|
64
|
+
const { model_src: esrganModelSrc, ...upscalerRuntime } = effectiveUpscaler ?? {};
|
|
50
65
|
const runtimeConfig = {
|
|
51
66
|
...rest,
|
|
52
|
-
...(
|
|
67
|
+
...(effectiveUpscaler && { upscaler: upscalerRuntime }),
|
|
53
68
|
};
|
|
54
69
|
const sources = {
|
|
55
70
|
clipLModelSrc, clipGModelSrc, t5XxlModelSrc,
|
|
56
|
-
llmModelSrc, vaeModelSrc, esrganModelSrc,
|
|
71
|
+
llmModelSrc, vaeModelSrc, highNoiseDiffusionModelSrc, esrganModelSrc,
|
|
57
72
|
};
|
|
58
73
|
const hasSources = Object.values(sources).some(Boolean);
|
|
59
74
|
if (!hasSources) {
|
|
60
75
|
return { config: runtimeConfig };
|
|
61
76
|
}
|
|
62
77
|
const resolve = ctx.resolveModelPath;
|
|
63
|
-
const [clipLModelPath, clipGModelPath, t5XxlModelPath, llmModelPath, vaeModelPath, esrganModelPath,] = await Promise.all([
|
|
78
|
+
const [clipLModelPath, clipGModelPath, t5XxlModelPath, llmModelPath, vaeModelPath, highNoiseDiffusionModelPath, esrganModelPath,] = await Promise.all([
|
|
64
79
|
clipLModelSrc ? resolve(clipLModelSrc) : undefined,
|
|
65
80
|
clipGModelSrc ? resolve(clipGModelSrc) : undefined,
|
|
66
81
|
t5XxlModelSrc ? resolve(t5XxlModelSrc) : undefined,
|
|
67
82
|
llmModelSrc ? resolve(llmModelSrc) : undefined,
|
|
68
83
|
vaeModelSrc ? resolve(vaeModelSrc) : undefined,
|
|
84
|
+
highNoiseDiffusionModelSrc ? resolve(highNoiseDiffusionModelSrc) : undefined,
|
|
69
85
|
esrganModelSrc ? resolve(esrganModelSrc) : undefined,
|
|
70
86
|
]);
|
|
71
87
|
return {
|
|
@@ -76,6 +92,7 @@ export const diffusionPlugin = definePlugin({
|
|
|
76
92
|
...(t5XxlModelPath && { t5XxlModelPath }),
|
|
77
93
|
...(llmModelPath && { llmModelPath }),
|
|
78
94
|
...(vaeModelPath && { vaeModelPath }),
|
|
95
|
+
...(highNoiseDiffusionModelPath && { highNoiseDiffusionModelPath }),
|
|
79
96
|
...(esrganModelPath && { esrganModelPath }),
|
|
80
97
|
},
|
|
81
98
|
};
|
|
@@ -88,7 +105,7 @@ export const diffusionPlugin = definePlugin({
|
|
|
88
105
|
// the main diffusion checkpoint. Reject early with a clear error
|
|
89
106
|
// instead of letting the native addon fail mid-load. Done before any
|
|
90
107
|
// logger / native side-effects so callers can recover cleanly.
|
|
91
|
-
if (config.mode
|
|
108
|
+
if (config.mode === "diffusion" &&
|
|
92
109
|
config.upscaler !== undefined &&
|
|
93
110
|
!artifacts?.["esrganModelPath"]) {
|
|
94
111
|
throw new ModelLoadFailedError("modelConfig.upscaler.model_src is required when modelConfig.upscaler " +
|
|
@@ -107,6 +124,35 @@ export const diffusionPlugin = definePlugin({
|
|
|
107
124
|
});
|
|
108
125
|
return { model };
|
|
109
126
|
}
|
|
127
|
+
if (config.mode === "video") {
|
|
128
|
+
if (!artifacts?.["t5XxlModelPath"]) {
|
|
129
|
+
throw new ModelLoadFailedError("modelConfig.t5XxlModelSrc is required in video mode. " +
|
|
130
|
+
"Provide the Wan text encoder model before loading the video pipeline.");
|
|
131
|
+
}
|
|
132
|
+
if (!artifacts?.["vaeModelPath"]) {
|
|
133
|
+
throw new ModelLoadFailedError("modelConfig.vaeModelSrc is required in video mode. " +
|
|
134
|
+
"Provide the Wan VAE model before loading the video pipeline.");
|
|
135
|
+
}
|
|
136
|
+
const files = {
|
|
137
|
+
model: modelPath,
|
|
138
|
+
t5Xxl: artifacts["t5XxlModelPath"],
|
|
139
|
+
vae: artifacts["vaeModelPath"],
|
|
140
|
+
...(artifacts?.["highNoiseDiffusionModelPath"] && {
|
|
141
|
+
highNoiseDiffusionModel: artifacts["highNoiseDiffusionModelPath"],
|
|
142
|
+
}),
|
|
143
|
+
...(artifacts?.["esrganModelPath"] && { esrgan: artifacts["esrganModelPath"] }),
|
|
144
|
+
};
|
|
145
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
146
|
+
const { clipLModelSrc, clipGModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc, highNoiseDiffusionModelSrc, upscaler, mode, ...rest } = config;
|
|
147
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
148
|
+
const model = new VideoStableDiffusion({
|
|
149
|
+
files,
|
|
150
|
+
config: rest,
|
|
151
|
+
logger,
|
|
152
|
+
opts: { stats: true },
|
|
153
|
+
});
|
|
154
|
+
return { model };
|
|
155
|
+
}
|
|
110
156
|
const files = {
|
|
111
157
|
model: modelPath,
|
|
112
158
|
...(artifacts?.["clipLModelPath"] && { clipL: artifacts["clipLModelPath"] }),
|
|
@@ -143,6 +189,13 @@ export const diffusionPlugin = definePlugin({
|
|
|
143
189
|
cancel: { scope: "model", hard: true },
|
|
144
190
|
handler: diffusion,
|
|
145
191
|
}),
|
|
192
|
+
videoStream: defineHandler({
|
|
193
|
+
requestSchema: videoRequestSchema,
|
|
194
|
+
responseSchema: videoStreamResponseSchema,
|
|
195
|
+
streaming: true,
|
|
196
|
+
cancel: { scope: "model", hard: true },
|
|
197
|
+
handler: video,
|
|
198
|
+
}),
|
|
146
199
|
upscaleStream: defineHandler({
|
|
147
200
|
requestSchema: upscaleRequestSchema,
|
|
148
201
|
responseSchema: upscaleStreamResponseSchema,
|
|
@@ -10,24 +10,14 @@ function hasRunStreaming(model) {
|
|
|
10
10
|
"runStreaming" in model &&
|
|
11
11
|
typeof model.runStreaming === "function");
|
|
12
12
|
}
|
|
13
|
-
// Callers (e.g. LLM token deltas) may write raw Buffer chunks whose
|
|
14
|
-
// boundaries split a multi-byte UTF-8 codepoint. A naive `buf.toString("utf8")`
|
|
15
|
-
// per chunk emits U+FFFD at every split point and silently corrupts CJK,
|
|
16
|
-
// emoji, accented scripts, etc. before they reach the tokenizer. Keep a
|
|
17
|
-
// tail-buffer of at most 3 bytes spanning an incomplete trailing codepoint
|
|
18
|
-
// and decode only the complete-codepoint prefix of each combined chunk.
|
|
19
13
|
function findLastCompleteUtf8End(buf) {
|
|
20
14
|
const len = buf.length;
|
|
21
|
-
// A UTF-8 codepoint is at most 4 bytes, so a split can only dangle in
|
|
22
|
-
// the last 3 bytes. Scan backwards to find the most recent leading byte.
|
|
23
15
|
for (let i = len - 1; i >= 0 && i >= len - 3; i--) {
|
|
24
16
|
const b = buf[i];
|
|
25
17
|
if ((b & 0x80) === 0) {
|
|
26
|
-
// ASCII byte: everything up to and including i is complete.
|
|
27
18
|
return i + 1;
|
|
28
19
|
}
|
|
29
20
|
if ((b & 0xc0) === 0xc0) {
|
|
30
|
-
// Leading byte of a multi-byte sequence.
|
|
31
21
|
let expected;
|
|
32
22
|
if ((b & 0xe0) === 0xc0)
|
|
33
23
|
expected = 2;
|
|
@@ -36,7 +26,7 @@ function findLastCompleteUtf8End(buf) {
|
|
|
36
26
|
else if ((b & 0xf8) === 0xf0)
|
|
37
27
|
expected = 4;
|
|
38
28
|
else
|
|
39
|
-
return len;
|
|
29
|
+
return len;
|
|
40
30
|
return i + expected <= len ? len : i;
|
|
41
31
|
}
|
|
42
32
|
}
|
|
@@ -59,9 +49,6 @@ async function* buffersToUtf8Fragments(inputStream) {
|
|
|
59
49
|
: Buffer.alloc(0);
|
|
60
50
|
}
|
|
61
51
|
if (pending.length > 0) {
|
|
62
|
-
// Stream ended with a dangling partial codepoint — flush as-is so the
|
|
63
|
-
// tokenizer sees the replacement character rather than silently dropping
|
|
64
|
-
// the final byte(s).
|
|
65
52
|
const s = pending.toString("utf8");
|
|
66
53
|
if (s.length > 0) {
|
|
67
54
|
yield s;
|
|
@@ -89,7 +76,7 @@ export async function* textToSpeechStream(params, inputStream) {
|
|
|
89
76
|
const model = getModel(request.modelId);
|
|
90
77
|
const modelStart = nowMs();
|
|
91
78
|
if (!hasRunStreaming(model)) {
|
|
92
|
-
throw new TextToSpeechStreamFailedError("textToSpeechStream requires
|
|
79
|
+
throw new TextToSpeechStreamFailedError("textToSpeechStream requires a TTS model with runStreaming");
|
|
93
80
|
}
|
|
94
81
|
const textSource = buffersToUtf8Fragments(inputStream);
|
|
95
82
|
const streamOpts = buildRunStreamingOptions(request);
|
|
@@ -16,7 +16,7 @@ export async function* textToSpeech(params) {
|
|
|
16
16
|
const modelStart = nowMs();
|
|
17
17
|
if (sentenceStream) {
|
|
18
18
|
if (!hasRunStream(model)) {
|
|
19
|
-
throw new TextToSpeechFailedError("sentenceStream requires
|
|
19
|
+
throw new TextToSpeechFailedError("sentenceStream requires a TTS model with runStream");
|
|
20
20
|
}
|
|
21
21
|
const streamOpts = sentenceStreamLocale !== undefined || sentenceStreamMaxChunkScalars !== undefined
|
|
22
22
|
? {
|
|
@@ -62,6 +62,7 @@ export async function* textToSpeech(params) {
|
|
|
62
62
|
const response = (await model.run({
|
|
63
63
|
input: text,
|
|
64
64
|
inputType,
|
|
65
|
+
...(stream ? { streamOutput: true } : {}),
|
|
65
66
|
}));
|
|
66
67
|
if (!stream) {
|
|
67
68
|
let completeBuffer = [];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type CreateModelParams, type PluginModelResult, type ResolveContext, type ResolveResult } from "../../../../schemas/index";
|
|
2
|
+
export declare const ttsPlugin: {
|
|
3
|
+
modelType: "tts-ggml";
|
|
4
|
+
displayName: string;
|
|
5
|
+
addonPackage: "@qvac/tts-ggml";
|
|
6
|
+
loadConfigSchema: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
7
|
+
[x: string]: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
8
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
9
|
+
[x: string]: import("zod").ZodOptional<import("zod").ZodUnknown>;
|
|
10
|
+
}, import("zod/v4/core").$strict>]>;
|
|
11
|
+
resolveConfig(cfg: Record<string, unknown>, ctx: ResolveContext): Promise<ResolveResult<{
|
|
12
|
+
ttsEngine: "supertonic";
|
|
13
|
+
language: "en" | "de" | "es" | "it";
|
|
14
|
+
voice?: string | undefined;
|
|
15
|
+
ttsSpeed?: number | undefined;
|
|
16
|
+
ttsNumInferenceSteps?: number | undefined;
|
|
17
|
+
useGPU?: boolean | undefined;
|
|
18
|
+
} | {
|
|
19
|
+
ttsEngine: "chatterbox";
|
|
20
|
+
language: "en" | "de" | "es" | "it";
|
|
21
|
+
voice?: string | undefined;
|
|
22
|
+
useGPU?: boolean | undefined;
|
|
23
|
+
}, string>>;
|
|
24
|
+
createModel(params: CreateModelParams): PluginModelResult;
|
|
25
|
+
handlers: {
|
|
26
|
+
textToSpeech: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
27
|
+
modelId: import("zod").ZodString;
|
|
28
|
+
inputType: import("zod").ZodDefault<import("zod").ZodString>;
|
|
29
|
+
text: import("zod").ZodString;
|
|
30
|
+
stream: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
31
|
+
sentenceStream: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
32
|
+
sentenceStreamLocale: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
+
sentenceStreamMaxChunkScalars: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
34
|
+
type: import("zod").ZodLiteral<"textToSpeech">;
|
|
35
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
36
|
+
type: import("zod").ZodLiteral<"textToSpeech">;
|
|
37
|
+
buffer: import("zod").ZodArray<import("zod").ZodNumber>;
|
|
38
|
+
done: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
39
|
+
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
40
|
+
audioDuration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
41
|
+
totalSamples: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
42
|
+
}, import("zod/v4/core").$strip>>;
|
|
43
|
+
chunkIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
44
|
+
sentenceChunk: import("zod").ZodOptional<import("zod").ZodString>;
|
|
45
|
+
}, import("zod/v4/core").$strip>>;
|
|
46
|
+
textToSpeechStream: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodObject<{
|
|
47
|
+
modelId: import("zod").ZodString;
|
|
48
|
+
inputType: import("zod").ZodDefault<import("zod").ZodString>;
|
|
49
|
+
accumulateSentences: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
50
|
+
sentenceDelimiterPreset: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
51
|
+
latin: "latin";
|
|
52
|
+
cjk: "cjk";
|
|
53
|
+
multilingual: "multilingual";
|
|
54
|
+
}>>;
|
|
55
|
+
maxBufferScalars: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
56
|
+
flushAfterMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
57
|
+
type: import("zod").ZodLiteral<"textToSpeechStream">;
|
|
58
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
59
|
+
type: import("zod").ZodLiteral<"textToSpeechStream">;
|
|
60
|
+
buffer: import("zod").ZodArray<import("zod").ZodNumber>;
|
|
61
|
+
done: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
62
|
+
stats: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
63
|
+
audioDuration: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
64
|
+
totalSamples: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
65
|
+
}, import("zod/v4/core").$strip>>;
|
|
66
|
+
chunkIndex: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
67
|
+
sentenceChunk: import("zod").ZodOptional<import("zod").ZodString>;
|
|
68
|
+
}, import("zod/v4/core").$strip>>;
|
|
69
|
+
};
|
|
70
|
+
logging: {
|
|
71
|
+
module: import("@qvac/tts-ggml/addonLogging").AddonLogging;
|
|
72
|
+
namespace: "tts-ggml";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=plugin.d.ts.map
|