@qvac/inference 0.20.1 → 0.21.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 +90 -24
- package/README.md +8 -5
- package/dist/api/bci-transcribe.d.ts +4 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/rpc-server.d.ts +19 -0
- package/dist/api/rpc-server.js +44 -0
- package/dist/api/text-to-speech.d.ts +9 -0
- package/dist/api/text-to-speech.js +9 -0
- package/dist/api/transcribe.d.ts +11 -7
- package/dist/api/transcribe.js +47 -15
- package/dist/api/video-request.d.ts +5 -5
- package/dist/dispatch.js +39 -7
- package/dist/errors/index.d.ts +7 -0
- package/dist/errors/index.js +15 -0
- package/dist/handlers/assess-model-fit.d.ts +8 -20
- package/dist/handlers/assess-model-fit.js +195 -77
- package/dist/handlers/completion-orchestrate.js +17 -0
- package/dist/handlers/get-loaded-model-info.js +4 -1
- package/dist/handlers/get-model-info.js +29 -1
- package/dist/handlers/load-model/coreml-sidecars.d.ts +25 -0
- package/dist/handlers/load-model/coreml-sidecars.js +274 -0
- package/dist/handlers/load-model/hyperdrive.js +2 -2
- package/dist/handlers/load-model/registry.js +59 -0
- package/dist/handlers/rpc-server.d.ts +23 -0
- package/dist/handlers/rpc-server.js +141 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/models/registry/models.d.ts +7731 -5672
- package/dist/models/registry/models.js +4652 -2526
- package/dist/models/registry/resource-profiles.js +481 -94
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +8 -6
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +2 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +73 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +37 -19
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +1 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +9 -5
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +1 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +16 -7
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +22 -11
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +9 -3
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +5 -3
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +2 -1
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +121 -0
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +56 -27
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +8 -2
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +7 -2
- package/dist/plugins/builtin/tts-ggml/ops/parler-options.d.ts +2 -0
- package/dist/plugins/builtin/tts-ggml/ops/parler-options.js +5 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +27 -10
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +181 -0
- package/dist/plugins/builtin/tts-ggml/plugin.js +84 -2
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +136 -0
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +18 -7
- package/dist/plugins/ops/bci-transcribe.d.ts +6 -2
- package/dist/plugins/ops/bci-transcribe.js +18 -13
- package/dist/plugins/ops/load-model.js +2 -2
- package/dist/plugins/ops/transcribe.d.ts +4 -2
- package/dist/plugins/ops/transcribe.js +39 -2
- package/dist/plugins/ops/translate-stats.d.ts +2 -1
- package/dist/plugins/ops/translate-stats.js +64 -7
- package/dist/plugins/ops/translate.js +20 -4
- package/dist/profiling/operation-metrics.js +56 -0
- package/dist/registry.js +4 -0
- package/dist/resources/model-fit/assess.d.ts +37 -2
- package/dist/resources/model-fit/assess.js +24 -3
- package/dist/resources/model-fit/estimators/llm.js +2 -2
- package/dist/resources/model-fit/estimators/whisper.js +3 -4
- package/dist/resources/model-fit/fit-stub/fetch-fit-stub.d.ts +20 -1
- package/dist/resources/model-fit/fit-stub/fetch-fit-stub.js +126 -47
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.d.ts +27 -0
- package/dist/resources/model-fit/fit-stub/project-fit-from-load.js +31 -0
- package/dist/resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts +38 -0
- package/dist/resources/model-fit/fit-stub/resolve-load-from-stubs.js +138 -0
- package/dist/resources/model-fit/floor.js +2 -2
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +9 -6
- package/dist/resources/model-fit/native-probe/advisory-fit.js +129 -80
- package/dist/resources/model-fit/native-probe/child-engine-fit.d.ts +2 -0
- package/dist/resources/model-fit/native-probe/child-engine-fit.js +41 -0
- package/dist/resources/model-fit/native-probe/classify-fit.d.ts +6 -0
- package/dist/resources/model-fit/native-probe/classify-fit.js +135 -0
- package/dist/resources/model-fit/native-probe/create-fit-request.d.ts +28 -0
- package/dist/resources/model-fit/native-probe/create-fit-request.js +51 -0
- package/dist/resources/model-fit/native-probe/engine-fit.d.ts +59 -0
- package/dist/resources/model-fit/native-probe/engine-fit.js +13 -0
- package/dist/resources/model-fit/native-probe/engines/asr.d.ts +10 -0
- package/dist/resources/model-fit/native-probe/engines/asr.js +103 -0
- package/dist/resources/model-fit/native-probe/engines/audiogen.d.ts +8 -0
- package/dist/resources/model-fit/native-probe/engines/audiogen.js +35 -0
- package/dist/resources/model-fit/native-probe/engines/diffusion.d.ts +7 -0
- package/dist/resources/model-fit/native-probe/engines/diffusion.js +55 -0
- package/dist/resources/model-fit/native-probe/engines/gpu.d.ts +10 -0
- package/dist/resources/model-fit/native-probe/engines/gpu.js +21 -0
- package/dist/resources/model-fit/native-probe/engines/llama.d.ts +13 -0
- package/dist/resources/model-fit/native-probe/engines/llama.js +145 -0
- package/dist/resources/model-fit/native-probe/engines/tts.d.ts +8 -0
- package/dist/resources/model-fit/native-probe/engines/tts.js +106 -0
- package/dist/resources/model-fit/native-probe/fit-outcome.d.ts +16 -0
- package/dist/resources/model-fit/native-probe/fit-outcome.js +1 -0
- package/dist/resources/model-fit/native-probe/fit-process.d.ts +27 -0
- package/dist/resources/model-fit/native-probe/fit-process.js +55 -0
- package/dist/resources/model-fit/native-probe/fit-runner.d.ts +1 -0
- package/dist/resources/model-fit/native-probe/fit-runner.js +58 -0
- package/dist/resources/model-fit/native-probe/run-fit.d.ts +24 -0
- package/dist/resources/model-fit/native-probe/run-fit.js +20 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +14 -34
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +55 -139
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +5 -12
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +13 -8
- package/dist/resources/model-fit/platform.d.ts +9 -0
- package/dist/resources/model-fit/platform.js +28 -0
- package/dist/rpc/device-map.d.ts +13 -0
- package/dist/rpc/device-map.js +22 -0
- package/dist/rpc/discovery.d.ts +12 -0
- package/dist/rpc/discovery.js +225 -0
- package/dist/rpc/ggml-provider.d.ts +4 -0
- package/dist/rpc/ggml-provider.js +25 -0
- package/dist/rpc/index.d.ts +2 -0
- package/dist/rpc/index.js +1 -0
- package/dist/rpc/instance.d.ts +6 -0
- package/dist/rpc/instance.js +21 -0
- package/dist/rpc/inventory.d.ts +5 -0
- package/dist/rpc/inventory.js +144 -0
- package/dist/rpc/manager.d.ts +14 -0
- package/dist/rpc/manager.js +174 -0
- package/dist/rpc/network.d.ts +11 -0
- package/dist/rpc/network.js +85 -0
- package/dist/rpc/provider.d.ts +6 -0
- package/dist/rpc/provider.js +24 -0
- package/dist/runtime/lifecycle.js +31 -13
- package/dist/runtime/request-context.d.ts +1 -1
- package/dist/runtime/state.js +5 -0
- package/dist/schemas/assess-model-fit.d.ts +269 -85
- package/dist/schemas/assess-model-fit.js +78 -54
- package/dist/schemas/audio-gen.d.ts +6 -6
- package/dist/schemas/audio-gen.js +2 -2
- package/dist/schemas/batch-completion-stream.d.ts +13 -5
- package/dist/schemas/batch-completion-stream.js +5 -3
- package/dist/schemas/bci-config.js +1 -1
- package/dist/schemas/bci.d.ts +86 -1
- package/dist/schemas/bci.js +21 -2
- package/dist/schemas/cancel.d.ts +10 -0
- package/dist/schemas/cancel.js +2 -0
- package/dist/schemas/common.d.ts +708 -66
- package/dist/schemas/common.js +7 -0
- package/dist/schemas/completion-event.d.ts +6 -6
- package/dist/schemas/completion-stream.d.ts +27 -8
- package/dist/schemas/completion-stream.js +41 -4
- package/dist/schemas/config.d.ts +104 -36
- package/dist/schemas/config.js +10 -0
- package/dist/schemas/embed.d.ts +2 -2
- package/dist/schemas/error.js +13 -0
- package/dist/schemas/errors.d.ts +1 -0
- package/dist/schemas/errors.js +5 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/llamacpp-config.d.ts +25 -18
- package/dist/schemas/llamacpp-config.js +26 -16
- package/dist/schemas/load-model.d.ts +2608 -469
- package/dist/schemas/load-model.js +2 -2
- package/dist/schemas/mcp-adapter.d.ts +4 -0
- package/dist/schemas/model-config-schemas.d.ts +183 -6
- package/dist/schemas/model-info.d.ts +56 -0
- package/dist/schemas/model-info.js +5 -1
- package/dist/schemas/plugin.d.ts +8 -2
- package/dist/schemas/profiling.d.ts +4 -4
- package/dist/schemas/reload-config.d.ts +30 -0
- package/dist/schemas/rpc-server.d.ts +101 -0
- package/dist/schemas/rpc-server.js +87 -0
- package/dist/schemas/sdcpp-config.d.ts +7 -3
- package/dist/schemas/sdcpp-config.js +37 -2
- package/dist/schemas/system-resources.d.ts +4 -4
- package/dist/schemas/text-to-speech.d.ts +529 -1
- package/dist/schemas/text-to-speech.js +122 -12
- package/dist/schemas/tools.d.ts +2 -0
- package/dist/schemas/tools.js +8 -0
- package/dist/schemas/transcription-config.d.ts +5 -0
- package/dist/schemas/transcription-config.js +20 -2
- package/dist/schemas/transcription.d.ts +164 -0
- package/dist/schemas/transcription.js +71 -4
- package/dist/schemas/vla.d.ts +1 -1
- package/dist/surface.d.ts +4 -1
- package/dist/surface.js +3 -1
- package/dist/utils/addon-responses.d.ts +5 -1
- package/dist/utils/archive.js +5 -1
- package/dist/utils/asr-diagnostics.d.ts +12 -0
- package/dist/utils/asr-diagnostics.js +42 -0
- package/dist/utils/asr-events.d.ts +1 -0
- package/dist/utils/asr-events.js +3 -2
- package/dist/utils/cache/paths.js +3 -2
- package/dist/utils/mcp-adapter.js +7 -1
- package/dist/utils/multi-gpu-mobile.d.ts +1 -1
- package/dist/utils/multi-gpu-mobile.js +8 -6
- package/dist/utils/path-security.d.ts +5 -0
- package/dist/utils/path-security.js +14 -0
- package/dist/utils/tool-helpers.d.ts +4 -0
- package/dist/utils/tool-helpers.js +2 -0
- package/dist/utils/tools/defer.d.ts +93 -0
- package/dist/utils/tools/defer.js +290 -0
- package/dist/utils/tools/index.d.ts +1 -0
- package/dist/utils/tools/index.js +1 -0
- package/dist/utils/transcribe-metadata.d.ts +21 -7
- package/dist/utils/transcribe-metadata.js +24 -8
- package/dist/utils/tts-stats.d.ts +6 -0
- package/dist/utils/tts-stats.js +14 -1
- package/package.json +43 -29
- package/dist/resources/model-fit/fit-stub/index.d.ts +0 -2
- package/dist/resources/model-fit/fit-stub/index.js +0 -2
- package/dist/resources/model-fit/fit-stub/project-fit-from-stub.d.ts +0 -31
- package/dist/resources/model-fit/fit-stub/project-fit-from-stub.js +0 -36
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.d.ts +0 -26
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.js +0 -191
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { FitLlamaProcessConfig, LlamaLoadKind } from '@qvac/model-fit/process';
|
|
2
|
-
import { type CanonicalModelType } from '../../../schemas/index.js';
|
|
3
|
-
export type LlamaFitRequestPlan = {
|
|
4
|
-
supported: true;
|
|
5
|
-
loadKind: LlamaLoadKind;
|
|
6
|
-
config: FitLlamaProcessConfig;
|
|
7
|
-
} | {
|
|
8
|
-
supported: false;
|
|
9
|
-
detail: string;
|
|
10
|
-
};
|
|
11
|
-
export interface CreateLlamaFitRequestParams {
|
|
12
|
-
modelType: CanonicalModelType;
|
|
13
|
-
modelPath: string;
|
|
14
|
-
modelConfig: unknown;
|
|
15
|
-
artifacts?: Record<string, string> | undefined;
|
|
16
|
-
isShardedModel: boolean;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Builds a protocol-v2 fit request from the same resolved model config the real
|
|
20
|
-
* load is about to use, or explains why this load cannot be answered for.
|
|
21
|
-
*
|
|
22
|
-
* Structural shapes the SDK owns are refused here so the fitter is not asked
|
|
23
|
-
* a question it cannot answer. Value-level policy (device names, symbolic GPU
|
|
24
|
-
* selection, context bounds) stays inside `@qvac/model-fit`.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createLlamaFitRequest(params: CreateLlamaFitRequestParams): LlamaFitRequestPlan;
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { ModelType } from '../../../schemas/index.js';
|
|
2
|
-
import { transformLlmConfig } from '../../../plugins/builtin/llamacpp-completion/transform.js';
|
|
3
|
-
import { transformEmbedConfig } from '../../../plugins/builtin/llamacpp-embedding/transform.js';
|
|
4
|
-
/**
|
|
5
|
-
* Keys forwarded to model-fit, in the spelling the SDK's completion and
|
|
6
|
-
* embedding transforms emit. model-fit canonicalizes `_` to `-`, so `ctx_size`
|
|
7
|
-
* and `ctx-size` reach the same native setting.
|
|
8
|
-
*
|
|
9
|
-
* A key belongs here when it could change a load's device-memory footprint.
|
|
10
|
-
*
|
|
11
|
-
* model-fit answers unsupported for a key it does not recognize, and the
|
|
12
|
-
* advisory then reports unknown for every load that sets it. A key added here
|
|
13
|
-
* stays in that state until model-fit learns it.
|
|
14
|
-
*/
|
|
15
|
-
// NOTE: adding a key here needs a follow-up in model-fit to recognize it and
|
|
16
|
-
// account for it in the projection. Until that lands, every load setting the
|
|
17
|
-
// key gets no fit verdict.
|
|
18
|
-
const FIT_LOAD_KEYS = {
|
|
19
|
-
completion: [
|
|
20
|
-
'device',
|
|
21
|
-
'ctx_size',
|
|
22
|
-
'gpu_layers',
|
|
23
|
-
'load_mode',
|
|
24
|
-
'parallel',
|
|
25
|
-
'cache-type-k',
|
|
26
|
-
'cache-type-v',
|
|
27
|
-
'flash-attn',
|
|
28
|
-
'main-gpu',
|
|
29
|
-
'split-mode',
|
|
30
|
-
'tensor-split',
|
|
31
|
-
'batch-size',
|
|
32
|
-
'ubatch-size',
|
|
33
|
-
'cpu-moe',
|
|
34
|
-
'n-cpu-moe',
|
|
35
|
-
'n-cpu-ffn',
|
|
36
|
-
'override-tensor',
|
|
37
|
-
'moe-cache-mib',
|
|
38
|
-
'kv-offload',
|
|
39
|
-
'no-kv-offload',
|
|
40
|
-
'prefetch-weights',
|
|
41
|
-
'tensor-read-lazy',
|
|
42
|
-
'fit',
|
|
43
|
-
'fit-target',
|
|
44
|
-
'fit-ctx',
|
|
45
|
-
'image-max-tokens',
|
|
46
|
-
'image-min-tokens'
|
|
47
|
-
],
|
|
48
|
-
embedding: [
|
|
49
|
-
'device',
|
|
50
|
-
'gpu_layers',
|
|
51
|
-
'batch_size',
|
|
52
|
-
'flash_attn',
|
|
53
|
-
'main-gpu',
|
|
54
|
-
'split-mode',
|
|
55
|
-
'tensor-split'
|
|
56
|
-
]
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Keys withheld from model-fit — sampling, generation, logging, CPU scheduling
|
|
60
|
-
* and JS-side presentation settings. A key belongs here when it cannot change
|
|
61
|
-
* a load's device-memory footprint, so withholding it leaves the verdict
|
|
62
|
-
* intact.
|
|
63
|
-
*/
|
|
64
|
-
const NON_FIT_KEYS = {
|
|
65
|
-
completion: [
|
|
66
|
-
'temp',
|
|
67
|
-
'top_p',
|
|
68
|
-
'top_k',
|
|
69
|
-
'seed',
|
|
70
|
-
'predict',
|
|
71
|
-
'presence_penalty',
|
|
72
|
-
'frequency_penalty',
|
|
73
|
-
'repeat_penalty',
|
|
74
|
-
'reverse_prompt',
|
|
75
|
-
'n_discarded',
|
|
76
|
-
'tools',
|
|
77
|
-
'verbosity',
|
|
78
|
-
'reasoning_budget',
|
|
79
|
-
'image_tile_mode',
|
|
80
|
-
'image_no_upscale',
|
|
81
|
-
'mmproj-use-gpu',
|
|
82
|
-
'openclCacheDir',
|
|
83
|
-
'threads',
|
|
84
|
-
'threads-batch',
|
|
85
|
-
'cpu-mask',
|
|
86
|
-
'cpu-mask-batch'
|
|
87
|
-
],
|
|
88
|
-
embedding: ['pooling', 'attention', 'embd_normalize', 'verbosity', 'openclCacheDir']
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Load-config keys that describe a shape the fitter cannot answer for.
|
|
92
|
-
* `projection_model_src` reaches here when the config still carries the
|
|
93
|
-
* unresolved source, ahead of the resolved-artifact refusal below.
|
|
94
|
-
*/
|
|
95
|
-
const UNSUPPORTED_KEYS = ['lora', 'projection_model_src'];
|
|
96
|
-
/**
|
|
97
|
-
* A CPU load's weights stay file-backed and evictable, so the fitter projects
|
|
98
|
-
* `fits` for nearly any model the OS could page through. Measured on a 24 GiB
|
|
99
|
-
* M4 Pro against `@qvac/model-fit@0.8.0`: an 18.3 GiB model at 32k context
|
|
100
|
-
* still reports `fits` on `device: 'cpu'` (and it does decode — at 0.1 tok/s).
|
|
101
|
-
* That answer carries no admission information, so it is refused here rather
|
|
102
|
-
* than spending a fit call to produce it.
|
|
103
|
-
*/
|
|
104
|
-
function isCpuLoad(params) {
|
|
105
|
-
return params['device']?.toLowerCase() === 'cpu';
|
|
106
|
-
}
|
|
107
|
-
function loadKindFor(modelType) {
|
|
108
|
-
if (modelType === ModelType.llamacppCompletion)
|
|
109
|
-
return 'completion';
|
|
110
|
-
if (modelType === ModelType.llamacppEmbedding)
|
|
111
|
-
return 'embedding';
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
function unsupported(detail) {
|
|
115
|
-
return { supported: false, detail };
|
|
116
|
-
}
|
|
117
|
-
function partitionParams(loadKind, transformed) {
|
|
118
|
-
const forwarded = new Set(FIT_LOAD_KEYS[loadKind]);
|
|
119
|
-
const dropped = new Set(NON_FIT_KEYS[loadKind]);
|
|
120
|
-
const params = {};
|
|
121
|
-
for (const [key, value] of Object.entries(transformed)) {
|
|
122
|
-
if (UNSUPPORTED_KEYS.includes(key)) {
|
|
123
|
-
return { detail: `unsupported load setting: ${key}` };
|
|
124
|
-
}
|
|
125
|
-
if (forwarded.has(key)) {
|
|
126
|
-
params[key] = value;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (dropped.has(key))
|
|
130
|
-
continue;
|
|
131
|
-
// In neither list, so its effect on the projection is unknown.
|
|
132
|
-
return { detail: `unclassified load setting: ${key}` };
|
|
133
|
-
}
|
|
134
|
-
return { params };
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Pins the requested context so the fitter reports on the exact load the SDK
|
|
138
|
-
* is about to run. Left unset for an auto context (`0`, "use the model's
|
|
139
|
-
* trained context"), where the package's own floor applies and the fitter
|
|
140
|
-
* stays free to reduce.
|
|
141
|
-
*/
|
|
142
|
-
function contextFloor(params) {
|
|
143
|
-
const ctxSize = params['ctx_size'];
|
|
144
|
-
if (ctxSize === undefined)
|
|
145
|
-
return undefined;
|
|
146
|
-
const parsed = Number(ctxSize);
|
|
147
|
-
if (!Number.isSafeInteger(parsed) || parsed <= 0)
|
|
148
|
-
return undefined;
|
|
149
|
-
return parsed;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Builds a protocol-v2 fit request from the same resolved model config the real
|
|
153
|
-
* load is about to use, or explains why this load cannot be answered for.
|
|
154
|
-
*
|
|
155
|
-
* Structural shapes the SDK owns are refused here so the fitter is not asked
|
|
156
|
-
* a question it cannot answer. Value-level policy (device names, symbolic GPU
|
|
157
|
-
* selection, context bounds) stays inside `@qvac/model-fit`.
|
|
158
|
-
*/
|
|
159
|
-
export function createLlamaFitRequest(params) {
|
|
160
|
-
const loadKind = loadKindFor(params.modelType);
|
|
161
|
-
if (loadKind === undefined) {
|
|
162
|
-
return unsupported(`model type is not a llama.cpp load: ${params.modelType}`);
|
|
163
|
-
}
|
|
164
|
-
if (params.isShardedModel) {
|
|
165
|
-
return unsupported('sharded models are not representable');
|
|
166
|
-
}
|
|
167
|
-
if (loadKind === 'completion' && params.artifacts?.['projectionModelPath'] !== undefined) {
|
|
168
|
-
return unsupported('multimodal projection loads are not representable');
|
|
169
|
-
}
|
|
170
|
-
const modelConfig = (params.modelConfig ?? {});
|
|
171
|
-
const transformed = loadKind === 'completion'
|
|
172
|
-
? transformLlmConfig(modelConfig)
|
|
173
|
-
: transformEmbedConfig(modelConfig);
|
|
174
|
-
const partitioned = partitionParams(loadKind, transformed);
|
|
175
|
-
if ('detail' in partitioned)
|
|
176
|
-
return unsupported(partitioned.detail);
|
|
177
|
-
if (isCpuLoad(partitioned.params)) {
|
|
178
|
-
return unsupported('cpu loads carry no device-memory evidence');
|
|
179
|
-
}
|
|
180
|
-
const nCtxMin = contextFloor(partitioned.params);
|
|
181
|
-
return {
|
|
182
|
-
supported: true,
|
|
183
|
-
loadKind,
|
|
184
|
-
config: {
|
|
185
|
-
// Sharded loads are refused above, so the resolved path is the whole model.
|
|
186
|
-
modelPath: params.modelPath,
|
|
187
|
-
params: partitioned.params,
|
|
188
|
-
...(nCtxMin !== undefined && { nCtxMin })
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
}
|