@qvac/inference 0.22.0 → 0.24.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 +111 -60
- package/README.md +4 -2
- package/dist/api/assess-model-fit.d.ts +14 -14
- package/dist/api/assess-model-fit.js +14 -14
- package/dist/api/audio-gen.d.ts +2 -2
- package/dist/api/audio-gen.js +136 -45
- package/dist/api/batch-completion.js +2 -1
- package/dist/api/calc-tokens.d.ts +30 -0
- package/dist/api/calc-tokens.js +41 -0
- package/dist/api/classify.d.ts +5 -2
- package/dist/api/classify.js +5 -2
- package/dist/api/completion-stream.d.ts +2 -1
- package/dist/api/completion-stream.js +4 -1
- package/dist/api/decide.js +1 -1
- package/dist/api/delete-cache.d.ts +7 -1
- package/dist/api/delete-cache.js +11 -1
- package/dist/api/diffusion.d.ts +32 -2
- package/dist/api/diffusion.js +32 -2
- package/dist/api/download-asset.js +1 -1
- package/dist/api/embed.d.ts +82 -29
- package/dist/api/embed.js +64 -18
- package/dist/api/finetune.js +1 -1
- package/dist/api/get-model-info.d.ts +1 -1
- package/dist/api/index.d.ts +40 -38
- package/dist/api/index.js +39 -37
- package/dist/api/load-model.js +2 -2
- package/dist/api/logging-stream-registry.js +11 -7
- package/dist/api/logging-stream.d.ts +11 -1
- package/dist/api/logging-stream.js +11 -2
- package/dist/api/rag.d.ts +1 -1
- package/dist/api/rag.js +1 -1
- package/dist/api/registry.d.ts +18 -7
- package/dist/api/registry.js +37 -13
- package/dist/api/rerank.d.ts +17 -0
- package/dist/api/rerank.js +36 -0
- package/dist/api/subscribe-logs.js +5 -3
- package/dist/api/text-to-speech.d.ts +14 -5
- package/dist/api/text-to-speech.js +83 -29
- package/dist/api/transcribe.d.ts +6 -2
- package/dist/api/transcribe.js +7 -1
- package/dist/api/unload-model.js +1 -1
- package/dist/api/vector-index.d.ts +25 -3
- package/dist/api/vector-index.js +17 -2
- package/dist/api/video-request.d.ts +15 -15
- package/dist/api/video.js +1 -1
- package/dist/api/vla.js +1 -1
- package/dist/api/world-result.js +1 -1
- package/dist/api/world.d.ts +1 -1
- package/dist/api/world.js +1 -1
- package/dist/config/resolve-config.d.ts +1 -1
- package/dist/config/resolve-config.js +1 -1
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/dispatch.d.ts +11 -4
- package/dist/dispatch.js +80 -18
- package/dist/engine.d.ts +1 -1
- package/dist/errors/index.d.ts +76 -0
- package/dist/errors/index.js +141 -1
- package/dist/handlers/assess-model-fit.d.ts +3 -21
- package/dist/handlers/assess-model-fit.js +4 -303
- package/dist/handlers/cancelHandler.d.ts +10 -9
- package/dist/handlers/cancelHandler.js +18 -14
- package/dist/handlers/completion-orchestrate.d.ts +14 -2
- package/dist/handlers/completion-orchestrate.js +166 -24
- package/dist/handlers/delete-cache.d.ts +2 -1
- package/dist/handlers/delete-cache.js +6 -1
- package/dist/handlers/download-asset.js +13 -6
- package/dist/handlers/finetune.js +1 -1
- package/dist/handlers/get-loaded-model-info.js +3 -3
- package/dist/handlers/get-model-info.js +72 -3
- package/dist/handlers/load-model/coreml-sidecars.d.ts +15 -11
- package/dist/handlers/load-model/coreml-sidecars.js +51 -91
- package/dist/handlers/load-model/download-lock.d.ts +20 -0
- package/dist/handlers/load-model/download-lock.js +213 -0
- package/dist/handlers/load-model/download-manager.d.ts +11 -3
- package/dist/handlers/load-model/download-manager.js +62 -11
- package/dist/handlers/load-model/download-stats.d.ts +2 -2
- package/dist/handlers/load-model/download-stats.js +3 -3
- package/dist/handlers/load-model/handler.js +97 -41
- package/dist/handlers/load-model/http-verify.d.ts +1 -1
- package/dist/handlers/load-model/http.d.ts +1 -1
- package/dist/handlers/load-model/http.js +330 -208
- package/dist/handlers/load-model/hyperdrive.d.ts +16 -1
- package/dist/handlers/load-model/hyperdrive.js +125 -52
- package/dist/handlers/load-model/index.d.ts +2 -2
- package/dist/handlers/load-model/index.js +2 -2
- package/dist/handlers/load-model/registry-client-options.d.ts +2 -0
- package/dist/handlers/load-model/registry-client-options.js +4 -2
- package/dist/handlers/load-model/registry-companion-set.d.ts +6 -1
- package/dist/handlers/load-model/registry-companion-set.js +20 -2
- package/dist/handlers/load-model/registry-delete.d.ts +5 -0
- package/dist/handlers/load-model/registry-delete.js +269 -0
- package/dist/handlers/load-model/registry-download-utils.d.ts +7 -5
- package/dist/handlers/load-model/registry-download-utils.js +95 -24
- package/dist/handlers/load-model/registry.d.ts +22 -2
- package/dist/handlers/load-model/registry.js +312 -179
- package/dist/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/handlers/load-model/resolve-session.js +11 -3
- package/dist/handlers/load-model/resolve.d.ts +1 -1
- package/dist/handlers/load-model/resolve.js +9 -6
- package/dist/handlers/load-model/types.d.ts +2 -0
- package/dist/handlers/logging-stream.d.ts +2 -1
- package/dist/handlers/logging-stream.js +35 -7
- package/dist/handlers/plugin-invoke.js +152 -39
- package/dist/handlers/registry.d.ts +2 -2
- package/dist/handlers/registry.js +108 -29
- package/dist/handlers/rpc-server.js +7 -7
- package/dist/handlers/session.d.ts +11 -0
- package/dist/handlers/session.js +40 -0
- package/dist/handlers/types.d.ts +7 -1
- package/dist/handlers/unload-model.js +8 -3
- package/dist/handlers/vector-index.js +118 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/addon.d.ts +1 -1
- package/dist/logging/addon.js +1 -1
- package/dist/logging/index.d.ts +5 -5
- package/dist/logging/index.js +4 -4
- package/dist/logging/logger.d.ts +1 -1
- package/dist/logging/logger.js +3 -3
- package/dist/logging/utils.js +11 -3
- package/dist/model-cache-layout.d.ts +1 -0
- package/dist/model-cache-layout.js +2 -0
- package/dist/model-fit/assess.d.ts +23 -0
- package/dist/model-fit/assess.js +110 -0
- package/dist/model-fit/describe.d.ts +12 -0
- package/dist/model-fit/describe.js +29 -0
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.d.ts → model-fit/description/fetch.d.ts} +2 -2
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.js → model-fit/description/fetch.js} +98 -19
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts → model-fit/description/resolve-load.d.ts} +8 -6
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.js → model-fit/description/resolve-load.js} +20 -20
- package/dist/model-fit/fit-load.d.ts +23 -0
- package/dist/model-fit/fit-load.js +29 -0
- package/dist/model-fit/load-check.d.ts +34 -0
- package/dist/model-fit/load-check.js +77 -0
- package/dist/model-fit/run/engine.d.ts +12 -0
- package/dist/model-fit/run/engine.js +9 -0
- package/dist/model-fit/run/run.d.ts +46 -0
- package/dist/model-fit/run/run.js +208 -0
- package/dist/model-fit/sum.d.ts +32 -0
- package/dist/model-fit/sum.js +60 -0
- package/dist/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +2 -2
- package/dist/models/registry/models.d.ts +1377 -130
- package/dist/models/registry/models.js +3622 -2312
- package/dist/plugins/builtin/asr-ggml/config.d.ts +19 -4
- package/dist/plugins/builtin/asr-ggml/config.js +39 -3
- package/dist/plugins/builtin/asr-ggml/fit.d.ts +18 -0
- package/dist/plugins/builtin/asr-ggml/fit.js +118 -0
- package/dist/plugins/builtin/audiogen-ggml/config.d.ts +6 -0
- package/dist/plugins/builtin/audiogen-ggml/config.js +9 -0
- package/dist/plugins/builtin/audiogen-ggml/fit.d.ts +3 -0
- package/dist/{resources/model-fit/native-probe/engines/audiogen.js → plugins/builtin/audiogen-ggml/fit.js} +28 -18
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +4 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.d.ts +17 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-encode.js +68 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +11 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +47 -11
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +4 -3
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +3 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +4 -3
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +203 -72
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +17 -5
- package/dist/plugins/builtin/bci-whispercpp-transcription/fit.d.ts +3 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/fit.js +22 -0
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +71 -29
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +12 -10
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +8 -5
- package/dist/plugins/builtin/ggml-classification/plugin.js +89 -9
- package/dist/plugins/builtin/ggml-image-embedding/ops/embed.d.ts +24 -0
- package/dist/plugins/builtin/ggml-image-embedding/ops/embed.js +184 -0
- package/dist/plugins/builtin/ggml-image-embedding/plugin.d.ts +120 -0
- package/dist/plugins/builtin/ggml-image-embedding/plugin.js +39 -0
- package/dist/plugins/builtin/ggml-ocr/fit.d.ts +6 -0
- package/dist/plugins/builtin/ggml-ocr/fit.js +19 -0
- package/dist/plugins/builtin/ggml-ocr/params.d.ts +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +20 -13
- package/dist/plugins/builtin/ggml-ocr/plugin.js +111 -25
- package/dist/plugins/builtin/ggml-vla/ops/vla-run.d.ts +2 -2
- package/dist/plugins/builtin/ggml-vla/ops/vla-run.js +18 -2
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +15 -15
- package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
- package/dist/plugins/builtin/index.d.ts +16 -14
- package/dist/plugins/builtin/index.js +16 -14
- package/dist/plugins/builtin/llamacpp-completion/fit.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-completion/fit.js +28 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +6 -8
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +15 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/calc-tokens.js +32 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +18 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +94 -21
- package/dist/plugins/builtin/llamacpp-completion/ops/finetune.d.ts +5 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/finetune.js +54 -19
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +5 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +9 -7
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +315 -95
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +51 -25
- package/dist/plugins/builtin/llamacpp-completion/transform.js +4 -0
- package/dist/plugins/builtin/llamacpp-decision/helpers.d.ts +0 -1
- package/dist/plugins/builtin/llamacpp-decision/helpers.js +7 -15
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.d.ts +3 -1
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +6 -3
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +43 -35
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +4 -3
- package/dist/plugins/builtin/llamacpp-embedding/fit.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-embedding/fit.js +23 -0
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +201 -10
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +52 -16
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +2 -2
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +29 -2
- package/dist/plugins/builtin/llamacpp-rerank/helpers.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-rerank/helpers.js +16 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +7 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +120 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +92 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.js +44 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +46 -19
- package/dist/plugins/builtin/moss-transcribe/plugin.js +9 -7
- package/dist/plugins/builtin/nmtcpp-translation/fit.d.ts +3 -0
- package/dist/plugins/builtin/nmtcpp-translation/fit.js +11 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +32 -18
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +8 -6
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +234 -38
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +42 -16
- package/dist/plugins/builtin/sdcpp-generation/fit.d.ts +3 -0
- package/dist/plugins/builtin/sdcpp-generation/fit.js +68 -0
- package/dist/plugins/builtin/sdcpp-generation/load-files.d.ts +30 -0
- package/dist/plugins/builtin/sdcpp-generation/load-files.js +121 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +8 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +174 -53
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.d.ts +4 -1
- package/dist/plugins/builtin/sdcpp-generation/ops/upscale.js +107 -22
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +7 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +23 -9
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +6 -4
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +8 -3
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +166 -47
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +67 -155
- package/dist/plugins/builtin/sdcpp-generation/upscaler-config.d.ts +15 -0
- package/dist/plugins/builtin/sdcpp-generation/upscaler-config.js +19 -0
- package/dist/plugins/builtin/sdcpp-generation/world-config.d.ts +8 -0
- package/dist/plugins/builtin/sdcpp-generation/world-config.js +9 -0
- package/dist/plugins/builtin/tts-ggml/fit.d.ts +3 -0
- package/dist/plugins/builtin/tts-ggml/fit.js +162 -0
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +4 -1
- package/dist/plugins/builtin/tts-ggml/ops/moss-options.d.ts +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +3 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +24 -11
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +2 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +53 -18
- package/dist/plugins/builtin/tts-ggml/ops/voice-options.d.ts +50 -0
- package/dist/plugins/builtin/tts-ggml/ops/voice-options.js +74 -0
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +415 -57
- package/dist/plugins/builtin/tts-ggml/plugin.js +183 -34
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +104 -40
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +12 -10
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/ops/bci-transcribe.d.ts +5 -4
- package/dist/plugins/ops/bci-transcribe.js +18 -4
- package/dist/plugins/ops/cancel.d.ts +1 -0
- package/dist/plugins/ops/cancel.js +11 -2
- package/dist/plugins/ops/embed.d.ts +5 -3
- package/dist/plugins/ops/embed.js +89 -34
- package/dist/plugins/ops/kv-cache-utils.d.ts +5 -3
- package/dist/plugins/ops/kv-cache-utils.js +21 -10
- package/dist/plugins/ops/load-model.d.ts +10 -2
- package/dist/plugins/ops/load-model.js +45 -19
- package/dist/plugins/ops/transcribe.d.ts +5 -4
- package/dist/plugins/ops/transcribe.js +63 -28
- package/dist/plugins/ops/translate.d.ts +2 -1
- package/dist/plugins/ops/translate.js +7 -4
- package/dist/plugins/ops/unload-model.d.ts +17 -1
- package/dist/plugins/ops/unload-model.js +32 -3
- package/dist/plugins/turbovec-backend.d.ts +1 -1
- package/dist/plugins/turbovec-backend.js +21 -6
- package/dist/profiling/aggregator.d.ts +1 -1
- package/dist/profiling/aggregator.js +1 -1
- package/dist/profiling/controller.d.ts +1 -1
- package/dist/profiling/controller.js +2 -2
- package/dist/profiling/events.d.ts +1 -1
- package/dist/profiling/events.js +2 -2
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +3 -3
- package/dist/profiling/index.d.ts +13 -13
- package/dist/profiling/index.js +12 -12
- package/dist/profiling/operation-metrics.d.ts +1 -1
- package/dist/profiling/operation-metrics.js +24 -21
- package/dist/profiling/operation-wrappers.js +3 -3
- package/dist/profiling/profiler.js +1 -1
- package/dist/rag/embedding-scope.d.ts +16 -0
- package/dist/rag/embedding-scope.js +81 -0
- package/dist/rag/handler.d.ts +25 -0
- package/dist/rag/handler.js +51 -17
- package/dist/rag/handlers/close-workspace.js +1 -1
- package/dist/rag/handlers/delete-embeddings.js +1 -1
- package/dist/rag/handlers/delete-workspace.js +1 -1
- package/dist/rag/handlers/ingest.js +3 -7
- package/dist/rag/handlers/list-workspaces.d.ts +1 -1
- package/dist/rag/handlers/list-workspaces.js +1 -1
- package/dist/rag/handlers/reindex.js +1 -1
- package/dist/rag/handlers/save-embeddings.js +1 -1
- package/dist/rag/handlers/search.d.ts +10 -1
- package/dist/rag/handlers/search.js +17 -8
- package/dist/rag/index.d.ts +11 -11
- package/dist/rag/index.js +11 -11
- package/dist/rag/rag-operation-manager.d.ts +27 -3
- package/dist/rag/rag-operation-manager.js +10 -27
- package/dist/rag/rag-workspace-manager.js +1 -1
- package/dist/registry.js +7 -1
- package/dist/resources/collector.d.ts +71 -37
- package/dist/resources/collector.js +9 -2
- package/dist/resources/instance.d.ts +1 -1
- package/dist/resources/instance.js +1 -1
- package/dist/resources/native.d.ts +1 -1
- package/dist/resources/normalize.d.ts +1 -1
- package/dist/resources/types.d.ts +2 -0
- package/dist/rpc/inventory.js +1 -12
- package/dist/runtime/env.d.ts +5 -1
- package/dist/runtime/env.js +6 -21
- package/dist/runtime/index.d.ts +8 -5
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/lifecycle.d.ts +6 -4
- package/dist/runtime/lifecycle.js +16 -12
- package/dist/runtime/model-config-utils.js +8 -1
- package/dist/runtime/model-registry.d.ts +30 -4
- package/dist/runtime/model-registry.js +48 -2
- package/dist/runtime/model-work-lock.d.ts +13 -0
- package/dist/runtime/model-work-lock.js +48 -0
- package/dist/runtime/registry-client.d.ts +47 -1
- package/dist/runtime/registry-client.js +446 -88
- package/dist/runtime/request-context.d.ts +11 -3
- package/dist/runtime/request-context.js +39 -2
- package/dist/runtime/request-registry.d.ts +56 -8
- package/dist/runtime/request-registry.js +190 -72
- package/dist/runtime/runtime-lifecycle.js +10 -1
- package/dist/runtime/session-id.d.ts +18 -0
- package/dist/runtime/session-id.js +20 -0
- package/dist/runtime/session-registry.d.ts +39 -0
- package/dist/runtime/session-registry.js +114 -0
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/vector-index-backend.d.ts +6 -2
- package/dist/runtime/vector-index-registry.d.ts +26 -5
- package/dist/runtime/vector-index-registry.js +88 -27
- package/dist/schemas/abort-signal.d.ts +8 -0
- package/dist/schemas/assess-model-fit.d.ts +138 -282
- package/dist/schemas/assess-model-fit.js +85 -219
- package/dist/schemas/audio-gen.d.ts +291 -25
- package/dist/schemas/audio-gen.js +130 -26
- package/dist/schemas/batch-completion-stream.d.ts +113 -15
- package/dist/schemas/batch-completion-stream.js +10 -6
- package/dist/schemas/bci-config.d.ts +3 -1
- package/dist/schemas/bci-config.js +2 -2
- package/dist/schemas/bci.d.ts +55 -4
- package/dist/schemas/bci.js +13 -18
- package/dist/schemas/calc-tokens.d.ts +141 -0
- package/dist/schemas/calc-tokens.js +53 -0
- package/dist/schemas/cancel.d.ts +31 -0
- package/dist/schemas/cancel.js +11 -2
- package/dist/schemas/classification.d.ts +3 -0
- package/dist/schemas/classification.js +6 -2
- package/dist/schemas/common.d.ts +2209 -348
- package/dist/schemas/common.js +52 -33
- package/dist/schemas/completion-event.d.ts +11 -2
- package/dist/schemas/completion-event.js +5 -2
- package/dist/schemas/completion-stream.d.ts +173 -19
- package/dist/schemas/completion-stream.js +117 -20
- package/dist/schemas/config.d.ts +2064 -178
- package/dist/schemas/config.js +21 -23
- package/dist/schemas/decision.d.ts +12 -2
- package/dist/schemas/decision.js +16 -1
- package/dist/schemas/download-asset.d.ts +13 -6
- package/dist/schemas/download-asset.js +4 -7
- package/dist/schemas/embed.d.ts +286 -3
- package/dist/schemas/embed.js +162 -16
- package/dist/schemas/engine-addon-map.d.ts +3 -1
- package/dist/schemas/engine-addon-map.js +5 -3
- package/dist/schemas/errors.d.ts +13 -0
- package/dist/schemas/errors.js +71 -1
- package/dist/schemas/finetune.d.ts +14 -4
- package/dist/schemas/finetune.js +5 -6
- package/dist/schemas/heartbeat.d.ts +1 -0
- package/dist/schemas/heartbeat.js +5 -2
- package/dist/schemas/image-embedding.d.ts +27 -0
- package/dist/schemas/image-embedding.js +107 -0
- package/dist/schemas/index.d.ts +55 -50
- package/dist/schemas/index.js +54 -49
- package/dist/schemas/lifecycle.d.ts +3 -0
- package/dist/schemas/lifecycle.js +13 -6
- package/dist/schemas/llamacpp-config.d.ts +443 -20
- package/dist/schemas/llamacpp-config.js +188 -14
- package/dist/schemas/load-model.d.ts +8940 -1952
- package/dist/schemas/load-model.js +73 -9
- package/dist/schemas/logging-stream.d.ts +1 -0
- package/dist/schemas/logging-stream.js +5 -2
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +731 -111
- package/dist/schemas/model-config-schemas.js +16 -12
- package/dist/schemas/model-fit-policy.d.ts +2 -2
- package/dist/schemas/model-info.d.ts +54 -56
- package/dist/schemas/model-info.js +18 -7
- package/dist/schemas/model-ops.d.ts +12 -0
- package/dist/schemas/model-ops.js +33 -5
- package/dist/schemas/model-src-utils.d.ts +14 -6
- package/dist/schemas/model-src-utils.js +2 -2
- package/dist/schemas/model-types.d.ts +12 -4
- package/dist/schemas/model-types.js +2 -0
- package/dist/schemas/ocr.d.ts +11 -4
- package/dist/schemas/ocr.js +7 -3
- package/dist/schemas/plugin.d.ts +70 -8
- package/dist/schemas/plugin.js +32 -4
- package/dist/schemas/profiling.d.ts +32 -32
- package/dist/schemas/profiling.js +1 -1
- package/dist/schemas/rag.d.ts +9 -0
- package/dist/schemas/rag.js +11 -17
- package/dist/schemas/registry.d.ts +38 -10
- package/dist/schemas/registry.js +16 -7
- package/dist/schemas/reload-config.d.ts +45 -6
- package/dist/schemas/reload-config.js +13 -6
- package/dist/schemas/request-base.d.ts +39 -0
- package/dist/schemas/request-base.js +64 -0
- package/dist/schemas/rerank.d.ts +132 -0
- package/dist/schemas/rerank.js +104 -0
- package/dist/schemas/rpc-server.d.ts +3 -0
- package/dist/schemas/rpc-server.js +15 -15
- package/dist/schemas/sdcpp-config.d.ts +144 -18
- package/dist/schemas/sdcpp-config.js +123 -28
- package/dist/schemas/session.d.ts +37 -0
- package/dist/schemas/session.js +53 -0
- package/dist/schemas/system-resources.d.ts +364 -179
- package/dist/schemas/system-resources.js +8 -3
- package/dist/schemas/text-to-speech.d.ts +1408 -275
- package/dist/schemas/text-to-speech.js +547 -33
- package/dist/schemas/tools.d.ts +7 -0
- package/dist/schemas/tools.js +29 -0
- package/dist/schemas/transcription-config.d.ts +267 -2
- package/dist/schemas/transcription-config.js +138 -7
- package/dist/schemas/transcription.d.ts +94 -7
- package/dist/schemas/transcription.js +99 -22
- package/dist/schemas/translate.d.ts +4 -2
- package/dist/schemas/translate.js +6 -10
- package/dist/schemas/translation-config.d.ts +40 -20
- package/dist/schemas/translation-config.js +1 -1
- package/dist/schemas/tts-pcm.d.ts +35 -0
- package/dist/schemas/tts-pcm.js +69 -0
- package/dist/schemas/vector-index.d.ts +47 -1
- package/dist/schemas/vector-index.js +37 -10
- package/dist/schemas/vla.d.ts +3 -3
- package/dist/surface.d.ts +4 -3
- package/dist/surface.js +4 -3
- package/dist/utils/addon-responses.d.ts +71 -2
- package/dist/utils/aggregate-events.d.ts +1 -1
- package/dist/utils/aggregate-events.js +2 -2
- package/dist/utils/archive.d.ts +7 -0
- package/dist/utils/archive.js +89 -30
- package/dist/utils/asr-events.d.ts +5 -0
- package/dist/utils/asr-events.js +10 -1
- package/dist/utils/audio/decoder.js +3 -1
- package/dist/utils/audio-input.js +1 -1
- package/dist/utils/cache/auto-history.d.ts +2 -1
- package/dist/utils/cache/auto-history.js +5 -3
- package/dist/utils/cache/layout.d.ts +48 -0
- package/dist/utils/cache/layout.js +190 -0
- package/dist/utils/cache/paths.js +8 -10
- package/dist/utils/cache/types.d.ts +2 -1
- package/dist/utils/checksum.d.ts +7 -0
- package/dist/utils/checksum.js +59 -2
- package/dist/utils/completion-normalizer.js +287 -88
- package/dist/utils/gguf-architecture.d.ts +7 -0
- package/dist/utils/gguf-architecture.js +142 -0
- package/dist/utils/gguf-tensor-extractor.d.ts +0 -6
- package/dist/utils/gguf-tensor-extractor.js +1 -50
- package/dist/utils/index.d.ts +13 -13
- package/dist/utils/index.js +13 -13
- package/dist/utils/mcp-adapter.d.ts +1 -1
- package/dist/utils/mcp-adapter.js +1 -1
- package/dist/utils/path-security.js +1 -1
- package/dist/utils/shard-utils.d.ts +0 -16
- package/dist/utils/shard-utils.js +14 -48
- package/dist/utils/tool-integration.d.ts +3 -2
- package/dist/utils/tool-integration.js +3 -6
- package/dist/utils/tools/defer.d.ts +50 -31
- package/dist/utils/tools/defer.js +115 -51
- package/dist/utils/tools/dialect.d.ts +15 -4
- package/dist/utils/tools/dialect.js +34 -5
- package/dist/utils/tools/index.d.ts +3 -3
- package/dist/utils/tools/index.js +3 -3
- package/dist/utils/tools/parser.js +8 -8
- package/dist/utils/tools/parsers/dsml.d.ts +1 -1
- package/dist/utils/tools/parsers/dsml.js +1 -1
- package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
- package/dist/utils/tools/parsers/gemma4native.js +1 -1
- package/dist/utils/tools/parsers/harmony.d.ts +1 -1
- package/dist/utils/tools/parsers/harmony.js +1 -1
- package/dist/utils/tools/parsers/hermes.d.ts +1 -1
- package/dist/utils/tools/parsers/hermes.js +1 -1
- package/dist/utils/tools/parsers/json.d.ts +1 -1
- package/dist/utils/tools/parsers/json.js +1 -1
- package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
- package/dist/utils/tools/parsers/pythonic.js +1 -1
- package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
- package/dist/utils/tools/parsers/qwen35.js +1 -1
- package/dist/utils/transcribe-metadata.d.ts +28 -2
- package/dist/utils/transcribe-metadata.js +16 -0
- package/dist/utils/tts-stats.d.ts +43 -1
- package/dist/utils/tts-stats.js +120 -22
- package/dist/utils/until-aborted.d.ts +7 -0
- package/dist/utils/until-aborted.js +34 -0
- package/package.json +67 -55
- package/dist/models/registry/resource-profiles.d.ts +0 -17
- package/dist/models/registry/resource-profiles.js +0 -5657
- package/dist/resources/model-fit/assess.d.ts +0 -72
- package/dist/resources/model-fit/assess.js +0 -679
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.d.ts +0 -27
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.js +0 -33
- package/dist/resources/model-fit/floor.d.ts +0 -31
- package/dist/resources/model-fit/floor.js +0 -65
- package/dist/resources/model-fit/kv-cache.d.ts +0 -23
- package/dist/resources/model-fit/kv-cache.js +0 -85
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +0 -54
- package/dist/resources/model-fit/native-probe/advisory-fit.js +0 -248
- package/dist/resources/model-fit/native-probe/child-engine-fit.d.ts +0 -2
- package/dist/resources/model-fit/native-probe/child-engine-fit.js +0 -49
- package/dist/resources/model-fit/native-probe/classify-fit.d.ts +0 -6
- package/dist/resources/model-fit/native-probe/classify-fit.js +0 -166
- package/dist/resources/model-fit/native-probe/create-fit-request.d.ts +0 -31
- package/dist/resources/model-fit/native-probe/create-fit-request.js +0 -61
- package/dist/resources/model-fit/native-probe/engine-fit.d.ts +0 -73
- package/dist/resources/model-fit/native-probe/engine-fit.js +0 -13
- package/dist/resources/model-fit/native-probe/engines/asr.d.ts +0 -14
- package/dist/resources/model-fit/native-probe/engines/asr.js +0 -126
- package/dist/resources/model-fit/native-probe/engines/audiogen.d.ts +0 -8
- package/dist/resources/model-fit/native-probe/engines/diffusion.d.ts +0 -7
- package/dist/resources/model-fit/native-probe/engines/diffusion.js +0 -65
- package/dist/resources/model-fit/native-probe/engines/llama.d.ts +0 -12
- package/dist/resources/model-fit/native-probe/engines/llama.js +0 -41
- package/dist/resources/model-fit/native-probe/engines/nmt.d.ts +0 -8
- package/dist/resources/model-fit/native-probe/engines/nmt.js +0 -11
- package/dist/resources/model-fit/native-probe/engines/ocr.d.ts +0 -9
- package/dist/resources/model-fit/native-probe/engines/ocr.js +0 -13
- package/dist/resources/model-fit/native-probe/engines/tts.d.ts +0 -10
- package/dist/resources/model-fit/native-probe/engines/tts.js +0 -152
- package/dist/resources/model-fit/native-probe/fit-outcome.d.ts +0 -16
- package/dist/resources/model-fit/native-probe/fit-process.d.ts +0 -27
- package/dist/resources/model-fit/native-probe/fit-process.js +0 -55
- package/dist/resources/model-fit/native-probe/fit-runner.d.ts +0 -1
- package/dist/resources/model-fit/native-probe/fit-runner.js +0 -58
- package/dist/resources/model-fit/native-probe/run-fit.d.ts +0 -24
- package/dist/resources/model-fit/native-probe/run-fit.js +0 -20
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +0 -24
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +0 -123
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +0 -63
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +0 -377
- package/dist/resources/model-fit/platform.d.ts +0 -9
- package/dist/resources/model-fit/platform.js +0 -26
- package/dist/resources/model-fit/types.d.ts +0 -6
- package/dist/resources/model-fit/types.js +0 -1
- package/dist/schemas/model-resource-profile.d.ts +0 -108
- package/dist/schemas/model-resource-profile.js +0 -80
- /package/dist/{resources/model-fit/native-probe/engines → model-fit}/gpu.d.ts +0 -0
- /package/dist/{resources/model-fit/native-probe/engines → model-fit}/gpu.js +0 -0
- /package/dist/{resources/model-fit/native-probe/fit-outcome.js → schemas/abort-signal.js} +0 -0
|
@@ -4,41 +4,27 @@ import { createStreamLogger, registerAddonLogger, getEngineLogger } from '../../
|
|
|
4
4
|
import { ModelLoadFailedError } from '../../../errors/index.js';
|
|
5
5
|
import { isMobile } from '../../../runtime/state.js';
|
|
6
6
|
import { stripMultiGpuKeys } from '../../../utils/multi-gpu-mobile.js';
|
|
7
|
-
import { diffusion } from '
|
|
8
|
-
import { markLtxVideoModel, markH3VideoModel, markMoeCapableVideoModel, video } from '
|
|
9
|
-
import { upscale } from '
|
|
10
|
-
import { createWorldSession, worldCreateScene, worldScenePath, worldStep } from '
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...(upscaler.threads !== undefined && {
|
|
29
|
-
upscaler_threads: upscaler.threads
|
|
30
|
-
})
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
// `mode: "upscale"` builds an EsrganUpscaler directly (not via SdCtx), so the
|
|
34
|
-
// top-level `device` field has to be forwarded explicitly — it is not part of
|
|
35
|
-
// the `upscaler.*` block.
|
|
36
|
-
function toEsrganAddonConfig(config) {
|
|
37
|
-
return {
|
|
38
|
-
...flattenUpscalerKeys(config.upscaler),
|
|
39
|
-
...(config.device !== undefined && { device: config.device }),
|
|
40
|
-
...(config.verbosity !== undefined && { verbosity: config.verbosity })
|
|
41
|
-
};
|
|
7
|
+
import { diffusion } from '../../../plugins/builtin/sdcpp-generation/ops/diffusion.js';
|
|
8
|
+
import { markLtxVideoModel, markH3VideoModel, markMoeCapableVideoModel, video } from '../../../plugins/builtin/sdcpp-generation/ops/video.js';
|
|
9
|
+
import { upscale } from '../../../plugins/builtin/sdcpp-generation/ops/upscale.js';
|
|
10
|
+
import { createWorldSession, worldCreateScene, worldScenePath, worldStep } from '../../../plugins/builtin/sdcpp-generation/ops/world.js';
|
|
11
|
+
import { sdcppFitRequest } from '../../../plugins/builtin/sdcpp-generation/fit.js';
|
|
12
|
+
import { assertUpscalerResolved, imageConfigFor, imageFilesFor, videoConfigFor, videoFilesFor } from '../../../plugins/builtin/sdcpp-generation/load-files.js';
|
|
13
|
+
import { toEsrganAddonConfig } from '../../../plugins/builtin/sdcpp-generation/upscaler-config.js';
|
|
14
|
+
import { splitWorldConfig } from '../../../plugins/builtin/sdcpp-generation/world-config.js';
|
|
15
|
+
// Wait for op cleanup before emitting completion.
|
|
16
|
+
async function* withCompletionFrame(stream, complete) {
|
|
17
|
+
try {
|
|
18
|
+
let result = await stream.next();
|
|
19
|
+
while (!result.done) {
|
|
20
|
+
yield result.value;
|
|
21
|
+
result = await stream.next();
|
|
22
|
+
}
|
|
23
|
+
yield complete(result.value);
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
await stream.return?.(undefined);
|
|
27
|
+
}
|
|
42
28
|
}
|
|
43
29
|
/**
|
|
44
30
|
* Stable-diffusion.cpp plugin for image diffusion, upscaling, and Wan video.
|
|
@@ -51,8 +37,16 @@ export const diffusionPlugin = definePlugin({
|
|
|
51
37
|
displayName: 'Image Generation & Upscaling (stable-diffusion.cpp)',
|
|
52
38
|
addonPackage: ADDON_DIFFUSION,
|
|
53
39
|
loadConfigSchema: sdcppConfigSchema,
|
|
40
|
+
fitRequest: sdcppFitRequest,
|
|
54
41
|
assessFit: diffusionAssessFit,
|
|
55
42
|
async resolveConfig(cfg, ctx) {
|
|
43
|
+
if (cfg.projectionModelSrc && cfg.mode !== 'diffusion') {
|
|
44
|
+
throw new ModelLoadFailedError('modelConfig.projectionModelSrc requires diffusion mode. ' +
|
|
45
|
+
"Use mode: 'diffusion' or remove projectionModelSrc.");
|
|
46
|
+
}
|
|
47
|
+
if (cfg.projectionModelSrc && !cfg.llmModelSrc) {
|
|
48
|
+
throw new ModelLoadFailedError('modelConfig.projectionModelSrc requires modelConfig.llmModelSrc for the LLM encoder.');
|
|
49
|
+
}
|
|
56
50
|
if (cfg.uncondModelSrc && cfg.mode !== 'diffusion') {
|
|
57
51
|
throw new ModelLoadFailedError('modelConfig.uncondModelSrc is Ideogram 4 diffusion only. ' +
|
|
58
52
|
"Use mode: 'diffusion' or remove uncondModelSrc.");
|
|
@@ -61,6 +55,14 @@ export const diffusionPlugin = definePlugin({
|
|
|
61
55
|
throw new ModelLoadFailedError('modelConfig.uncondModelSrc selects the Ideogram 4 layout and requires ' +
|
|
62
56
|
'modelConfig.llmModelSrc (Qwen3-VL) and modelConfig.vaeModelSrc.');
|
|
63
57
|
}
|
|
58
|
+
if (cfg.tokenizerSrc && cfg.mode !== 'diffusion') {
|
|
59
|
+
throw new ModelLoadFailedError('modelConfig.tokenizerSrc is MOSS-Image diffusion only. ' +
|
|
60
|
+
"Use mode: 'diffusion' or remove tokenizerSrc.");
|
|
61
|
+
}
|
|
62
|
+
if (cfg.tokenizerSrc && (!cfg.llmModelSrc || !cfg.vaeModelSrc)) {
|
|
63
|
+
throw new ModelLoadFailedError('modelConfig.tokenizerSrc selects the MOSS-Image layout and requires ' +
|
|
64
|
+
'modelConfig.llmModelSrc (Qwen3.5) and modelConfig.vaeModelSrc.');
|
|
65
|
+
}
|
|
64
66
|
// A high-noise expert only has somewhere to go in the Wan 2.2 A14B video
|
|
65
67
|
// layout: every other mode builds a model with no second-expert slot, and
|
|
66
68
|
// embeddingsConnectorsModelSrc selects LTX-2 instead. Check it ahead of the
|
|
@@ -149,7 +151,7 @@ export const diffusionPlugin = definePlugin({
|
|
|
149
151
|
if (cfg.mode === 'upscale') {
|
|
150
152
|
return { config: cfg };
|
|
151
153
|
}
|
|
152
|
-
const { clipLModelSrc, clipGModelSrc, clipVisionModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc, highNoiseDiffusionModelSrc, uncondModelSrc, audioVaeModelSrc, embeddingsConnectorsModelSrc, taehvModelSrc, sceneSrc, upscaler, ...rest } = cfg;
|
|
154
|
+
const { clipLModelSrc, clipGModelSrc, clipVisionModelSrc, t5XxlModelSrc, llmModelSrc, projectionModelSrc, vaeModelSrc, highNoiseDiffusionModelSrc, uncondModelSrc, tokenizerSrc, audioVaeModelSrc, embeddingsConnectorsModelSrc, taehvModelSrc, sceneSrc, upscaler, ...rest } = cfg;
|
|
153
155
|
if (embeddingsConnectorsModelSrc && cfg.mode !== 'video') {
|
|
154
156
|
throw new ModelLoadFailedError('modelConfig.embeddingsConnectorsModelSrc selects the LTX-2 video ' +
|
|
155
157
|
"layout and is only valid with mode: 'video'.");
|
|
@@ -189,9 +191,11 @@ export const diffusionPlugin = definePlugin({
|
|
|
189
191
|
clipVisionModelSrc,
|
|
190
192
|
t5XxlModelSrc,
|
|
191
193
|
llmModelSrc,
|
|
194
|
+
projectionModelSrc,
|
|
192
195
|
vaeModelSrc,
|
|
193
196
|
highNoiseDiffusionModelSrc,
|
|
194
197
|
uncondModelSrc,
|
|
198
|
+
tokenizerSrc,
|
|
195
199
|
audioVaeModelSrc,
|
|
196
200
|
embeddingsConnectorsModelSrc,
|
|
197
201
|
esrganModelSrc,
|
|
@@ -203,15 +207,17 @@ export const diffusionPlugin = definePlugin({
|
|
|
203
207
|
return { config: runtimeConfig };
|
|
204
208
|
}
|
|
205
209
|
const resolve = ctx.resolveModelPath;
|
|
206
|
-
const [clipLModelPath, clipGModelPath, clipVisionModelPath, t5XxlModelPath, llmModelPath, vaeModelPath, highNoiseDiffusionModelPath, uncondModelPath, audioVaeModelPath, embeddingsConnectorsModelPath, esrganModelPath, taehvModelPath, seedScenePath] = await Promise.all([
|
|
210
|
+
const [clipLModelPath, clipGModelPath, clipVisionModelPath, t5XxlModelPath, llmModelPath, projectionModelPath, vaeModelPath, highNoiseDiffusionModelPath, uncondModelPath, tokenizerPath, audioVaeModelPath, embeddingsConnectorsModelPath, esrganModelPath, taehvModelPath, seedScenePath] = await Promise.all([
|
|
207
211
|
clipLModelSrc ? resolve(clipLModelSrc) : undefined,
|
|
208
212
|
clipGModelSrc ? resolve(clipGModelSrc) : undefined,
|
|
209
213
|
clipVisionModelSrc ? resolve(clipVisionModelSrc) : undefined,
|
|
210
214
|
t5XxlModelSrc ? resolve(t5XxlModelSrc) : undefined,
|
|
211
215
|
llmModelSrc ? resolve(llmModelSrc) : undefined,
|
|
216
|
+
projectionModelSrc ? resolve(projectionModelSrc) : undefined,
|
|
212
217
|
vaeModelSrc ? resolve(vaeModelSrc) : undefined,
|
|
213
218
|
highNoiseDiffusionModelSrc ? resolve(highNoiseDiffusionModelSrc) : undefined,
|
|
214
219
|
uncondModelSrc ? resolve(uncondModelSrc) : undefined,
|
|
220
|
+
tokenizerSrc ? resolve(tokenizerSrc) : undefined,
|
|
215
221
|
audioVaeModelSrc ? resolve(audioVaeModelSrc) : undefined,
|
|
216
222
|
embeddingsConnectorsModelSrc ? resolve(embeddingsConnectorsModelSrc) : undefined,
|
|
217
223
|
esrganModelSrc ? resolve(esrganModelSrc) : undefined,
|
|
@@ -226,9 +232,11 @@ export const diffusionPlugin = definePlugin({
|
|
|
226
232
|
...(clipVisionModelPath && { clipVisionModelPath }),
|
|
227
233
|
...(t5XxlModelPath && { t5XxlModelPath }),
|
|
228
234
|
...(llmModelPath && { llmModelPath }),
|
|
235
|
+
...(projectionModelPath && { projectionModelPath }),
|
|
229
236
|
...(vaeModelPath && { vaeModelPath }),
|
|
230
237
|
...(highNoiseDiffusionModelPath && { highNoiseDiffusionModelPath }),
|
|
231
238
|
...(uncondModelPath && { uncondModelPath }),
|
|
239
|
+
...(tokenizerPath && { tokenizerPath }),
|
|
232
240
|
...(audioVaeModelPath && { audioVaeModelPath }),
|
|
233
241
|
...(embeddingsConnectorsModelPath && { embeddingsConnectorsModelPath }),
|
|
234
242
|
...(esrganModelPath && { esrganModelPath }),
|
|
@@ -247,19 +255,10 @@ export const diffusionPlugin = definePlugin({
|
|
|
247
255
|
getEngineLogger().warn(`[${ModelType.sdcppGeneration}:${modelId}] Multi-GPU parameters (${stripped.join(', ')}) are not supported on mobile (single-GPU device) — removing from config; model will load with single-GPU defaults`);
|
|
248
256
|
}
|
|
249
257
|
}
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
// logger / native side-effects so callers can recover cleanly.
|
|
255
|
-
if (config.mode === 'diffusion' &&
|
|
256
|
-
config.upscaler !== undefined &&
|
|
257
|
-
!artifacts?.['esrganModelPath']) {
|
|
258
|
-
throw new ModelLoadFailedError('modelConfig.upscaler.model_src is required when modelConfig.upscaler ' +
|
|
259
|
-
'is set in diffusion mode. Provide the ESRGAN model, omit the ' +
|
|
260
|
-
"upscaler block, or switch to modelConfig.mode = 'upscale' to load " +
|
|
261
|
-
'a standalone upscaler.');
|
|
262
|
-
}
|
|
258
|
+
// Reject early with a clear error instead of letting the native addon fail
|
|
259
|
+
// mid-load. Done before any logger / native side-effects so callers can
|
|
260
|
+
// recover cleanly.
|
|
261
|
+
assertUpscalerResolved(config, artifacts);
|
|
263
262
|
const logger = createStreamLogger(modelId, ModelType.sdcppGeneration);
|
|
264
263
|
registerAddonLogger(modelId, ModelType.sdcppGeneration, logger);
|
|
265
264
|
if (config.mode === 'upscale') {
|
|
@@ -287,10 +286,7 @@ export const diffusionPlugin = definePlugin({
|
|
|
287
286
|
taehv: artifacts['taehvModelPath'],
|
|
288
287
|
scene: worldScenePath(modelId)
|
|
289
288
|
},
|
|
290
|
-
|
|
291
|
-
// the schema's `x?: T` into the addon's `x?: T` without it, and the
|
|
292
|
-
// addon already drops undefined values before stringifying them.
|
|
293
|
-
config: (config.world ?? {}),
|
|
289
|
+
config: splitWorldConfig(config.world).session,
|
|
294
290
|
encoders: {
|
|
295
291
|
t5: artifacts['t5XxlModelPath'],
|
|
296
292
|
vae: artifacts['vaeModelPath']
|
|
@@ -301,86 +297,14 @@ export const diffusionPlugin = definePlugin({
|
|
|
301
297
|
return { model };
|
|
302
298
|
}
|
|
303
299
|
if (config.mode === 'video') {
|
|
304
|
-
|
|
305
|
-
// the LTX-2 text-embedding connectors switch to the LTX-2 layout (Gemma
|
|
306
|
-
// via llm + video VAE + connectors, optional audio VAE —
|
|
307
|
-
// `SdModel::isLtxModel_ = !embeddingsConnectorsPath.empty()`); without
|
|
308
|
-
// them, an audio VAE (or an llm with no Wan T5) means MiniMax-H3
|
|
309
|
-
// (llm + video VAE, with an optional audio VAE); everything else is Wan
|
|
310
|
-
// via t5Xxl.
|
|
311
|
-
// Native code verifies the model's tensors.
|
|
312
|
-
const embeddingsConnectorsModelPath = artifacts?.['embeddingsConnectorsModelPath'];
|
|
313
|
-
if (!artifacts?.['vaeModelPath']) {
|
|
314
|
-
throw new ModelLoadFailedError('modelConfig.vaeModelSrc is required in video mode. ' +
|
|
315
|
-
'Provide the Wan, LTX-2 or MiniMax-H3 video VAE before loading the video pipeline.');
|
|
316
|
-
}
|
|
317
|
-
const vaeModelPath = artifacts['vaeModelPath'];
|
|
318
|
-
let files;
|
|
319
|
-
if (embeddingsConnectorsModelPath) {
|
|
320
|
-
if (!artifacts['llmModelPath']) {
|
|
321
|
-
throw new ModelLoadFailedError('modelConfig.llmModelSrc is required for LTX-2 video. ' +
|
|
322
|
-
'Provide the Gemma text encoder model before loading the LTX-2 pipeline.');
|
|
323
|
-
}
|
|
324
|
-
files = {
|
|
325
|
-
model: modelPath,
|
|
326
|
-
vae: vaeModelPath,
|
|
327
|
-
llm: artifacts['llmModelPath'],
|
|
328
|
-
embeddingsConnectors: embeddingsConnectorsModelPath,
|
|
329
|
-
...(artifacts['audioVaeModelPath'] && {
|
|
330
|
-
audioVae: artifacts['audioVaeModelPath']
|
|
331
|
-
}),
|
|
332
|
-
...(artifacts['esrganModelPath'] && { esrgan: artifacts['esrganModelPath'] })
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
else if (artifacts['audioVaeModelPath'] ||
|
|
336
|
-
(artifacts['llmModelPath'] && !artifacts['t5XxlModelPath'])) {
|
|
337
|
-
if (!artifacts['llmModelPath']) {
|
|
338
|
-
throw new ModelLoadFailedError('MiniMax-H3 requires llmModelSrc and vaeModelSrc.');
|
|
339
|
-
}
|
|
340
|
-
if (artifacts['t5XxlModelPath'] ||
|
|
341
|
-
artifacts['highNoiseDiffusionModelPath'] ||
|
|
342
|
-
artifacts['clipVisionModelPath'] ||
|
|
343
|
-
artifacts['clipLModelPath'] ||
|
|
344
|
-
artifacts['clipGModelPath']) {
|
|
345
|
-
throw new ModelLoadFailedError('MiniMax-H3 cannot use Wan T5, high-noise, CLIP-vision or CLIP-L/G companions.');
|
|
346
|
-
}
|
|
347
|
-
files = {
|
|
348
|
-
model: modelPath,
|
|
349
|
-
vae: vaeModelPath,
|
|
350
|
-
llm: artifacts['llmModelPath'],
|
|
351
|
-
...(artifacts['audioVaeModelPath'] && {
|
|
352
|
-
audioVae: artifacts['audioVaeModelPath']
|
|
353
|
-
})
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
if (!artifacts['t5XxlModelPath']) {
|
|
358
|
-
throw new ModelLoadFailedError('modelConfig.t5XxlModelSrc is required in video mode. ' +
|
|
359
|
-
'Provide the Wan text encoder model before loading the video pipeline.');
|
|
360
|
-
}
|
|
361
|
-
files = {
|
|
362
|
-
model: modelPath,
|
|
363
|
-
vae: vaeModelPath,
|
|
364
|
-
t5Xxl: artifacts['t5XxlModelPath'],
|
|
365
|
-
...(artifacts['highNoiseDiffusionModelPath'] && {
|
|
366
|
-
highNoiseDiffusionModel: artifacts['highNoiseDiffusionModelPath']
|
|
367
|
-
}),
|
|
368
|
-
...(artifacts['clipVisionModelPath'] && {
|
|
369
|
-
clipVision: artifacts['clipVisionModelPath']
|
|
370
|
-
}),
|
|
371
|
-
...(artifacts['esrganModelPath'] && { esrgan: artifacts['esrganModelPath'] })
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
375
|
-
const { clipLModelSrc, clipGModelSrc, clipVisionModelSrc, t5XxlModelSrc, llmModelSrc, vaeModelSrc, highNoiseDiffusionModelSrc, uncondModelSrc, audioVaeModelSrc, embeddingsConnectorsModelSrc, upscaler, mode, ...rest } = config;
|
|
376
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
300
|
+
const files = videoFilesFor(modelPath, artifacts);
|
|
377
301
|
const model = new VideoStableDiffusion({
|
|
378
302
|
files,
|
|
379
|
-
config:
|
|
303
|
+
config: videoConfigFor(config),
|
|
380
304
|
logger,
|
|
381
305
|
opts: { stats: true }
|
|
382
306
|
});
|
|
383
|
-
if (
|
|
307
|
+
if (files.embeddingsConnectors)
|
|
384
308
|
markLtxVideoModel(model);
|
|
385
309
|
else if (files.llm)
|
|
386
310
|
markH3VideoModel(model);
|
|
@@ -388,30 +312,9 @@ export const diffusionPlugin = definePlugin({
|
|
|
388
312
|
markMoeCapableVideoModel(model);
|
|
389
313
|
return { model };
|
|
390
314
|
}
|
|
391
|
-
const files = {
|
|
392
|
-
model: modelPath,
|
|
393
|
-
...(artifacts?.['clipLModelPath'] && { clipL: artifacts['clipLModelPath'] }),
|
|
394
|
-
...(artifacts?.['clipGModelPath'] && { clipG: artifacts['clipGModelPath'] }),
|
|
395
|
-
...(artifacts?.['t5XxlModelPath'] && { t5Xxl: artifacts['t5XxlModelPath'] }),
|
|
396
|
-
...(artifacts?.['llmModelPath'] && { llm: artifacts['llmModelPath'] }),
|
|
397
|
-
...(artifacts?.['vaeModelPath'] && { vae: artifacts['vaeModelPath'] }),
|
|
398
|
-
...(artifacts?.['uncondModelPath'] && {
|
|
399
|
-
uncondModel: artifacts['uncondModelPath']
|
|
400
|
-
}),
|
|
401
|
-
...(artifacts?.['esrganModelPath'] && { esrgan: artifacts['esrganModelPath'] })
|
|
402
|
-
};
|
|
403
|
-
// `mode` is consumed by this plugin to select the model class above; the
|
|
404
|
-
// stable-diffusion.cpp native config does not understand it. Strip it
|
|
405
|
-
// before forwarding `rest` to the addon.
|
|
406
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
407
|
-
const { upscaler, mode, ...rest } = config;
|
|
408
|
-
const addonConfig = {
|
|
409
|
-
...rest,
|
|
410
|
-
...flattenUpscalerKeys(upscaler)
|
|
411
|
-
};
|
|
412
315
|
const model = new ImgStableDiffusion({
|
|
413
|
-
files,
|
|
414
|
-
config:
|
|
316
|
+
files: imageFilesFor(modelPath, artifacts),
|
|
317
|
+
config: imageConfigFor(config),
|
|
415
318
|
logger,
|
|
416
319
|
opts: { stats: true }
|
|
417
320
|
});
|
|
@@ -425,14 +328,23 @@ export const diffusionPlugin = definePlugin({
|
|
|
425
328
|
// sdcpp diffusion exposes a model-wide hard cancel — compute
|
|
426
329
|
// is interrupted on the currently-running generation.
|
|
427
330
|
cancel: { scope: 'model', hard: true },
|
|
428
|
-
handler: diffusion
|
|
331
|
+
handler: (request, _inputStream, context) => withCompletionFrame(diffusion(request, context), ({ requestId, stats }) => ({
|
|
332
|
+
type: 'diffusionStream',
|
|
333
|
+
requestId,
|
|
334
|
+
done: true,
|
|
335
|
+
stats
|
|
336
|
+
}))
|
|
429
337
|
}),
|
|
430
338
|
videoStream: defineHandler({
|
|
431
339
|
requestSchema: videoRequestSchema,
|
|
432
340
|
responseSchema: videoStreamResponseSchema,
|
|
433
341
|
streaming: true,
|
|
434
342
|
cancel: { scope: 'model', hard: true },
|
|
435
|
-
handler: video
|
|
343
|
+
handler: (request, _inputStream, context) => withCompletionFrame(video(request, context), ({ stats }) => ({
|
|
344
|
+
type: 'videoStream',
|
|
345
|
+
done: true,
|
|
346
|
+
stats
|
|
347
|
+
}))
|
|
436
348
|
}),
|
|
437
349
|
upscaleStream: defineHandler({
|
|
438
350
|
requestSchema: upscaleRequestSchema,
|
|
@@ -465,7 +377,7 @@ export const diffusionPlugin = definePlugin({
|
|
|
465
377
|
})
|
|
466
378
|
},
|
|
467
379
|
logging: {
|
|
468
|
-
module: () => import('@qvac/diffusion-cpp/addonLogging
|
|
380
|
+
module: () => import('@qvac/diffusion-cpp/addonLogging'),
|
|
469
381
|
namespace: ModelType.sdcppGeneration
|
|
470
382
|
}
|
|
471
383
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SdcppConfig } from '../../../schemas/index.js';
|
|
2
|
+
export declare function flattenUpscalerKeys(upscaler: SdcppConfig['upscaler']): {
|
|
3
|
+
upscaler_threads?: number;
|
|
4
|
+
upscaler_offload_params_to_cpu?: boolean;
|
|
5
|
+
upscaler_direct?: boolean;
|
|
6
|
+
upscaler_tile_size?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function toEsrganAddonConfig(config: SdcppConfig): {
|
|
9
|
+
verbosity?: number;
|
|
10
|
+
device?: "cpu" | "gpu";
|
|
11
|
+
upscaler_threads?: number;
|
|
12
|
+
upscaler_offload_params_to_cpu?: boolean;
|
|
13
|
+
upscaler_direct?: boolean;
|
|
14
|
+
upscaler_tile_size?: number;
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function flattenUpscalerKeys(upscaler) {
|
|
2
|
+
if (!upscaler)
|
|
3
|
+
return {};
|
|
4
|
+
return {
|
|
5
|
+
...(upscaler.tile_size !== undefined && { upscaler_tile_size: upscaler.tile_size }),
|
|
6
|
+
...(upscaler.direct !== undefined && { upscaler_direct: upscaler.direct }),
|
|
7
|
+
...(upscaler.offload_params_to_cpu !== undefined && {
|
|
8
|
+
upscaler_offload_params_to_cpu: upscaler.offload_params_to_cpu
|
|
9
|
+
}),
|
|
10
|
+
...(upscaler.threads !== undefined && { upscaler_threads: upscaler.threads })
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function toEsrganAddonConfig(config) {
|
|
14
|
+
return {
|
|
15
|
+
...flattenUpscalerKeys(config.upscaler),
|
|
16
|
+
...(config.device !== undefined && { device: config.device }),
|
|
17
|
+
...(config.verbosity !== undefined && { verbosity: config.verbosity })
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WorldConfig } from '@qvac/diffusion-cpp/world';
|
|
2
|
+
import type { SdcppConfig } from '../../../schemas/index.js';
|
|
3
|
+
export declare const DEFAULT_WORLD_FIT_STEPS = 100;
|
|
4
|
+
/** `fitSteps` sizes the memory fit only; the native walk session never sees it. */
|
|
5
|
+
export declare function splitWorldConfig(world: SdcppConfig['world']): {
|
|
6
|
+
fitSteps: number;
|
|
7
|
+
session: WorldConfig;
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const DEFAULT_WORLD_FIT_STEPS = 100;
|
|
2
|
+
/** `fitSteps` sizes the memory fit only; the native walk session never sees it. */
|
|
3
|
+
export function splitWorldConfig(world) {
|
|
4
|
+
const { fitSteps = DEFAULT_WORLD_FIT_STEPS, ...session } = world ?? {};
|
|
5
|
+
// Cast rather than rebuild: `exactOptionalPropertyTypes` will not widen the
|
|
6
|
+
// schema's `x?: T` into the addon's `x?: T` without it, and the addon already
|
|
7
|
+
// drops undefined values before stringifying them.
|
|
8
|
+
return { fitSteps, session: session };
|
|
9
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import fs from 'bare-fs';
|
|
2
|
+
import path from 'bare-path';
|
|
3
|
+
import { gpuLayersFromCount } from '../../../model-fit/gpu.js';
|
|
4
|
+
const COSYVOICE_COMPANIONS_MISSING = 'the cosyvoice companion set is not laid out beside the checkpoint';
|
|
5
|
+
/**
|
|
6
|
+
* CosyVoice's companion set co-locates the flow, HiFT and voice GGUFs beside
|
|
7
|
+
* the LLM checkpoint, and the loader finds them by name in that directory. The
|
|
8
|
+
* fitter takes explicit paths, so the same directory is read here.
|
|
9
|
+
*/
|
|
10
|
+
function cosyvoiceRequest(modelPath, common) {
|
|
11
|
+
const dir = path.dirname(modelPath);
|
|
12
|
+
let entries;
|
|
13
|
+
try {
|
|
14
|
+
entries = fs.readdirSync(dir);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return { unknown: COSYVOICE_COMPANIONS_MISSING };
|
|
18
|
+
}
|
|
19
|
+
const companion = (matches) => {
|
|
20
|
+
const found = entries.find(matches);
|
|
21
|
+
return found === undefined ? undefined : path.join(dir, found);
|
|
22
|
+
};
|
|
23
|
+
const flowPath = companion((name) => name.includes('-flow-'));
|
|
24
|
+
const hiftPath = companion((name) => name.includes('-hift-'));
|
|
25
|
+
const voicePath = companion((name) => name === 'voice.gguf');
|
|
26
|
+
if (flowPath === undefined || hiftPath === undefined || voicePath === undefined) {
|
|
27
|
+
return { unknown: COSYVOICE_COMPANIONS_MISSING };
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
request: {
|
|
31
|
+
engineType: 'cosyvoice3',
|
|
32
|
+
cosyvoiceLlmModelPath: modelPath,
|
|
33
|
+
cosyvoiceFlowModelPath: flowPath,
|
|
34
|
+
cosyvoiceHiftModelPath: hiftPath,
|
|
35
|
+
cosyvoiceVoiceModelPath: voicePath,
|
|
36
|
+
...common
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The tts-ggml fit request for a load, built for the voice engine it names. */
|
|
41
|
+
export function ttsFitRequest(load) {
|
|
42
|
+
const config = (load.modelConfig ?? {});
|
|
43
|
+
const artifacts = load.artifacts ?? {};
|
|
44
|
+
const workload = load.ttsWorkload;
|
|
45
|
+
// The enhancer and denoiser load next to the voice, and no fitter sizes them.
|
|
46
|
+
if (artifacts['lavasrEnhancerPath'] !== undefined ||
|
|
47
|
+
artifacts['lavasrDenoiserPath'] !== undefined) {
|
|
48
|
+
return { unknown: 'the LavaSR stages have no fitter' };
|
|
49
|
+
}
|
|
50
|
+
// The explicit backend selector resolves the same device the load would, so
|
|
51
|
+
// the projection lands on that device rather than on the `useGPU` policy's.
|
|
52
|
+
const common = {
|
|
53
|
+
nGpuLayers: gpuLayersFromCount(config.useGPU, config.nGpuLayers),
|
|
54
|
+
...(config.backend !== undefined && { backend: config.backend }),
|
|
55
|
+
...(config.backendsDir !== undefined && { backendsDir: config.backendsDir })
|
|
56
|
+
};
|
|
57
|
+
const request = (fit) => ({ request: fit });
|
|
58
|
+
switch (config.ttsEngine) {
|
|
59
|
+
case 'supertonic':
|
|
60
|
+
// Precision and the f16 weight override change the weight footprint the
|
|
61
|
+
// fitter sizes, so they travel with the request.
|
|
62
|
+
return request({
|
|
63
|
+
engineType: 'supertonic',
|
|
64
|
+
supertonicModelPath: load.modelPath,
|
|
65
|
+
...common,
|
|
66
|
+
...(config.precision !== undefined && { precision: config.precision }),
|
|
67
|
+
...(config.f16Weights !== undefined && { f16Weights: config.f16Weights }),
|
|
68
|
+
...(config.ttsNumInferenceSteps !== undefined && { steps: config.ttsNumInferenceSteps })
|
|
69
|
+
});
|
|
70
|
+
case 'parler':
|
|
71
|
+
// The decoder sidecar policy decides whether the decoder weights load on
|
|
72
|
+
// ggml at all; the fitter matches the load's choice.
|
|
73
|
+
return request({
|
|
74
|
+
engineType: 'parler',
|
|
75
|
+
parlerModelPath: load.modelPath,
|
|
76
|
+
...common,
|
|
77
|
+
...(config.coremlDecoder !== undefined && { coremlDecoder: config.coremlDecoder }),
|
|
78
|
+
...(config.maxFrames !== undefined && { maxFrames: config.maxFrames })
|
|
79
|
+
});
|
|
80
|
+
case 'audio8': {
|
|
81
|
+
const codecDecoderPath = artifacts['audio8CodecDecoderPath'];
|
|
82
|
+
if (codecDecoderPath === undefined) {
|
|
83
|
+
return { unknown: 'the audio8 codec decoder is not resolved' };
|
|
84
|
+
}
|
|
85
|
+
const codecEncoderPath = artifacts['audio8CodecEncoderPath'];
|
|
86
|
+
return request({
|
|
87
|
+
engineType: 'audio8',
|
|
88
|
+
audio8LmPath: load.modelPath,
|
|
89
|
+
audio8CodecDecoderPath: codecDecoderPath,
|
|
90
|
+
...(codecEncoderPath !== undefined && { audio8CodecEncoderPath: codecEncoderPath }),
|
|
91
|
+
...common,
|
|
92
|
+
...(config.maxFrames !== undefined && { maxFrames: config.maxFrames })
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
case 'cosyvoice3':
|
|
96
|
+
return cosyvoiceRequest(load.modelPath, common);
|
|
97
|
+
case 'moss': {
|
|
98
|
+
const decoder = artifacts['mossCodecDecoderPath'];
|
|
99
|
+
const encoder = artifacts['mossCodecEncoderPath'];
|
|
100
|
+
if (decoder === undefined)
|
|
101
|
+
return { unknown: 'the moss codec decoder is not resolved' };
|
|
102
|
+
if (workload === undefined || !('promptRows' in workload)) {
|
|
103
|
+
return {
|
|
104
|
+
unknown: 'a MOSS projection needs a ttsWorkload with promptRows, referenceSamples and streaming'
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (workload.referenceSamples > 0 && encoder === undefined) {
|
|
108
|
+
return { unknown: 'MOSS reference encoding needs the codec encoder' };
|
|
109
|
+
}
|
|
110
|
+
return request({
|
|
111
|
+
engineType: 'moss',
|
|
112
|
+
mossBackbonePath: load.modelPath,
|
|
113
|
+
mossCodecDecoderPath: decoder,
|
|
114
|
+
...(encoder !== undefined && { mossCodecEncoderPath: encoder }),
|
|
115
|
+
...common,
|
|
116
|
+
...workload,
|
|
117
|
+
...(config.threads !== undefined && { threads: config.threads }),
|
|
118
|
+
...(config.streamChunkTokens !== undefined && {
|
|
119
|
+
streamChunkTokens: config.streamChunkTokens
|
|
120
|
+
}),
|
|
121
|
+
...(config.durationTokens !== undefined && { durationTokens: config.durationTokens }),
|
|
122
|
+
// The context and generation budgets size the KV cache and the
|
|
123
|
+
// generation buffers the fitter projects.
|
|
124
|
+
...(config.nCtx !== undefined && { nCtx: config.nCtx }),
|
|
125
|
+
...(config.maxNewTokens !== undefined && { maxNewTokens: config.maxNewTokens })
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
case 'moss-sfx':
|
|
129
|
+
if (workload === undefined || !('prompt' in workload)) {
|
|
130
|
+
return {
|
|
131
|
+
unknown: 'a MOSS-SoundEffect projection needs a ttsWorkload with prompt and seconds'
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return request({
|
|
135
|
+
engineType: 'moss-sfx',
|
|
136
|
+
mossSoundEffectPath: load.modelPath,
|
|
137
|
+
...common,
|
|
138
|
+
...workload,
|
|
139
|
+
...(config.negativePrompt !== undefined && { negativePrompt: config.negativePrompt }),
|
|
140
|
+
...(config.steps !== undefined && { steps: config.steps }),
|
|
141
|
+
...(config.guidance !== undefined && { guidance: config.guidance }),
|
|
142
|
+
...(config.shift !== undefined && { shift: config.shift }),
|
|
143
|
+
...(config.threads !== undefined && { threads: config.threads })
|
|
144
|
+
});
|
|
145
|
+
case 'moss-speech':
|
|
146
|
+
return { unknown: 'MOSS-Speech has no fitter' };
|
|
147
|
+
default: {
|
|
148
|
+
const s3genPath = artifacts['s3genPath'];
|
|
149
|
+
if (s3genPath === undefined) {
|
|
150
|
+
return { unknown: 'the chatterbox s3gen checkpoint is not resolved' };
|
|
151
|
+
}
|
|
152
|
+
return request({
|
|
153
|
+
engineType: 'chatterbox',
|
|
154
|
+
t3ModelPath: load.modelPath,
|
|
155
|
+
s3genModelPath: s3genPath,
|
|
156
|
+
...common,
|
|
157
|
+
...(config.nCtx !== undefined && config.nCtx > 0 && { nCtx: config.nCtx }),
|
|
158
|
+
...(config.kvCacheType !== undefined && { kvCacheType: config.kvCacheType })
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PluginHandlerContext } from '../../../../schemas/plugin.js';
|
|
1
2
|
import type { AbortSignal } from 'bare-abort-controller';
|
|
2
3
|
/**
|
|
3
4
|
* The abort is persistent state, not a one-shot poke. The addon's `cancel()`
|
|
@@ -26,4 +27,4 @@ export declare function cancelIfAborted(model: unknown, signal: AbortSignal): Pr
|
|
|
26
27
|
* never owned the model slot, so cancelling then would interrupt the run that
|
|
27
28
|
* does.
|
|
28
29
|
*/
|
|
29
|
-
export declare function bindTtsCancel(model: unknown, modelId: string, requestId?: string): Promise<import("../../../../runtime/index.js").ManagedRequestContext>;
|
|
30
|
+
export declare function bindTtsCancel(model: unknown, modelId: string, requestId?: string, sessionId?: string, context?: PluginHandlerContext): Promise<import("../../../../runtime/index.js").ManagedRequestContext>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { requestParent } from '../../../../schemas/plugin.js';
|
|
1
2
|
import { getEngineLogger } from '../../../../logging/index.js';
|
|
2
3
|
import { getRequestRegistry, withRequestContext } from '../../../../runtime/index.js';
|
|
3
4
|
import { generateRequestId } from '../../../../runtime/request-id.js';
|
|
@@ -36,9 +37,11 @@ export async function cancelIfAborted(model, signal) {
|
|
|
36
37
|
* never owned the model slot, so cancelling then would interrupt the run that
|
|
37
38
|
* does.
|
|
38
39
|
*/
|
|
39
|
-
export async function bindTtsCancel(model, modelId, requestId) {
|
|
40
|
+
export async function bindTtsCancel(model, modelId, requestId, sessionId, context) {
|
|
40
41
|
const ctx = await getRequestRegistry().begin({
|
|
41
42
|
requestId: requestId ?? generateRequestId(),
|
|
43
|
+
sessionId,
|
|
44
|
+
...requestParent(context),
|
|
42
45
|
kind: 'tts',
|
|
43
46
|
modelId
|
|
44
47
|
});
|
|
@@ -15,7 +15,7 @@ export declare function getMossJobOptions(model: unknown, request: TtsRequest):
|
|
|
15
15
|
sampleRate?: number;
|
|
16
16
|
audio?: Float32Array<ArrayBuffer>;
|
|
17
17
|
text?: string;
|
|
18
|
-
role: "
|
|
18
|
+
role: "system" | "assistant" | "user";
|
|
19
19
|
}[];
|
|
20
20
|
sampleRate?: number;
|
|
21
21
|
audio?: Float32Array<ArrayBuffer>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { PluginHandlerContext } from '../../../../schemas/plugin.js';
|
|
1
2
|
import { type TextToSpeechStreamRequest } from '../../../../schemas/index.js';
|
|
2
3
|
import Buffer from 'bare-buffer';
|
|
3
4
|
import { type TtsOpYield } from '../../../../utils/tts-stats.js';
|
|
4
|
-
import type { TtsOpResult } from '
|
|
5
|
-
export declare function textToSpeechStream(params: TextToSpeechStreamRequest, inputStream: AsyncIterable<Buffer
|
|
5
|
+
import type { TtsOpResult } from '../../../../plugins/builtin/tts-ggml/ops/text-to-speech.js';
|
|
6
|
+
export declare function textToSpeechStream(params: TextToSpeechStreamRequest, inputStream: AsyncIterable<Buffer>, context?: PluginHandlerContext): AsyncGenerator<TtsOpYield, TtsOpResult, unknown>;
|