runntime 0.0.1-alpha.1 → 0.1.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/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  implemented using TypeGPU. It composes GPU kernels into the layers a model is
10
10
  made of, attention, convolutions, norms, matmuls and builds common
11
11
  architectures out of them. The kernels are plain TypeGPU code compiled to
12
- WGSL at build time, so there is no WASM binary to download at runtime, and
12
+ WGSL at runtime, so there is no WASM binary to download, and
13
13
  the same code runs anywhere WebGPU does: the browser, React Native and
14
14
  Electron.
15
15
 
@@ -34,7 +34,7 @@ It ships as one package, `runntime`, with two entry points:
34
34
  - **One function per task** - `createObjectDetector()` hands you a loaded
35
35
  model. Call `detectObjects(image)`, get boxes back. The `zoo` api is meant to be straight-forward and just work.
36
36
  - **No WASM to download** - the kernels are TypeGPU code compiled
37
- to WGSL at build time, so there is no WASM binary shipped alongside your
37
+ to WGSL at runtime, so there is no WASM binary shipped alongside your
38
38
  app.
39
39
  - **Same code everywhere WebGPU runs** - the browser, React Native (through
40
40
  [react-native-webgpu](https://github.com/wcandillon/react-native-webgpu))
@@ -41864,11 +41864,14 @@ const MOONSHINE_STREAMING_TINY = precisions("moonshine-streaming", "tiny", {
41864
41864
  });
41865
41865
  const PRIVACY_FILTER_INT8 = { modelPath: weights("privacy-filter", "base", "int8g640") };
41866
41866
  const YOLO26_N = { modelPath: weights("yolo26", "n", "f16") };
41867
+ const YOLO26_S = { modelPath: weights("yolo26", "s", "f16") };
41867
41868
  const YOLO26_M = { modelPath: weights("yolo26", "m", "f16") };
41868
41869
  const MOBILENETV4_SMALL = { modelPath: weights("mobilenetv4", "small", "f16") };
41869
41870
  const YOLO26_SEG_N = { modelPath: weights("yolo26-seg", "n", "f16") };
41871
+ const YOLO26_SEG_S = { modelPath: weights("yolo26-seg", "s", "f16") };
41870
41872
  const YOLO26_SEG_M = { modelPath: weights("yolo26-seg", "m", "f16") };
41871
41873
  const YOLO26_POSE_N = { modelPath: weights("yolo26-pose", "n", "f16") };
41874
+ const YOLO26_POSE_S = { modelPath: weights("yolo26-pose", "s", "f16") };
41872
41875
  const YOLO26_POSE_M = { modelPath: weights("yolo26-pose", "m", "f16") };
41873
41876
  const DEPTHART_S = { modelPath: weights("depthart", "s", "f16") };
41874
41877
  const DEPTHART_B = { modelPath: weights("depthart", "b", "f16") };
@@ -41899,16 +41902,20 @@ YOLO26: {
41899
41902
  DEFAULT: YOLO26_N,
41900
41903
  /** The nano size, 5 MB. */
41901
41904
  N: YOLO26_N,
41902
- /** The medium size, 41 MB. More accurate, slower. */
41905
+ /** The small size, 18 MB. */
41906
+ S: YOLO26_S,
41907
+ /** The medium size, 39 MB. More accurate, slower. */
41903
41908
  M: YOLO26_M
41904
41909
  } },
41905
41910
  instanceSegmentation: {
41906
41911
  /** YOLO26 segment, COCO-80 classes with a mask per object, f16 weights. */
41907
41912
  YOLO26_SEG: {
41908
41913
  DEFAULT: YOLO26_SEG_N,
41909
- /** The nano size, 6 MB. */
41914
+ /** The nano size, 5 MB. */
41910
41915
  N: YOLO26_SEG_N,
41911
- /** The medium size, 48 MB. More accurate, slower. */
41916
+ /** The small size, 20 MB. */
41917
+ S: YOLO26_SEG_S,
41918
+ /** The medium size, 45 MB. More accurate, slower. */
41912
41919
  M: YOLO26_SEG_M
41913
41920
  } },
41914
41921
  keypointDetection: {
@@ -41917,7 +41924,9 @@ YOLO26_POSE: {
41917
41924
  DEFAULT: YOLO26_POSE_N,
41918
41925
  /** The nano size, 6 MB. */
41919
41926
  N: YOLO26_POSE_N,
41920
- /** The medium size, 44 MB. More accurate, slower. */
41927
+ /** The small size, 20 MB. */
41928
+ S: YOLO26_POSE_S,
41929
+ /** The medium size, 42 MB. More accurate, slower. */
41921
41930
  M: YOLO26_POSE_M
41922
41931
  } },
41923
41932
  depthEstimation: {
@@ -175,7 +175,11 @@ export declare const models: {
175
175
  readonly N: {
176
176
  modelPath: string;
177
177
  };
178
- /** The medium size, 41 MB. More accurate, slower. */
178
+ /** The small size, 18 MB. */
179
+ readonly S: {
180
+ modelPath: string;
181
+ };
182
+ /** The medium size, 39 MB. More accurate, slower. */
179
183
  readonly M: {
180
184
  modelPath: string;
181
185
  };
@@ -187,11 +191,15 @@ export declare const models: {
187
191
  readonly DEFAULT: {
188
192
  modelPath: string;
189
193
  };
190
- /** The nano size, 6 MB. */
194
+ /** The nano size, 5 MB. */
191
195
  readonly N: {
192
196
  modelPath: string;
193
197
  };
194
- /** The medium size, 48 MB. More accurate, slower. */
198
+ /** The small size, 20 MB. */
199
+ readonly S: {
200
+ modelPath: string;
201
+ };
202
+ /** The medium size, 45 MB. More accurate, slower. */
195
203
  readonly M: {
196
204
  modelPath: string;
197
205
  };
@@ -207,7 +215,11 @@ export declare const models: {
207
215
  readonly N: {
208
216
  modelPath: string;
209
217
  };
210
- /** The medium size, 44 MB. More accurate, slower. */
218
+ /** The small size, 20 MB. */
219
+ readonly S: {
220
+ modelPath: string;
221
+ };
222
+ /** The medium size, 42 MB. More accurate, slower. */
211
223
  readonly M: {
212
224
  modelPath: string;
213
225
  };
@@ -1,4 +1,4 @@
1
- import { $ as initRunntime, A as createMinilmEmbedCore, B as Linear, C as decodeTokens, F as createOpfsCache, H as Module, J as derivedTensor, K as warmUp, L as Conv1d, M as EMBEDDING_DIM, N as MINILM_L6, O as MinilmModel, P as models, Q as gpuExecutor, R as Embedding, T as createDetector, U as ModuleList, V as MultiHeadAttention, W as Parameter, Y as fromSafetensors, Z as evalValues, _ as buildRopeTables, a as MOBILENETV4_CROP_FRACTION, at as writeRows, c as createDetector$1, ct as add, d as move, dt as mul, f as moveTiedEmbedding, ft as silu, g as MoonshineDecoder, h as transformDecoder, ht as supportsF16, it as transpose, l as createTranscriber$1, lt as asinh, m as take, mt as defaultRoot, n as IMAGENET_MEAN, nt as gatherRowsFrom, o as DEPTHART_CONFIGS, ot as argmaxDot, p as qualify, pt as tensor, q as bufferSource, r as IMAGENET_STD, rt as slice, s as createEstimator, st as matmul, t as createClassifier, tt as chunk, u as fuseQkv, ut as gelu, v as splitIntoChunks, w as moonshineTokenizerAsset, z as LayerNorm } from "../classifier-C9dvSwSY.mjs";
1
+ import { $ as initRunntime, A as createMinilmEmbedCore, B as Linear, C as decodeTokens, F as createOpfsCache, H as Module, J as derivedTensor, K as warmUp, L as Conv1d, M as EMBEDDING_DIM, N as MINILM_L6, O as MinilmModel, P as models, Q as gpuExecutor, R as Embedding, T as createDetector, U as ModuleList, V as MultiHeadAttention, W as Parameter, Y as fromSafetensors, Z as evalValues, _ as buildRopeTables, a as MOBILENETV4_CROP_FRACTION, at as writeRows, c as createDetector$1, ct as add, d as move, dt as mul, f as moveTiedEmbedding, ft as silu, g as MoonshineDecoder, h as transformDecoder, ht as supportsF16, it as transpose, l as createTranscriber$1, lt as asinh, m as take, mt as defaultRoot, n as IMAGENET_MEAN, nt as gatherRowsFrom, o as DEPTHART_CONFIGS, ot as argmaxDot, p as qualify, pt as tensor, q as bufferSource, r as IMAGENET_STD, rt as slice, s as createEstimator, st as matmul, t as createClassifier, tt as chunk, u as fuseQkv, ut as gelu, v as splitIntoChunks, w as moonshineTokenizerAsset, z as LayerNorm } from "../classifier-ByH6OI6h.mjs";
2
2
  //#region src/core/lifetime.ts
3
3
  function createResourceScope() {
4
4
  const tracked = [];
@@ -1,4 +1,4 @@
1
- import { $ as initRunntime, D as V2_NER_CLASS_NAMES, E as loadPrivacyFilterModel, F as createOpfsCache, G as inGpuErrorScopes, I as createReplayCache, N as MINILM_L6, O as MinilmModel, P as models, S as configFromCheckpoint, X as httpRangeSource, Y as fromSafetensors, b as MOONSHINE_TINY, c as createDetector, et as toArray, ht as supportsF16, i as MOBILENETV4_CONV_S, j as fillBucketInputs, k as MINILM_BUCKETS, l as createTranscriber, mt as defaultRoot, q as bufferSource, s as createEstimator, t as createClassifier, x as assertConfigMatches, y as MOONSHINE_BASE } from "../../classifier-C9dvSwSY.mjs";
1
+ import { $ as initRunntime, D as V2_NER_CLASS_NAMES, E as loadPrivacyFilterModel, F as createOpfsCache, G as inGpuErrorScopes, I as createReplayCache, N as MINILM_L6, O as MinilmModel, P as models, S as configFromCheckpoint, X as httpRangeSource, Y as fromSafetensors, b as MOONSHINE_TINY, c as createDetector, et as toArray, ht as supportsF16, i as MOBILENETV4_CONV_S, j as fillBucketInputs, k as MINILM_BUCKETS, l as createTranscriber, mt as defaultRoot, q as bufferSource, s as createEstimator, t as createClassifier, x as assertConfigMatches, y as MOONSHINE_BASE } from "../../classifier-ByH6OI6h.mjs";
2
2
  import tgpu from "typegpu";
3
3
  import { AutoConfig, PreTrainedModel, Tensor } from "@huggingface/transformers";
4
4
  //#region src/zoo/transformers/minilm/model.ts
@@ -434,7 +434,8 @@ function selectTopAnchors(levels, opts) {
434
434
  }
435
435
  const order = topIndices(best, maxDet);
436
436
  const count = Math.min(maxDet, total);
437
- const logits = new Float32Array(count * numClasses);
437
+ const outClasses = numClasses + 1;
438
+ const logits = new Float32Array(count * outClasses);
438
439
  const boxes = new Float32Array(count * 4);
439
440
  for (let k = 0; k < count; k++) {
440
441
  let idx = order[k];
@@ -445,7 +446,7 @@ function selectTopAnchors(levels, opts) {
445
446
  }
446
447
  const { data, h, w, stride } = levels[level];
447
448
  const hw = h * w;
448
- for (let c = 0; c < numClasses; c++) logits[k * numClasses + c] = data[(4 + c) * hw + idx];
449
+ for (let c = 0; c < numClasses; c++) logits[k * outClasses + c] = data[(4 + c) * hw + idx];
449
450
  const ax = idx % w + .5;
450
451
  const ay = Math.floor(idx / w) + .5;
451
452
  const l = data[idx];
@@ -461,7 +462,8 @@ function selectTopAnchors(levels, opts) {
461
462
  return {
462
463
  logits,
463
464
  boxes,
464
- count
465
+ count,
466
+ outClasses
465
467
  };
466
468
  }
467
469
  //#endregion
@@ -494,7 +496,7 @@ var RunntimeYolosForObjectDetection = class extends PreTrainedModel {
494
496
  logits: new Tensor("float32", top.logits, [
495
497
  1,
496
498
  top.count,
497
- numClasses
499
+ top.outClasses
498
500
  ]),
499
501
  pred_boxes: new Tensor("float32", top.boxes, [
500
502
  1,
@@ -515,10 +517,15 @@ function yolo26Variant(modelId) {
515
517
  /** The hosted f16 exports, by variant. */
516
518
  const YOLO26_WEIGHTS_URLS = {
517
519
  n: models.objectDetection.YOLO26.N.modelPath,
520
+ s: models.objectDetection.YOLO26.S.modelPath,
518
521
  m: models.objectDetection.YOLO26.M.modelPath
519
522
  };
520
523
  /** Every hub id with a hosted export. */
521
- const YOLO26_MODEL_IDS = ["onnx-community/yolo26n-ONNX", "onnx-community/yolo26m-ONNX"];
524
+ const YOLO26_MODEL_IDS = [
525
+ "onnx-community/yolo26n-ONNX",
526
+ "onnx-community/yolo26s-ONNX",
527
+ "onnx-community/yolo26m-ONNX"
528
+ ];
522
529
  /** `weightsUrl` defaults to the hosted export of the variant in the hub
523
530
  * id; other variants need one. */
524
531
  function yolo26Loader(weightsUrl, opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runntime",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.1.0",
4
4
  "description": "AI models on the web, built with TypeGPU.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "scripts": {
46
46
  "build": "tsdown",
47
47
  "typecheck": "tsc --noEmit",
48
- "prepack": "pnpm run build"
48
+ "prepack": "node ../../scripts/sync-readme.mjs && pnpm run build"
49
49
  },
50
50
  "dependencies": {
51
51
  "js-tiktoken": "^1.0.20"