doppler-gpu 0.2.0 → 0.2.2
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/CHANGELOG.md +29 -1
- package/README.md +97 -29
- package/package.json +40 -27
- package/src/cli/config/doppler-quickstart.json +10 -0
- package/src/cli/doppler-cli.js +66 -22
- package/src/cli/doppler-quickstart.d.ts +61 -0
- package/src/cli/doppler-quickstart.js +299 -0
- package/src/cli/doppler-serve.js +395 -0
- package/src/client/doppler-api.browser.js +13 -377
- package/src/client/doppler-api.d.ts +35 -56
- package/src/client/doppler-api.js +12 -363
- package/src/client/doppler-registry.json +55 -2
- package/src/client/runtime/index.d.ts +63 -0
- package/src/client/runtime/index.js +173 -0
- package/src/client/runtime/lora.d.ts +36 -0
- package/src/client/runtime/lora.js +165 -0
- package/src/client/{doppler-provider → runtime}/model-manager.d.ts +1 -1
- package/src/client/{doppler-provider → runtime}/model-manager.js +56 -30
- package/src/client/runtime/model-session.d.ts +72 -0
- package/src/client/runtime/model-session.js +122 -0
- package/src/client/runtime/model-source.d.ts +43 -0
- package/src/client/runtime/model-source.js +101 -0
- package/src/client/{doppler-provider → runtime}/source-runtime.d.ts +8 -5
- package/src/client/runtime/source-runtime.js +919 -0
- package/src/client/runtime/storage.d.ts +5 -0
- package/src/client/runtime/storage.js +51 -0
- package/src/client/{doppler-provider → runtime}/types.d.ts +14 -2
- package/src/config/README.md +2 -0
- package/src/config/conversion/README.md +47 -7
- package/src/config/conversion/embeddinggemma/google-embeddinggemma-300m-q4k-ehf16-af32.json +67 -5
- package/src/config/conversion/gemma3/gemma-3-1b-it-f16-af32.json +62 -11
- package/src/config/conversion/gemma3/gemma-3-1b-it-q4k-ehf16-af32.json +79 -18
- package/src/config/conversion/gemma3/gemma-3-270m-it-q4k-ehf16-af32.json +61 -13
- package/src/config/conversion/gemma3/translategemma-4b-1b-enes-q4k-ehf16-af32.json +53 -10
- package/src/config/conversion/gemma3/translategemma-4b-it-q4k-ehf16-af32.json +66 -18
- package/src/config/conversion/gemma4/gemma-4-e2b-it-q4k-ehf16-af32.json +256 -0
- package/src/config/conversion/gemma4/gemma-4-moe-q4k-ehf16-af32.json +49 -8
- package/src/config/conversion/gpt-oss-20b-f16-xmxfp4.json +45 -6
- package/src/config/conversion/janus/janus-pro-1b-text-q4k-ehaf16.json +45 -6
- package/src/config/conversion/lfm2/lfm2.5-1.2b-instruct-q4k-ehf16-af32.json +57 -9
- package/src/config/conversion/qwen3/qwen-3-5-0-8b-q4k-ehaf16.json +105 -26
- package/src/config/conversion/qwen3/qwen-3-5-2b-q4k-ehaf16.json +83 -33
- package/src/config/conversion/sana/sana-sprint-0.6b-f16.json +33 -5
- package/src/config/execution-contract-check.d.ts +2 -1
- package/src/config/execution-contract-check.js +187 -53
- package/src/config/kernel-path-loader.d.ts +36 -0
- package/src/config/kernel-path-loader.js +97 -10
- package/src/config/kernels/kernel-ref-digests.js +40 -24
- package/src/config/kernels/registry.js +0 -1
- package/src/config/kernels/registry.json +772 -66
- package/src/config/merge-contract-check.js +3 -0
- package/src/config/merge.d.ts +18 -1
- package/src/config/merge.js +56 -0
- package/src/config/param-categories.js +5 -0
- package/src/config/param-validator.js +42 -26
- package/src/config/platforms/apple-m3.json +1 -1
- package/src/config/platforms/loader.js +21 -16
- package/src/config/required-inference-fields-contract-check.js +16 -0
- package/src/config/runtime/compute/f16-batched.json +2 -0
- package/src/config/runtime/default.json +1 -0
- package/src/config/runtime/experiments/bench/gemma3-bench-q4k-alt.json +57 -0
- package/src/config/runtime/experiments/bench/gemma3-bench-q4k-batched.json +57 -0
- package/src/config/runtime/experiments/bench/gemma3-bench-q4k.json +2 -0
- package/src/config/runtime/experiments/bench/qwen3-bench-q4k-alt.json +57 -0
- package/src/config/runtime/experiments/bench/qwen3-bench-q4k-batched.json +57 -0
- package/src/config/runtime/experiments/debug/gemma3-browser-diagnose-q4k.json +81 -0
- package/src/config/runtime/experiments/debug/gemma3-debug-q4k.json +5 -0
- package/src/config/runtime/experiments/debug/qwen35-browser-diagnose-q4k.json +81 -0
- package/src/config/runtime/experiments/verify/gemma4-e2b-verify.json +38 -0
- package/src/config/runtime/profiles/gemma4-e2b-low-memory.json +63 -0
- package/src/config/runtime/profiles/gemma4-e2b-throughput.json +39 -0
- package/src/config/runtime/profiles/low-memory.json +1 -0
- package/src/config/runtime/profiles/turboquant-contiguous-prod.json +29 -0
- package/src/config/runtime/profiles/turboquant-contiguous.json +29 -0
- package/src/config/runtime/profiles/turboquant.json +36 -0
- package/src/config/runtime/profiles/vector-stability.json +1 -0
- package/src/config/runtime/tiers/gemma4-128gb.json +79 -0
- package/src/config/runtime/tiers/gemma4-16gb.json +15 -2
- package/src/config/runtime/tiers/gemma4-24gb.json +15 -2
- package/src/config/runtime/tiers/gemma4-32gb.json +15 -2
- package/src/config/runtime.js +11 -4
- package/src/config/schema/converter.schema.d.ts +4 -2
- package/src/config/schema/converter.schema.js +7 -5
- package/src/config/schema/doppler.schema.d.ts +26 -2
- package/src/config/schema/doppler.schema.js +77 -28
- package/src/config/schema/execution-v1.schema.d.ts +78 -5
- package/src/config/schema/execution-v1.schema.js +62 -1
- package/src/config/schema/index.d.ts +22 -29
- package/src/config/schema/index.js +15 -17
- package/src/config/schema/inference.schema.d.ts +26 -4
- package/src/config/schema/kernel-path.schema.d.ts +30 -3
- package/src/config/schema/kernel-registry.schema.d.ts +1 -1
- package/src/config/schema/kernel-registry.schema.js +1 -0
- package/src/config/schema/kvcache.schema.js +7 -0
- package/src/config/schema/loading.schema.d.ts +28 -0
- package/src/config/schema/loading.schema.js +9 -0
- package/src/config/schema/manifest.schema.d.ts +79 -5
- package/src/config/schema/manifest.schema.js +7 -1
- package/src/config/schema/platform.schema.d.ts +10 -8
- package/src/config/schema/speculation-self.schema.js +0 -5
- package/src/config/schema/support-tiers.schema.d.ts +53 -0
- package/src/config/schema/support-tiers.schema.js +128 -0
- package/src/config/source-packages/litert/gemma-4-e2b-it.json +622 -0
- package/src/config/source-packages/registry.json +15 -0
- package/src/config/support-tiers/subsystems.json +502 -0
- package/src/config/transforms/capability-transform-resolver.d.ts +16 -5
- package/src/config/transforms/capability-transform-resolver.js +44 -9
- package/src/config/transforms/execution-graph-transforms.d.ts +113 -2
- package/src/config/transforms/execution-graph-transforms.js +1220 -8
- package/src/converter/conversion-plan.js +20 -8
- package/src/converter/core.d.ts +48 -1
- package/src/converter/core.js +249 -62
- package/src/converter/parsers/gguf.d.ts +10 -1
- package/src/converter/rope-config.d.ts +1 -0
- package/src/converter/rope-config.js +75 -5
- package/src/converter/shard-packer.js +2 -2
- package/src/debug/tensor.js +13 -1
- package/src/{adapters → experimental/adapters}/adapter-manager.d.ts +1 -1
- package/src/{adapters → experimental/adapters}/adapter-manager.js +2 -2
- package/src/{adapters → experimental/adapters}/adapter-manifest.d.ts +1 -1
- package/src/{adapters → experimental/adapters}/adapter-manifest.js +1 -1
- package/src/{adapters → experimental/adapters}/adapter-registry.d.ts +1 -1
- package/src/{adapters → experimental/adapters}/adapter-registry.js +1 -1
- package/src/{adapters → experimental/adapters}/lora-loader.d.ts +1 -1
- package/src/{adapters → experimental/adapters}/lora-loader.js +2 -2
- package/src/{bridge → experimental/bridge}/extension-client.js +2 -2
- package/src/{bridge → experimental/bridge}/node-bridge.js +2 -4
- package/src/{bridge → experimental/bridge}/protocol.js +1 -1
- package/src/{browser → experimental/browser}/browser-converter.d.ts +4 -4
- package/src/{browser → experimental/browser}/browser-converter.js +12 -12
- package/src/{browser → experimental/browser}/gguf-importer.d.ts +1 -1
- package/src/{browser → experimental/browser}/gguf-importer.js +8 -8
- package/src/{browser → experimental/browser}/gguf-parser-browser.d.ts +2 -2
- package/src/{browser → experimental/browser}/gguf-parser-browser.js +3 -3
- package/src/{browser → experimental/browser}/quantization.d.ts +3 -3
- package/src/{browser → experimental/browser}/quantization.js +4 -4
- package/src/{browser → experimental/browser}/safetensors-parser-browser.d.ts +3 -3
- package/src/{browser → experimental/browser}/safetensors-parser-browser.js +3 -3
- package/src/{browser → experimental/browser}/shard-io-browser.d.ts +1 -1
- package/src/{browser → experimental/browser}/shard-io-browser.js +2 -2
- package/src/{browser → experimental/browser}/tensor-source-download.js +3 -3
- package/src/experimental/diffusion/index.d.ts +8 -0
- package/src/experimental/diffusion/index.js +8 -0
- package/src/{distribution → experimental/distribution}/p2p-transport-contract.js +1 -1
- package/src/{distribution → experimental/distribution}/p2p-transport.js +1 -1
- package/src/{distribution → experimental/distribution}/shard-delivery.js +5 -5
- package/src/experimental/energy/index.d.ts +2 -0
- package/src/experimental/energy/index.js +2 -0
- package/src/{hotswap → experimental/hotswap}/intent-bundle.d.ts +1 -1
- package/src/{hotswap → experimental/hotswap}/intent-bundle.js +2 -2
- package/src/{hotswap → experimental/hotswap}/manifest.d.ts +2 -2
- package/src/{hotswap → experimental/hotswap}/manifest.js +1 -1
- package/src/{hotswap → experimental/hotswap}/model-swap.js +1 -1
- package/src/{hotswap → experimental/hotswap}/runtime.d.ts +1 -1
- package/src/experimental/orchestration/index.d.ts +12 -0
- package/src/experimental/orchestration/index.js +12 -0
- package/src/{training → experimental/training}/README.md +1 -1
- package/src/{training → experimental/training}/artifacts.d.ts +3 -3
- package/src/{training → experimental/training}/artifacts.js +3 -3
- package/src/{training → experimental/training}/attention-backward.d.ts +1 -1
- package/src/{training → experimental/training}/attention-backward.js +3 -3
- package/src/{training → experimental/training}/attention-forward.d.ts +2 -2
- package/src/{training → experimental/training}/attention-forward.js +1 -1
- package/src/{training → experimental/training}/autograd.d.ts +2 -2
- package/src/{training → experimental/training}/autograd.js +7 -7
- package/src/{training → experimental/training}/backward-kernels.js +1 -1
- package/src/{training → experimental/training}/checkpoint.js +1 -1
- package/src/{training → experimental/training}/clip.d.ts +2 -2
- package/src/{training → experimental/training}/clip.js +3 -3
- package/src/{training → experimental/training}/export.d.ts +2 -2
- package/src/{training → experimental/training}/export.js +2 -2
- package/src/{training → experimental/training}/lora-pipeline.js +4 -4
- package/src/{training → experimental/training}/lora.d.ts +1 -1
- package/src/{training → experimental/training}/lora.js +4 -4
- package/src/{training → experimental/training}/loss-scaling.d.ts +2 -2
- package/src/{training → experimental/training}/loss-scaling.js +3 -3
- package/src/{training → experimental/training}/loss.d.ts +2 -2
- package/src/{training → experimental/training}/loss.js +1 -1
- package/src/{training → experimental/training}/operator-artifacts.js +1 -1
- package/src/{training → experimental/training}/optimizer.d.ts +2 -2
- package/src/{training → experimental/training}/optimizer.js +3 -3
- package/src/{training → experimental/training}/runner.d.ts +2 -2
- package/src/{training → experimental/training}/runner.js +5 -5
- package/src/{training → experimental/training}/suite.js +16 -16
- package/src/{training → experimental/training}/tensor-factory.d.ts +1 -1
- package/src/{training → experimental/training}/tensor-factory.js +2 -2
- package/src/{training → experimental/training}/trainer.d.ts +3 -3
- package/src/{training → experimental/training}/trainer.js +3 -3
- package/src/{training → experimental/training}/ul_dataset.d.ts +2 -2
- package/src/{training → experimental/training}/ul_dataset.js +1 -1
- package/src/{training → experimental/training}/ul_schedule.d.ts +1 -1
- package/src/{training → experimental/training}/workloads.js +4 -4
- package/src/formats/index.d.ts +24 -0
- package/src/formats/index.js +6 -0
- package/src/formats/litert/index.d.ts +1 -0
- package/src/formats/litert/index.js +1 -0
- package/src/formats/litert/types.d.ts +87 -0
- package/src/formats/litert/types.js +568 -0
- package/src/formats/rdrr/classification.js +16 -8
- package/src/formats/rdrr/parsing.d.ts +3 -2
- package/src/formats/rdrr/types.d.ts +33 -0
- package/src/formats/rdrr/validation.js +16 -5
- package/src/formats/tflite/index.d.ts +1 -0
- package/src/formats/tflite/index.js +1 -0
- package/src/formats/tflite/types.d.ts +84 -0
- package/src/formats/tflite/types.js +633 -0
- package/src/generation/index.d.ts +16 -14
- package/src/generation/index.js +1 -32
- package/src/gpu/command-recorder.d.ts +17 -1
- package/src/gpu/command-recorder.js +47 -10
- package/src/gpu/device.d.ts +3 -1
- package/src/gpu/device.js +17 -11
- package/src/gpu/kernel-selector.js +3 -1
- package/src/gpu/kernels/attention.d.ts +2 -0
- package/src/gpu/kernels/attention.js +359 -14
- package/src/gpu/kernels/attention.wgsl +20 -1
- package/src/gpu/kernels/attention_decode_contiguous_turboquant_f16kv.wgsl +180 -0
- package/src/gpu/kernels/attention_decode_contiguous_turboquant_prod_f16kv.wgsl +192 -0
- package/src/gpu/kernels/attention_decode_online_f16.wgsl +36 -18
- package/src/gpu/kernels/attention_decode_online_f16kv.wgsl +36 -18
- package/src/gpu/kernels/attention_decode_tiered_turboquant_f16kv.wgsl +269 -0
- package/src/gpu/kernels/attention_decode_tiered_turboquant_prod_f16kv.wgsl +281 -0
- package/src/gpu/kernels/attention_head256_f16kv.wgsl +269 -0
- package/src/gpu/kernels/attention_streaming.wgsl +22 -3
- package/src/gpu/kernels/attention_streaming_f16.wgsl +1 -1
- package/src/gpu/kernels/attention_streaming_f16kv.wgsl +1 -1
- package/src/gpu/kernels/backward/attention_backward.d.ts +14 -1
- package/src/gpu/kernels/check-hot-vocab-stop.d.ts +18 -0
- package/src/gpu/kernels/check-hot-vocab-stop.js +108 -0
- package/src/gpu/kernels/codegen/patches/attention_streaming_f16.from.attention_streaming.diff +1 -1
- package/src/gpu/kernels/codegen/patches/attention_streaming_f16kv.from.attention_streaming.diff +1 -1
- package/src/gpu/kernels/codegen/patches/rope_f16.from.rope.diff +126 -194
- package/src/gpu/kernels/codegen/wgsl-variants.js +24 -6
- package/src/gpu/kernels/depthwise_conv1d.d.ts +23 -0
- package/src/gpu/kernels/depthwise_conv1d.js +51 -0
- package/src/gpu/kernels/depthwise_conv1d.wgsl +46 -0
- package/src/gpu/kernels/feature-check.js +0 -1
- package/src/gpu/kernels/fused_ffn.js +67 -22
- package/src/gpu/kernels/fused_ffn_q4k.wgsl +48 -43
- package/src/gpu/kernels/fused_ffn_q4k_f16.wgsl +329 -0
- package/src/gpu/kernels/fused_matmul_q4.wgsl +417 -0
- package/src/gpu/kernels/fused_matmul_q4_batched_multicol_shared.wgsl +174 -0
- package/src/gpu/kernels/gather.d.ts +4 -0
- package/src/gpu/kernels/gather.js +13 -2
- package/src/gpu/kernels/gather.wgsl +5 -3
- package/src/gpu/kernels/gather_f16.wgsl +5 -3
- package/src/gpu/kernels/index.d.ts +7 -0
- package/src/gpu/kernels/index.js +6 -0
- package/src/gpu/kernels/kernel-configs.js +1 -0
- package/src/gpu/kernels/kv-quantize.js +87 -55
- package/src/gpu/kernels/kv_quantize_turboquant.wgsl +153 -0
- package/src/gpu/kernels/kv_quantize_turboquant_prod.wgsl +230 -0
- package/src/gpu/kernels/linear-attention-core.d.ts +3 -0
- package/src/gpu/kernels/linear-attention-core.js +145 -56
- package/src/gpu/kernels/matmul-dispatch.js +3 -0
- package/src/gpu/kernels/matmul-selection.js +31 -42
- package/src/gpu/kernels/matmul.d.ts +3 -0
- package/src/gpu/kernels/matmul.js +72 -34
- package/src/gpu/kernels/residual.d.ts +2 -0
- package/src/gpu/kernels/residual.js +43 -4
- package/src/gpu/kernels/rope.d.ts +2 -0
- package/src/gpu/kernels/rope.js +19 -6
- package/src/gpu/kernels/rope.wgsl +24 -12
- package/src/gpu/kernels/rope_f16.wgsl +97 -38
- package/src/gpu/kernels/scale.d.ts +5 -0
- package/src/gpu/kernels/scale.js +6 -1
- package/src/gpu/kernels/scale.wgsl +3 -1
- package/src/gpu/kernels/scale_f16.wgsl +32 -0
- package/src/gpu/kernels/turboquant-codebook.js +564 -0
- package/src/gpu/kernels/uniform-utils.js +26 -0
- package/src/gpu/kernels/utils.js +6 -1
- package/src/gpu/submit-probe.d.ts +12 -0
- package/src/gpu/submit-probe.js +77 -0
- package/src/gpu/weight-buffer.d.ts +26 -3
- package/src/gpu/weight-buffer.js +62 -2
- package/src/index-browser.d.ts +1 -91
- package/src/index-browser.js +0 -66
- package/src/index.d.ts +1 -102
- package/src/index.js +0 -74
- package/src/inference/browser-harness-model-helpers.d.ts +3 -0
- package/src/inference/browser-harness-model-helpers.js +134 -11
- package/src/inference/browser-harness-runtime-helpers.js +1 -9
- package/src/inference/browser-harness-text-helpers.js +441 -70
- package/src/inference/browser-harness.js +61 -4
- package/src/inference/decode-ring.d.ts +2 -0
- package/src/inference/decode-ring.js +20 -0
- package/src/inference/kv-cache/index.d.ts +3 -0
- package/src/inference/kv-cache/index.js +2 -0
- package/src/inference/kv-cache/mixed-geometry.d.ts +84 -0
- package/src/inference/kv-cache/mixed-geometry.js +422 -0
- package/src/inference/kv-cache/quantized.d.ts +56 -0
- package/src/inference/kv-cache/quantized.js +383 -0
- package/src/inference/kv-cache/tiered.d.ts +20 -3
- package/src/inference/kv-cache/tiered.js +203 -65
- package/src/inference/kv-cache/types.d.ts +49 -6
- package/src/inference/kv-cache.d.ts +3 -0
- package/src/inference/kv-cache.js +2 -0
- package/src/inference/multi-model-network.js +2 -1
- package/src/inference/pipelines/audio/gemma4.js +655 -0
- package/src/inference/pipelines/audio/index.js +39 -0
- package/src/inference/pipelines/audio/mel.js +171 -0
- package/src/inference/pipelines/context.js +9 -1
- package/src/inference/pipelines/diffusion/text-encoder-gpu.js +2 -0
- package/src/inference/pipelines/shared/clipped-linear.js +46 -0
- package/src/inference/pipelines/text/attention/dispatch-params.d.ts +2 -1
- package/src/inference/pipelines/text/attention/dispatch-params.js +52 -8
- package/src/inference/pipelines/text/attention/output-projection.js +3 -3
- package/src/inference/pipelines/text/attention/precision-contract.d.ts +36 -0
- package/src/inference/pipelines/text/attention/precision-contract.js +115 -0
- package/src/inference/pipelines/text/attention/projections.d.ts +23 -0
- package/src/inference/pipelines/text/attention/projections.js +182 -15
- package/src/inference/pipelines/text/attention/quant-options.js +54 -0
- package/src/inference/pipelines/text/attention/record.js +257 -69
- package/src/inference/pipelines/text/attention/run.js +306 -94
- package/src/inference/pipelines/text/attention/types.d.ts +11 -0
- package/src/inference/pipelines/text/chat-format.d.ts +8 -1
- package/src/inference/pipelines/text/chat-format.js +89 -5
- package/src/inference/pipelines/text/config.d.ts +78 -26
- package/src/inference/pipelines/text/config.js +722 -28
- package/src/inference/pipelines/text/dtype-contract.d.ts +15 -0
- package/src/inference/pipelines/text/dtype-contract.js +38 -0
- package/src/inference/pipelines/text/embed.d.ts +4 -0
- package/src/inference/pipelines/text/embed.js +165 -172
- package/src/inference/pipelines/text/execution-plan.d.ts +19 -0
- package/src/inference/pipelines/text/execution-plan.js +112 -20
- package/src/inference/pipelines/text/execution-runtime-builders.d.ts +8 -4
- package/src/inference/pipelines/text/execution-runtime-builders.js +90 -49
- package/src/inference/pipelines/text/execution-v1.d.ts +23 -4
- package/src/inference/pipelines/text/execution-v1.js +411 -33
- package/src/inference/pipelines/text/ffn/dense.d.ts +59 -0
- package/src/inference/pipelines/text/ffn/dense.js +575 -63
- package/src/inference/pipelines/text/ffn/moe.js +1 -0
- package/src/inference/pipelines/text/ffn/sandwich.js +20 -4
- package/src/inference/pipelines/text/ffn/standard.js +28 -4
- package/src/inference/pipelines/text/finiteness-policy.d.ts +4 -0
- package/src/inference/pipelines/text/finiteness-policy.js +14 -11
- package/src/inference/pipelines/text/generator-helpers.d.ts +7 -0
- package/src/inference/pipelines/text/generator-helpers.js +39 -4
- package/src/inference/pipelines/text/generator-runtime.js +45 -8
- package/src/inference/pipelines/text/generator-steps.js +407 -75
- package/src/inference/pipelines/text/generator.d.ts +6 -0
- package/src/inference/pipelines/text/generator.js +1179 -305
- package/src/inference/pipelines/text/init.d.ts +39 -7
- package/src/inference/pipelines/text/init.js +525 -110
- package/src/inference/pipelines/text/layer-plan.d.ts +1 -0
- package/src/inference/pipelines/text/layer-plan.js +2 -0
- package/src/inference/pipelines/text/layer.js +402 -19
- package/src/inference/pipelines/text/linear-attention.d.ts +4 -0
- package/src/inference/pipelines/text/linear-attention.js +112 -41
- package/src/inference/pipelines/text/logits/gpu.d.ts +2 -1
- package/src/inference/pipelines/text/logits/gpu.js +334 -15
- package/src/inference/pipelines/text/logits/index.d.ts +11 -0
- package/src/inference/pipelines/text/logits/index.js +227 -29
- package/src/inference/pipelines/text/logits/types.d.ts +3 -0
- package/src/inference/pipelines/text/logits/utils.js +3 -1
- package/src/inference/pipelines/text/lora-apply.js +3 -3
- package/src/inference/pipelines/text/model-load.d.ts +2 -1
- package/src/inference/pipelines/text/model-load.js +205 -178
- package/src/inference/pipelines/text/moe-gpu.js +8 -0
- package/src/inference/pipelines/text/moe-impl.d.ts +2 -0
- package/src/inference/pipelines/text/ops.d.ts +16 -2
- package/src/inference/pipelines/text/ops.js +11 -2
- package/src/inference/pipelines/text/per-layer-inputs.d.ts +107 -0
- package/src/inference/pipelines/text/per-layer-inputs.js +1581 -0
- package/src/inference/pipelines/text/probes.js +6 -0
- package/src/inference/pipelines/text/sampling-config.js +9 -1
- package/src/inference/pipelines/text/stage-names.js +3 -0
- package/src/inference/pipelines/text/state.d.ts +12 -3
- package/src/inference/pipelines/text/state.js +19 -0
- package/src/inference/pipelines/text/types.d.ts +79 -7
- package/src/inference/pipelines/text/weights.d.ts +2 -2
- package/src/inference/pipelines/text/weights.js +4 -0
- package/src/inference/pipelines/text.d.ts +6 -0
- package/src/inference/pipelines/text.js +860 -11
- package/src/inference/pipelines/video/frame-sampler.js +36 -0
- package/src/inference/pipelines/video/index.js +87 -0
- package/src/inference/pipelines/vision/encoder.js +27 -6
- package/src/inference/pipelines/vision/gemma4.js +731 -0
- package/src/inference/pipelines/vision/image-preprocess.js +22 -7
- package/src/inference/pipelines/vision/index.js +35 -10
- package/src/inference/pipelines/vision/ops.js +31 -26
- package/src/inference/pipelines/vision/patch-embed.js +22 -10
- package/src/inference/runtime-model.d.ts +89 -0
- package/src/inference/runtime-model.js +152 -0
- package/src/inference/test-harness.d.ts +8 -1
- package/src/inference/test-harness.js +54 -20
- package/src/inference/tokenizer.d.ts +5 -0
- package/src/inference/tokenizer.js +43 -0
- package/src/inference/tokenizers/base.d.ts +5 -0
- package/src/inference/tokenizers/base.js +5 -0
- package/src/inference/tokenizers/behavior-flags.d.ts +9 -0
- package/src/inference/tokenizers/behavior-flags.js +100 -0
- package/src/inference/tokenizers/bundled.d.ts +4 -0
- package/src/inference/tokenizers/bundled.js +110 -0
- package/src/inference/tokenizers/sentencepiece.d.ts +2 -0
- package/src/inference/tokenizers/sentencepiece.js +16 -0
- package/src/inference/tokenizers/types.d.ts +2 -0
- package/src/loader/doppler-loader.d.ts +10 -3
- package/src/loader/doppler-loader.js +103 -5
- package/src/loader/embedding-loader.d.ts +5 -1
- package/src/loader/embedding-loader.js +57 -6
- package/src/loader/final-weights-loader.js +44 -5
- package/src/loader/layer-loader.js +210 -8
- package/src/loader/loader-state.js +2 -2
- package/src/loader/loader-types.d.ts +17 -1
- package/src/loader/memory-monitor.d.ts +8 -0
- package/src/loader/memory-monitor.js +21 -0
- package/src/loader/multi-model-loader.d.ts +9 -1
- package/src/loader/multi-model-loader.js +9 -1
- package/src/loader/per-layer-input-loader.d.ts +30 -0
- package/src/loader/per-layer-input-loader.js +478 -0
- package/src/loader/shard-cache.d.ts +4 -3
- package/src/loader/shard-resolver.js +2 -0
- package/src/loader/tensors/source-transform.d.ts +50 -0
- package/src/loader/tensors/source-transform.js +776 -0
- package/src/loader/tensors/tensor-loader.d.ts +12 -0
- package/src/loader/tensors/tensor-loader.js +208 -123
- package/src/loader/tensors/tensor-reader.d.ts +8 -0
- package/src/loader/tensors/tensor-reader.js +283 -15
- package/src/loaders/index.d.ts +4 -0
- package/src/loaders/index.js +4 -0
- package/src/memory/buffer-pool.d.ts +4 -0
- package/src/memory/buffer-pool.js +36 -0
- package/src/rules/execution-rules-contract-check.d.ts +4 -0
- package/src/rules/execution-rules-contract-check.js +150 -24
- package/src/rules/inference/attention.rules.json +15 -0
- package/src/rules/inference/capability-transforms.rules.json +30 -0
- package/src/rules/inference/execution.rules.json +54 -2
- package/src/rules/inference/ffn.rules.json +33 -0
- package/src/rules/kernels/attention.rules.json +7 -0
- package/src/rules/kernels/fused-ffn.rules.json +4 -2
- package/src/rules/kernels/kv_quantize.rules.json +2 -0
- package/src/rules/kernels/matmul.rules.json +14 -0
- package/src/rules/kernels/scale.rules.json +2 -0
- package/src/rules/loader/tensor-loader.rules.json +1 -0
- package/src/storage/artifact-storage-context.d.ts +53 -0
- package/src/storage/artifact-storage-context.js +560 -0
- package/src/storage/downloader.js +7 -1
- package/src/storage/index.d.ts +18 -0
- package/src/storage/index.js +13 -0
- package/src/storage/preflight.js +22 -0
- package/src/storage/quickstart-downloader.js +35 -2
- package/src/storage/registry.d.ts +1 -0
- package/src/storage/registry.js +26 -4
- package/src/storage/shard-manager.d.ts +4 -0
- package/src/storage/shard-manager.js +25 -6
- package/src/storage/source-artifact-store.d.ts +9 -0
- package/src/storage/source-artifact-store.js +134 -0
- package/src/tooling/browser-command-runner.js +12 -5
- package/src/tooling/command-api-family-normalizers.js +144 -0
- package/src/tooling/command-api-helpers.js +1 -0
- package/src/tooling/command-api.d.ts +32 -9
- package/src/tooling/command-api.js +0 -25
- package/src/tooling/command-runner-shared.js +1 -2
- package/src/tooling/command-runner.html +5 -2
- package/src/tooling/diagnose-runner.js +1 -1
- package/src/tooling/kernel-path-builder/index.js +48 -32
- package/src/tooling/lean-execution-contract.d.ts +1 -1
- package/src/tooling/lean-execution-contract.js +2 -149
- package/src/tooling/litert-package-runtime.d.ts +46 -0
- package/src/tooling/litert-package-runtime.js +950 -0
- package/src/tooling/node-browser-command-runner.d.ts +13 -0
- package/src/tooling/node-browser-command-runner.js +163 -3
- package/src/tooling/node-command-runner.js +14 -5
- package/src/tooling/node-converter.js +226 -63
- package/src/tooling/node-source-runtime.d.ts +8 -3
- package/src/tooling/node-source-runtime.js +561 -236
- package/src/tooling/node-webgpu.js +7 -30
- package/src/tooling/opfs-cache.d.ts +18 -1
- package/src/tooling/opfs-cache.js +126 -9
- package/src/tooling/runtime-input-composition.d.ts +0 -1
- package/src/tooling/runtime-input-composition.js +0 -5
- package/src/tooling/source-artifact-adapter.d.ts +134 -0
- package/src/tooling/source-artifact-adapter.js +366 -0
- package/src/tooling/source-package-profiles.d.ts +33 -0
- package/src/tooling/source-package-profiles.js +57 -0
- package/src/tooling/source-runtime-bundle.d.ts +46 -6
- package/src/tooling/source-runtime-bundle.js +371 -60
- package/src/tooling/source-runtime-converter-config.d.ts +24 -0
- package/src/tooling/source-runtime-converter-config.js +297 -0
- package/src/tooling-experimental-exports.browser.js +2 -0
- package/src/tooling-experimental-exports.d.ts +7 -0
- package/src/tooling-experimental-exports.js +7 -0
- package/src/tooling-experimental-exports.shared.d.ts +26 -0
- package/src/tooling-experimental-exports.shared.js +29 -0
- package/src/tooling-exports.shared.d.ts +0 -23
- package/src/tooling-exports.shared.js +6 -28
- package/src/version.js +1 -1
- package/src/client/doppler-provider/generation.d.ts +0 -25
- package/src/client/doppler-provider/generation.js +0 -126
- package/src/client/doppler-provider/index.d.ts +0 -2
- package/src/client/doppler-provider/index.js +0 -3
- package/src/client/doppler-provider/provider.d.ts +0 -5
- package/src/client/doppler-provider/provider.js +0 -102
- package/src/client/doppler-provider/source-runtime.js +0 -677
- package/src/client/doppler-provider.d.ts +0 -46
- package/src/client/doppler-provider.js +0 -36
- package/src/config/schema/inference-defaults.schema.d.ts +0 -276
- package/src/config/schema/inference-defaults.schema.js +0 -189
- package/src/diffusion/index.d.ts +0 -8
- package/src/diffusion/index.js +0 -8
- package/src/energy/index.d.ts +0 -2
- package/src/energy/index.js +0 -2
- package/src/index-internal.d.ts +0 -2
- package/src/index-internal.js +0 -2
- /package/src/client/{doppler-provider → runtime}/types.js +0 -0
- /package/src/{adapters → experimental/adapters}/index.d.ts +0 -0
- /package/src/{adapters → experimental/adapters}/index.js +0 -0
- /package/src/{bridge → experimental/bridge}/extension/background.d.ts +0 -0
- /package/src/{bridge → experimental/bridge}/extension/background.js +0 -0
- /package/src/{bridge → experimental/bridge}/extension/manifest.json +0 -0
- /package/src/{bridge → experimental/bridge}/extension-client.d.ts +0 -0
- /package/src/{bridge → experimental/bridge}/index.d.ts +0 -0
- /package/src/{bridge → experimental/bridge}/index.js +0 -0
- /package/src/{bridge → experimental/bridge}/protocol.d.ts +0 -0
- /package/src/{browser → experimental/browser}/file-picker.d.ts +0 -0
- /package/src/{browser → experimental/browser}/file-picker.js +0 -0
- /package/src/{browser → experimental/browser}/tensor-source-download.d.ts +0 -0
- /package/src/{browser → experimental/browser}/tensor-source-file.d.ts +0 -0
- /package/src/{browser → experimental/browser}/tensor-source-file.js +0 -0
- /package/src/{browser → experimental/browser}/tensor-source-http.d.ts +0 -0
- /package/src/{browser → experimental/browser}/tensor-source-http.js +0 -0
- /package/src/{diffusion → experimental/diffusion}/config/expansion-lanes.json +0 -0
- /package/src/{diffusion → experimental/diffusion}/image-regression.d.ts +0 -0
- /package/src/{diffusion → experimental/diffusion}/image-regression.js +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-control-plane.d.ts +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-control-plane.js +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-observability.d.ts +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-observability.js +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-transport-contract.d.ts +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-webrtc-browser.d.ts +0 -0
- /package/src/{distribution → experimental/distribution}/p2p-webrtc-browser.js +0 -0
- /package/src/{distribution → experimental/distribution}/shard-delivery.d.ts +0 -0
- /package/src/{hotswap → experimental/hotswap}/runtime.js +0 -0
- /package/src/{training → experimental/training}/checkpoint-watch.d.ts +0 -0
- /package/src/{training → experimental/training}/checkpoint-watch.js +0 -0
- /package/src/{training → experimental/training}/checkpoint.d.ts +0 -0
- /package/src/{training → experimental/training}/dataloader.d.ts +0 -0
- /package/src/{training → experimental/training}/dataloader.js +0 -0
- /package/src/{training → experimental/training}/datasets/index.d.ts +0 -0
- /package/src/{training → experimental/training}/datasets/index.js +0 -0
- /package/src/{training → experimental/training}/datasets/jsonl.d.ts +0 -0
- /package/src/{training → experimental/training}/datasets/jsonl.js +0 -0
- /package/src/{training → experimental/training}/datasets/reploid.d.ts +0 -0
- /package/src/{training → experimental/training}/datasets/reploid.js +0 -0
- /package/src/{training → experimental/training}/datasets/text-pairs.d.ts +0 -0
- /package/src/{training → experimental/training}/datasets/text-pairs.js +0 -0
- /package/src/{training → experimental/training}/datasets/token-batch.d.ts +0 -0
- /package/src/{training → experimental/training}/datasets/token-batch.js +0 -0
- /package/src/{training → experimental/training}/datasets/translation-pairs.d.ts +0 -0
- /package/src/{training → experimental/training}/datasets/translation-pairs.js +0 -0
- /package/src/{training → experimental/training}/distillation/artifacts.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/artifacts.js +0 -0
- /package/src/{training → experimental/training}/distillation/checkpoint-watch.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/checkpoint-watch.js +0 -0
- /package/src/{training → experimental/training}/distillation/dataset.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/dataset.js +0 -0
- /package/src/{training → experimental/training}/distillation/eval.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/eval.js +0 -0
- /package/src/{training → experimental/training}/distillation/index.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/index.js +0 -0
- /package/src/{training → experimental/training}/distillation/runtime.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/runtime.js +0 -0
- /package/src/{training → experimental/training}/distillation/scoreboard.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/scoreboard.js +0 -0
- /package/src/{training → experimental/training}/distillation/stage-a.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/stage-a.js +0 -0
- /package/src/{training → experimental/training}/distillation/stage-b.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/stage-b.js +0 -0
- /package/src/{training → experimental/training}/distillation/student-fixture.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/student-fixture.js +0 -0
- /package/src/{training → experimental/training}/distillation/suite-data.d.ts +0 -0
- /package/src/{training → experimental/training}/distillation/suite-data.js +0 -0
- /package/src/{training → experimental/training}/index.d.ts +0 -0
- /package/src/{training → experimental/training}/index.js +0 -0
- /package/src/{training → experimental/training}/lora-pipeline.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/base.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/base.js +0 -0
- /package/src/{training → experimental/training}/objectives/cross_entropy.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/cross_entropy.js +0 -0
- /package/src/{training → experimental/training}/objectives/distill_kd.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/distill_kd.js +0 -0
- /package/src/{training → experimental/training}/objectives/distill_triplet.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/distill_triplet.js +0 -0
- /package/src/{training → experimental/training}/objectives/index.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/index.js +0 -0
- /package/src/{training → experimental/training}/objectives/ul_stage1_joint.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/ul_stage1_joint.js +0 -0
- /package/src/{training → experimental/training}/objectives/ul_stage2_base.d.ts +0 -0
- /package/src/{training → experimental/training}/objectives/ul_stage2_base.js +0 -0
- /package/src/{training → experimental/training}/operator-artifacts.d.ts +0 -0
- /package/src/{training → experimental/training}/operator-command.d.ts +0 -0
- /package/src/{training → experimental/training}/operator-command.js +0 -0
- /package/src/{training → experimental/training}/operator-eval.d.ts +0 -0
- /package/src/{training → experimental/training}/operator-eval.js +0 -0
- /package/src/{training → experimental/training}/operator-scoreboard.d.ts +0 -0
- /package/src/{training → experimental/training}/operator-scoreboard.js +0 -0
- /package/src/{training → experimental/training}/suite.d.ts +0 -0
- /package/src/{training → experimental/training}/ul_schedule.js +0 -0
- /package/src/{training → experimental/training}/workload-packs/distill-translategemma-medium.json +0 -0
- /package/src/{training → experimental/training}/workload-packs/distill-translategemma-tiny.json +0 -0
- /package/src/{training → experimental/training}/workload-packs/lora-toy-medium.json +0 -0
- /package/src/{training → experimental/training}/workload-packs/lora-toy-tiny.json +0 -0
- /package/src/{training → experimental/training}/workload-packs/registry.json +0 -0
- /package/src/{training → experimental/training}/workload-packs/ul-training-medium.json +0 -0
- /package/src/{training → experimental/training}/workload-packs/ul-training-tiny.json +0 -0
- /package/src/{training → experimental/training}/workloads.d.ts +0 -0
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { getKernelCapabilities } from '../gpu/device.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isWeightBuffer,
|
|
6
|
+
createWeightBuffer,
|
|
7
|
+
getWeightDtype,
|
|
8
|
+
resolveWeightBufferMaterialization,
|
|
9
|
+
} from '../gpu/weight-buffer.js';
|
|
5
10
|
import { dequantize, dequantizeRowwise } from '../gpu/kernel-selector.js';
|
|
6
|
-
import { releaseBuffer } from '../memory/buffer-pool.js';
|
|
11
|
+
import { releaseBuffer, acquireBuffer, uploadData } from '../memory/buffer-pool.js';
|
|
7
12
|
import { batchDowncastWeights } from './weight-downcast.js';
|
|
8
|
-
import { QK_K } from './quantization-constants.js';
|
|
13
|
+
import { QK_K, Q4K_BLOCK_BYTES } from './quantization-constants.js';
|
|
9
14
|
import { log, trace as debugTrace } from '../debug/index.js';
|
|
15
|
+
import { createTensor } from '../gpu/tensor.js';
|
|
16
|
+
import { castF16ToF32 } from '../gpu/kernels/cast.js';
|
|
17
|
+
import { dequantizeQ4KM, dequantizeQ4KMRowWise } from '../converter/quantizer.js';
|
|
10
18
|
|
|
11
19
|
// ============================================================================
|
|
12
20
|
// Constants
|
|
@@ -34,6 +42,8 @@ const ATTN_SUFFIXES = {
|
|
|
34
42
|
postAttentionNorm: ['post_attention_layernorm.weight', 'post_attention_norm.weight', 'ffn_norm.weight'],
|
|
35
43
|
preFeedforwardNorm: ['pre_feedforward_layernorm.weight'],
|
|
36
44
|
postFeedforwardNorm: ['post_feedforward_layernorm.weight', 'post_ffw_norm.weight'],
|
|
45
|
+
postPerLayerInputNorm: ['post_per_layer_input_norm.weight'],
|
|
46
|
+
layerScalar: ['layer_scalar'],
|
|
37
47
|
};
|
|
38
48
|
|
|
39
49
|
const LINEAR_ATTN_SUFFIXES = {
|
|
@@ -60,6 +70,8 @@ const FFN_SUFFIXES = {
|
|
|
60
70
|
ffnGate: ['mlp.gate_proj.weight', 'feed_forward.w1.weight', 'ffn_gate.weight'],
|
|
61
71
|
ffnUp: ['mlp.up_proj.weight', 'feed_forward.w3.weight', 'ffn_up.weight'],
|
|
62
72
|
ffnDown: ['mlp.down_proj.weight', 'feed_forward.w2.weight', 'ffn_down.weight'],
|
|
73
|
+
perLayerInputGate: ['per_layer_input_gate.weight'],
|
|
74
|
+
perLayerProjection: ['per_layer_projection.weight'],
|
|
63
75
|
};
|
|
64
76
|
|
|
65
77
|
|
|
@@ -77,6 +89,7 @@ const MATMUL_KEYS = [
|
|
|
77
89
|
'qkvProj',
|
|
78
90
|
'linearInProjZ', 'linearInProjA', 'linearInProjB',
|
|
79
91
|
'ffnGate', 'ffnUp', 'ffnDown', 'ffnGateUp',
|
|
92
|
+
'perLayerInputGate', 'perLayerProjection',
|
|
80
93
|
'convInProj', 'convOutProj',
|
|
81
94
|
'routerWeight',
|
|
82
95
|
];
|
|
@@ -167,6 +180,142 @@ function inferLinearQKVSizes(ctx, linearQkvProj, linearOutProj) {
|
|
|
167
180
|
return null;
|
|
168
181
|
}
|
|
169
182
|
|
|
183
|
+
function cloneWeightMaterializations(weight, excludeDtypes = []) {
|
|
184
|
+
if (!isWeightBuffer(weight) || !weight.materializations || typeof weight.materializations !== 'object') {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
const excluded = new Set(excludeDtypes);
|
|
188
|
+
const cloned = {};
|
|
189
|
+
for (const [dtype, descriptor] of Object.entries(weight.materializations)) {
|
|
190
|
+
if (excluded.has(dtype) || !descriptor?.buffer) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
cloned[dtype] = {
|
|
194
|
+
buffer: descriptor.buffer,
|
|
195
|
+
layout: descriptor.layout ?? weight.layout,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
return Object.keys(cloned).length > 0 ? cloned : null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function isQ4KLocationDtype(dtype) {
|
|
202
|
+
return dtype === 'Q4_K_M' || dtype === 'Q4_K';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function toUint8Array(data) {
|
|
206
|
+
if (data instanceof Uint8Array) {
|
|
207
|
+
return data;
|
|
208
|
+
}
|
|
209
|
+
if (ArrayBuffer.isView(data)) {
|
|
210
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
211
|
+
}
|
|
212
|
+
if (data instanceof ArrayBuffer) {
|
|
213
|
+
return new Uint8Array(data);
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async function loadPleReferenceQ4K(ctx, name, location, layerIdx, label) {
|
|
219
|
+
if (!location || !isQ4KLocationDtype(String(location.dtype ?? '').toUpperCase())) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
const shape = Array.isArray(location.shape) ? location.shape : null;
|
|
223
|
+
if (!shape || shape.length !== 2) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const quantizedBytes = toUint8Array(await ctx.loadTensor(name, false, true));
|
|
228
|
+
if (!quantizedBytes) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const rows = Number(shape[0]);
|
|
233
|
+
const cols = Number(shape[1]);
|
|
234
|
+
if (!Number.isFinite(rows) || rows <= 0 || !Number.isFinite(cols) || cols <= 0) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const f32Weights = cols % QK_K === 0
|
|
239
|
+
? dequantizeQ4KM(quantizedBytes, Math.ceil(location.size / Q4K_BLOCK_BYTES), shape)
|
|
240
|
+
: dequantizeQ4KMRowWise(quantizedBytes, shape);
|
|
241
|
+
|
|
242
|
+
const buffer = acquireBuffer(f32Weights.byteLength, undefined, `${name}_f32_reference`);
|
|
243
|
+
uploadData(buffer, f32Weights);
|
|
244
|
+
ctx.gpuBuffers.add(buffer);
|
|
245
|
+
|
|
246
|
+
debugTrace.loader(
|
|
247
|
+
`Layer ${layerIdx}: loaded ${label} via CPU reference q4k dequant`
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
return createWeightBuffer(buffer, 'f32', location.layout ?? 'row', shape, name);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async function loadPerLayerProjectionReferenceQ4K(ctx, name, location, layerIdx) {
|
|
254
|
+
return loadPleReferenceQ4K(ctx, name, location, layerIdx, 'perLayerProjection');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function loadPerLayerInputGateReferenceQ4K(ctx, name, location, layerIdx) {
|
|
258
|
+
return loadPleReferenceQ4K(ctx, name, location, layerIdx, 'perLayerInputGate');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async function stabilizePleWeight(ctx, weights, key, layerIdx, label) {
|
|
262
|
+
const originalWeight = weights[key];
|
|
263
|
+
if (!isWeightBuffer(originalWeight)) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const denseWeight = resolveWeightBufferMaterialization(originalWeight, 'f16');
|
|
268
|
+
const denseDtype = String(getWeightDtype(denseWeight) ?? '').toLowerCase();
|
|
269
|
+
if (denseDtype === 'f32') {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (denseDtype !== 'f16') {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const denseShape = Array.isArray(denseWeight.shape) ? denseWeight.shape : null;
|
|
277
|
+
if (!denseShape || denseShape.length !== 2) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const f32Tensor = await castF16ToF32(
|
|
282
|
+
createTensor(
|
|
283
|
+
denseWeight.buffer,
|
|
284
|
+
'f16',
|
|
285
|
+
denseShape,
|
|
286
|
+
denseWeight.label ?? `layer_${layerIdx}_per_layer_projection_f16`
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
ctx.gpuBuffers.add(f32Tensor.buffer);
|
|
290
|
+
|
|
291
|
+
weights[key] = createWeightBuffer(
|
|
292
|
+
f32Tensor.buffer,
|
|
293
|
+
'f32',
|
|
294
|
+
denseWeight.layout ?? originalWeight.layout,
|
|
295
|
+
denseShape,
|
|
296
|
+
denseWeight.label ?? `layer_${layerIdx}_${label}_f32`,
|
|
297
|
+
{
|
|
298
|
+
...(cloneWeightMaterializations(originalWeight, ['f32']) ?? {}),
|
|
299
|
+
f16: {
|
|
300
|
+
buffer: denseWeight.buffer,
|
|
301
|
+
layout: denseWeight.layout ?? originalWeight.layout,
|
|
302
|
+
},
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
debugTrace.loader(
|
|
307
|
+
`Layer ${layerIdx}: promoted ${label} to f32 for stable per-layer input execution`
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async function stabilizePerLayerProjectionWeight(ctx, weights, layerIdx) {
|
|
312
|
+
await stabilizePleWeight(ctx, weights, 'perLayerProjection', layerIdx, 'per_layer_projection');
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async function stabilizePerLayerInputGateWeight(ctx, weights, layerIdx) {
|
|
316
|
+
await stabilizePleWeight(ctx, weights, 'perLayerInputGate', layerIdx, 'per_layer_input_gate');
|
|
317
|
+
}
|
|
318
|
+
|
|
170
319
|
// ============================================================================
|
|
171
320
|
// Main Function
|
|
172
321
|
// ============================================================================
|
|
@@ -206,6 +355,10 @@ export async function loadLayer(ctx, layerIdx) {
|
|
|
206
355
|
ffnUp: null,
|
|
207
356
|
ffnDown: null,
|
|
208
357
|
ffnGateUp: null,
|
|
358
|
+
perLayerInputGate: null,
|
|
359
|
+
perLayerProjection: null,
|
|
360
|
+
postPerLayerInputNorm: null,
|
|
361
|
+
layerScalar: null,
|
|
209
362
|
};
|
|
210
363
|
|
|
211
364
|
// Create helper functions bound to this context
|
|
@@ -217,7 +370,7 @@ export async function loadLayer(ctx, layerIdx) {
|
|
|
217
370
|
|
|
218
371
|
// Load FFN weights (unless MoE expert layer)
|
|
219
372
|
if (!ctx.isMoE || !ctx.isExpertLayer(layerIdx)) {
|
|
220
|
-
await loadFfnWeights(weights, layerIdx, tryLoad);
|
|
373
|
+
await loadFfnWeights(ctx, weights, layerIdx, tryLoad, prefixes);
|
|
221
374
|
}
|
|
222
375
|
|
|
223
376
|
// Load MoE router weights
|
|
@@ -273,6 +426,18 @@ function createTryLoadNorm(ctx, prefixes, tryLoad) {
|
|
|
273
426
|
|
|
274
427
|
|
|
275
428
|
async function loadAttentionWeights(ctx, weights, layerIdx, tryLoad, tryLoadNorm) {
|
|
429
|
+
const tryLoadCpu = async (suffixes) => {
|
|
430
|
+
for (const prefix of LAYER_PREFIXES(layerIdx)) {
|
|
431
|
+
for (const suffix of suffixes) {
|
|
432
|
+
const tensor = await ctx.loadTensor(`${prefix}.${suffix}`, false, true);
|
|
433
|
+
if (tensor instanceof Float32Array) {
|
|
434
|
+
return tensor;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return null;
|
|
439
|
+
};
|
|
440
|
+
|
|
276
441
|
const [
|
|
277
442
|
inputNorm,
|
|
278
443
|
qProj,
|
|
@@ -284,6 +449,8 @@ async function loadAttentionWeights(ctx, weights, layerIdx, tryLoad, tryLoadNorm
|
|
|
284
449
|
postAttentionNorm,
|
|
285
450
|
preFeedforwardNorm,
|
|
286
451
|
postFeedforwardNorm,
|
|
452
|
+
postPerLayerInputNorm,
|
|
453
|
+
layerScalar,
|
|
287
454
|
convInProj,
|
|
288
455
|
convKernel,
|
|
289
456
|
convOutProj,
|
|
@@ -308,6 +475,8 @@ async function loadAttentionWeights(ctx, weights, layerIdx, tryLoad, tryLoadNorm
|
|
|
308
475
|
tryLoadNorm(ATTN_SUFFIXES.postAttentionNorm),
|
|
309
476
|
tryLoadNorm(ATTN_SUFFIXES.preFeedforwardNorm),
|
|
310
477
|
tryLoadNorm(ATTN_SUFFIXES.postFeedforwardNorm),
|
|
478
|
+
tryLoadNorm(ATTN_SUFFIXES.postPerLayerInputNorm),
|
|
479
|
+
tryLoadCpu(ATTN_SUFFIXES.layerScalar),
|
|
311
480
|
tryLoad(CONV_SUFFIXES.convInProj),
|
|
312
481
|
tryLoad(CONV_SUFFIXES.convKernel),
|
|
313
482
|
tryLoad(CONV_SUFFIXES.convOutProj),
|
|
@@ -342,6 +511,8 @@ async function loadAttentionWeights(ctx, weights, layerIdx, tryLoad, tryLoadNorm
|
|
|
342
511
|
weights.postAttentionNorm = postAttentionNorm;
|
|
343
512
|
weights.preFeedforwardNorm = preFeedforwardNorm;
|
|
344
513
|
weights.postFeedforwardNorm = postFeedforwardNorm;
|
|
514
|
+
weights.postPerLayerInputNorm = postPerLayerInputNorm;
|
|
515
|
+
weights.layerScalar = layerScalar;
|
|
345
516
|
weights.postNorm = weights.postAttentionNorm || weights.preFeedforwardNorm;
|
|
346
517
|
weights.postAttnNorm = weights.postNorm;
|
|
347
518
|
weights.convInProj = convInProj;
|
|
@@ -377,7 +548,9 @@ async function loadAttentionWeights(ctx, weights, layerIdx, tryLoad, tryLoadNorm
|
|
|
377
548
|
}
|
|
378
549
|
|
|
379
550
|
|
|
380
|
-
async function loadFfnWeights(weights, layerIdx, tryLoad) {
|
|
551
|
+
async function loadFfnWeights(ctx, weights, layerIdx, tryLoad, prefixes) {
|
|
552
|
+
const perLayerProjection = await loadStablePerLayerProjection(ctx, layerIdx, prefixes, tryLoad);
|
|
553
|
+
const stablePerLayerInputGate = await loadStablePerLayerInputGate(ctx, layerIdx, prefixes, tryLoad);
|
|
381
554
|
const [ffnGateUp, ffnGate, ffnUp, ffnDown] = await Promise.all([
|
|
382
555
|
tryLoad(FFN_SUFFIXES.ffnGateUp),
|
|
383
556
|
tryLoad(FFN_SUFFIXES.ffnGate),
|
|
@@ -386,26 +559,53 @@ async function loadFfnWeights(weights, layerIdx, tryLoad) {
|
|
|
386
559
|
]);
|
|
387
560
|
|
|
388
561
|
if (ffnGateUp) {
|
|
389
|
-
// Fused path: no separate gate/up weights
|
|
390
562
|
weights.ffnGateUp = ffnGateUp;
|
|
391
563
|
weights.ffnGate = null;
|
|
392
564
|
weights.ffnUp = null;
|
|
393
565
|
debugTrace.loader(`Layer ${layerIdx}: Using fused gate_up_proj for 2-pass FFN`);
|
|
394
566
|
} else {
|
|
395
|
-
// Separate path: use gate and up individually (3-pass FFN)
|
|
396
567
|
weights.ffnGate = ffnGate;
|
|
397
568
|
weights.ffnUp = ffnUp;
|
|
398
569
|
}
|
|
399
570
|
|
|
400
571
|
weights.ffnDown = ffnDown;
|
|
572
|
+
weights.perLayerInputGate = stablePerLayerInputGate;
|
|
573
|
+
weights.perLayerProjection = perLayerProjection;
|
|
401
574
|
|
|
402
|
-
// Set aliases for pipeline compatibility
|
|
403
575
|
weights.gate = weights.ffnGate;
|
|
404
576
|
weights.up = weights.ffnUp;
|
|
405
577
|
weights.down = weights.ffnDown;
|
|
406
578
|
weights.gateUp = weights.ffnGateUp;
|
|
407
579
|
}
|
|
408
580
|
|
|
581
|
+
async function loadStablePerLayerProjection(ctx, layerIdx, prefixes, tryLoad) {
|
|
582
|
+
for (const prefix of prefixes) {
|
|
583
|
+
const name = `${prefix}.${FFN_SUFFIXES.perLayerProjection[0]}`;
|
|
584
|
+
const location = ctx.tensorLocations.get(name) ?? null;
|
|
585
|
+
if (location) {
|
|
586
|
+
const referenceWeight = await loadPerLayerProjectionReferenceQ4K(ctx, name, location, layerIdx);
|
|
587
|
+
if (referenceWeight) {
|
|
588
|
+
return referenceWeight;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return tryLoad(FFN_SUFFIXES.perLayerProjection);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
async function loadStablePerLayerInputGate(ctx, layerIdx, prefixes, tryLoad) {
|
|
596
|
+
for (const prefix of prefixes) {
|
|
597
|
+
const name = `${prefix}.${FFN_SUFFIXES.perLayerInputGate[0]}`;
|
|
598
|
+
const location = ctx.tensorLocations.get(name) ?? null;
|
|
599
|
+
if (location) {
|
|
600
|
+
const referenceWeight = await loadPerLayerInputGateReferenceQ4K(ctx, name, location, layerIdx);
|
|
601
|
+
if (referenceWeight) {
|
|
602
|
+
return referenceWeight;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return tryLoad(FFN_SUFFIXES.perLayerInputGate);
|
|
607
|
+
}
|
|
608
|
+
|
|
409
609
|
|
|
410
610
|
async function loadRouterWeights(weights, tryLoad) {
|
|
411
611
|
const [routerWeight, routerBias] = await Promise.all([
|
|
@@ -437,6 +637,8 @@ async function downcastLayerWeights(ctx, weights, layerIdx) {
|
|
|
437
637
|
);
|
|
438
638
|
|
|
439
639
|
await dequantConvQ4KWeights(ctx, weights, layerIdx);
|
|
640
|
+
await stabilizePerLayerInputGateWeight(ctx, weights, layerIdx);
|
|
641
|
+
await stabilizePerLayerProjectionWeight(ctx, weights, layerIdx);
|
|
440
642
|
}
|
|
441
643
|
|
|
442
644
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { releaseBuffer } from '../memory/buffer-pool.js';
|
|
1
|
+
import { PersistentBufferSet, releaseBuffer } from '../memory/buffer-pool.js';
|
|
2
2
|
import { isWeightBuffer, isCpuWeightBuffer } from '../gpu/weight-buffer.js';
|
|
3
3
|
import { trace as debugTrace } from '../debug/index.js';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ export class LoaderState {
|
|
|
8
8
|
finalNorm = null;
|
|
9
9
|
layers = new Map();
|
|
10
10
|
experts = new Map();
|
|
11
|
-
gpuBuffers = new
|
|
11
|
+
gpuBuffers = new PersistentBufferSet();
|
|
12
12
|
isLoaded = false;
|
|
13
13
|
|
|
14
14
|
setLayer(layerIndex, weights) {
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* @module loader/loader-types
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { WeightBuffer } from '../gpu/weight-buffer.js';
|
|
9
|
+
import type { CpuWeightBuffer, WeightBuffer } from '../gpu/weight-buffer.js';
|
|
10
10
|
import type { TensorRole } from '../config/schema/index.js';
|
|
11
|
+
import type { TensorSourceTransform } from '../formats/rdrr/index.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Tensor location in loaded model
|
|
@@ -25,6 +26,8 @@ export interface TensorLocation {
|
|
|
25
26
|
layout?: 'row' | 'column';
|
|
26
27
|
/** Original shape before transpose (if layout is 'column') */
|
|
27
28
|
originalShape?: number[];
|
|
29
|
+
/** Optional direct-source transform applied before dtype-specific loading */
|
|
30
|
+
sourceTransform?: TensorSourceTransform;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
/**
|
|
@@ -70,6 +73,17 @@ export interface LayerWeights {
|
|
|
70
73
|
routerWeight?: GPUBuffer | import('../gpu/weight-buffer.js').WeightBuffer | Float32Array | null;
|
|
71
74
|
routerBias?: GPUBuffer | Float32Array | null;
|
|
72
75
|
attentionSinks?: GPUBuffer | Float32Array | null;
|
|
76
|
+
perLayerInputGate?: GPUBuffer | WeightBuffer | Float32Array | null;
|
|
77
|
+
perLayerProjection?: GPUBuffer | WeightBuffer | Float32Array | null;
|
|
78
|
+
postPerLayerInputNorm?: GPUBuffer | Float32Array | null;
|
|
79
|
+
layerScalar?: GPUBuffer | Float32Array | null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface PerLayerInputWeights {
|
|
83
|
+
embedTokensPerLayer: GPUBuffer | WeightBuffer | CpuWeightBuffer | Float32Array | null;
|
|
84
|
+
embedTokensPerLayerSplit?: (GPUBuffer | WeightBuffer | CpuWeightBuffer | Float32Array | null)[] | null;
|
|
85
|
+
perLayerModelProjection: GPUBuffer | WeightBuffer | Float32Array | null;
|
|
86
|
+
perLayerProjectionNorm: GPUBuffer | Float32Array | null;
|
|
73
87
|
}
|
|
74
88
|
|
|
75
89
|
/**
|
|
@@ -189,6 +203,8 @@ export interface Q4KConfig {
|
|
|
189
203
|
q4kLayout: 'row' | 'col' | null;
|
|
190
204
|
/** Keep weights as F32 (disable F16 downcasting) */
|
|
191
205
|
keepF32Weights: boolean;
|
|
206
|
+
/** Explicit dense/fused/mixed projection materialization mode */
|
|
207
|
+
q4kMaterializationMode?: 'dense' | 'fused' | 'mixed';
|
|
192
208
|
}
|
|
193
209
|
|
|
194
210
|
/**
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
// ============================================================================
|
|
13
13
|
|
|
14
14
|
export interface MemorySnapshot {
|
|
15
|
+
/** Node process memory (Node only) */
|
|
16
|
+
process?: {
|
|
17
|
+
rss: number;
|
|
18
|
+
heapUsed: number;
|
|
19
|
+
heapTotal: number;
|
|
20
|
+
external: number;
|
|
21
|
+
arrayBuffers: number;
|
|
22
|
+
};
|
|
15
23
|
/** JS heap used (Chrome only) */
|
|
16
24
|
jsHeapUsed?: number;
|
|
17
25
|
/** JS heap total (Chrome only) */
|
|
@@ -13,6 +13,18 @@ export function captureMemorySnapshot() {
|
|
|
13
13
|
|
|
14
14
|
const snapshot = {};
|
|
15
15
|
|
|
16
|
+
// Node process memory (available in Node, including direct-source runs)
|
|
17
|
+
if (typeof process !== 'undefined' && typeof process.memoryUsage === 'function') {
|
|
18
|
+
const processMemory = process.memoryUsage();
|
|
19
|
+
snapshot.process = {
|
|
20
|
+
rss: processMemory.rss ?? 0,
|
|
21
|
+
heapUsed: processMemory.heapUsed ?? 0,
|
|
22
|
+
heapTotal: processMemory.heapTotal ?? 0,
|
|
23
|
+
external: processMemory.external ?? 0,
|
|
24
|
+
arrayBuffers: processMemory.arrayBuffers ?? 0,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
// JS Heap (Chrome only)
|
|
17
29
|
const perfMemory = (performance).memory;
|
|
18
30
|
|
|
@@ -54,6 +66,15 @@ export function formatMemoryStats(
|
|
|
54
66
|
|
|
55
67
|
const stats = [`[${elapsed.toFixed(1)}s] Memory (${phase}):`];
|
|
56
68
|
|
|
69
|
+
if (snapshot.process) {
|
|
70
|
+
stats.push(
|
|
71
|
+
`RSS=${formatBytes(snapshot.process.rss)} ` +
|
|
72
|
+
`(heap=${formatBytes(snapshot.process.heapUsed)}/${formatBytes(snapshot.process.heapTotal)}, ` +
|
|
73
|
+
`external=${formatBytes(snapshot.process.external)}, ` +
|
|
74
|
+
`arrayBuffers=${formatBytes(snapshot.process.arrayBuffers)})`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
57
78
|
if (snapshot.jsHeapUsed !== undefined) {
|
|
58
79
|
stats.push(
|
|
59
80
|
`Heap=${formatBytes(snapshot.jsHeapUsed)}/${formatBytes(snapshot.jsHeapTotal ?? 0)} ` +
|
|
@@ -7,10 +7,18 @@
|
|
|
7
7
|
import type { WeightLoadResult } from '../inference/pipelines/text/init.js';
|
|
8
8
|
import type { Manifest } from '../inference/pipelines/text/config.js';
|
|
9
9
|
import type { InferencePipeline, PipelineContexts } from '../inference/pipelines/text.js';
|
|
10
|
-
import type { LoRAManifest } from '../adapters/lora-loader.js';
|
|
11
10
|
import type { LoRAAdapter } from '../inference/pipelines/text/lora.js';
|
|
12
11
|
import type { RDRRManifest } from '../formats/rdrr/index.js';
|
|
13
12
|
|
|
13
|
+
export interface LoRAManifest {
|
|
14
|
+
adapterType?: string;
|
|
15
|
+
modelType?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
rank?: number;
|
|
18
|
+
tensors?: unknown;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
export type AdapterSource =
|
|
15
23
|
| LoRAAdapter
|
|
16
24
|
| LoRAManifest
|
|
@@ -5,7 +5,13 @@ import { parseModelConfig } from '../inference/pipelines/text/config.js';
|
|
|
5
5
|
import { InferencePipeline } from '../inference/pipelines/text.js';
|
|
6
6
|
import { getDopplerLoader } from './doppler-loader.js';
|
|
7
7
|
import { getRuntimeConfig } from '../config/runtime.js';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
let loraModulePromise = null;
|
|
10
|
+
|
|
11
|
+
async function getExperimentalLoRAModule() {
|
|
12
|
+
loraModulePromise ??= import('../experimental/adapters/lora-loader.js');
|
|
13
|
+
return loraModulePromise;
|
|
14
|
+
}
|
|
9
15
|
|
|
10
16
|
export class MultiModelLoader {
|
|
11
17
|
|
|
@@ -30,6 +36,7 @@ export class MultiModelLoader {
|
|
|
30
36
|
|
|
31
37
|
async _resolveAdapterSource(source) {
|
|
32
38
|
if (typeof source === 'string') {
|
|
39
|
+
const { loadLoRAFromUrl } = await getExperimentalLoRAModule();
|
|
33
40
|
return loadLoRAFromUrl(source);
|
|
34
41
|
}
|
|
35
42
|
if (this.#isRDRRManifest(source)) {
|
|
@@ -38,6 +45,7 @@ export class MultiModelLoader {
|
|
|
38
45
|
return loader.loadLoRAWeights(source);
|
|
39
46
|
}
|
|
40
47
|
if (this.#isLoRAManifest(source)) {
|
|
48
|
+
const { loadLoRAFromManifest } = await getExperimentalLoRAModule();
|
|
41
49
|
return loadLoRAFromManifest(source);
|
|
42
50
|
}
|
|
43
51
|
return source;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WeightBuffer } from '../gpu/weight-buffer.js';
|
|
2
|
+
import type { ArchitectureSchema, WeightLayout } from '../config/schema/index.js';
|
|
3
|
+
import type { TensorLocation, PerLayerInputWeights } from './loader-types.js';
|
|
4
|
+
|
|
5
|
+
export interface PerLayerInputLoaderContext {
|
|
6
|
+
modelId?: string | null;
|
|
7
|
+
tensorLocations: Map<string, TensorLocation>;
|
|
8
|
+
gpuBuffers?: Set<GPUBuffer> | null;
|
|
9
|
+
loadTensor: (
|
|
10
|
+
name: string,
|
|
11
|
+
toGPU?: boolean,
|
|
12
|
+
silent?: boolean
|
|
13
|
+
) => Promise<GPUBuffer | WeightBuffer | Float32Array | Uint8Array | null>;
|
|
14
|
+
shouldStreamLargeWeight?: (
|
|
15
|
+
name: string,
|
|
16
|
+
loc: TensorLocation,
|
|
17
|
+
label: string
|
|
18
|
+
) => boolean;
|
|
19
|
+
loadShardRange?: (
|
|
20
|
+
index: number,
|
|
21
|
+
offset: number,
|
|
22
|
+
length: number
|
|
23
|
+
) => Promise<ArrayBuffer>;
|
|
24
|
+
resolveWeightLayout: (loc: TensorLocation) => WeightLayout;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare function loadPerLayerInputWeights(
|
|
28
|
+
ctx: PerLayerInputLoaderContext,
|
|
29
|
+
architecture: ArchitectureSchema | null | undefined
|
|
30
|
+
): Promise<PerLayerInputWeights | null>;
|