@genai-fi/nanogpt 0.7.3 → 0.8.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.
Files changed (173) hide show
  1. package/dist/Generator.d.ts +25 -2
  2. package/dist/Generator.js +150 -49
  3. package/dist/{RealDiv-Dy0p8Bvo.js → RealDiv-N8TpOMYv.js} +14 -14
  4. package/dist/{Reshape-DvudQDvJ.js → Reshape-B-lWQRnF.js} +1 -1
  5. package/dist/{Reshape-DH5srBP0.js → Reshape-Bo8HzP8V.js} +5 -5
  6. package/dist/TeachableLLM.d.ts +6 -6
  7. package/dist/TeachableLLM.js +31 -31
  8. package/dist/Trainer.d.ts +13 -2
  9. package/dist/Trainer.js +21 -12
  10. package/dist/{axis_util-BzbKo31C.js → axis_util-DubwyOhW.js} +3 -3
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-TE7aTPhZ.js → backend_util-BJ-_jSeK.js} +46 -46
  13. package/dist/{broadcast_to-CdbwV-Dj.js → broadcast_to-BYfCp5iL.js} +2 -2
  14. package/dist/{concat-CsxrgovM.js → concat-BmDqqFsa.js} +1 -1
  15. package/dist/{dataset-CtdBYwjo.js → dataset-CJmEGu6D.js} +5 -5
  16. package/dist/{dropout-DYs5QFGQ.js → dropout-sx0sjVAT.js} +8 -8
  17. package/dist/exports_initializers-DAKM8UO9.js +16 -0
  18. package/dist/{gather-CMMy2KEG.js → gather-C1siEkdp.js} +1 -1
  19. package/dist/{gelu-C-dPj6Ku.js → gelu-Bd3UBBxg.js} +1 -1
  20. package/dist/{gpgpu_math-DGNLNL4I.js → gpgpu_math-TFLxaLkw.js} +26 -26
  21. package/dist/{index-CLthM0TO.js → index-BaPo_0H8.js} +185 -185
  22. package/dist/{index-BoWRt-10.js → index-CUQrfsw_.js} +266 -265
  23. package/dist/{kernel_funcs_utils-BYKWV8Aa.js → kernel_funcs_utils-P9aFa232.js} +9 -9
  24. package/dist/layers/BaseLayer.d.ts +8 -13
  25. package/dist/layers/BaseLayer.js +25 -13
  26. package/dist/layers/CausalSelfAttention.d.ts +3 -2
  27. package/dist/layers/CausalSelfAttention.js +28 -28
  28. package/dist/layers/MLP.d.ts +3 -2
  29. package/dist/layers/MLP.js +16 -20
  30. package/dist/layers/PositionEmbedding.d.ts +9 -0
  31. package/dist/layers/PositionEmbedding.js +45 -0
  32. package/dist/layers/RMSNorm.d.ts +3 -2
  33. package/dist/layers/RMSNorm.js +6 -6
  34. package/dist/layers/RoPECache.d.ts +1 -1
  35. package/dist/layers/RoPECache.js +4 -4
  36. package/dist/layers/TiedEmbedding.d.ts +3 -2
  37. package/dist/layers/TiedEmbedding.js +29 -7
  38. package/dist/layers/TransformerBlock.d.ts +3 -2
  39. package/dist/layers/TransformerBlock.js +1 -1
  40. package/dist/loader/load.d.ts +2 -2
  41. package/dist/loader/loadHF.d.ts +2 -2
  42. package/dist/loader/loadTransformers.d.ts +4 -2
  43. package/dist/loader/loadTransformers.js +10 -9
  44. package/dist/loader/newZipLoad.d.ts +2 -2
  45. package/dist/loader/oldZipLoad.d.ts +2 -2
  46. package/dist/loader/oldZipLoad.js +42 -51
  47. package/dist/loader/save.d.ts +8 -0
  48. package/dist/loader/save.js +62 -0
  49. package/dist/{log_sum_exp-DbjkV734.js → log_sum_exp-C142qZqY.js} +14 -14
  50. package/dist/main.d.ts +5 -4
  51. package/dist/main.js +22 -18
  52. package/dist/{mat_mul-8m8pfdcx.js → mat_mul-DMkduNJu.js} +1 -1
  53. package/dist/{max-Ddnnb5xe.js → max-B3JOcNGb.js} +1 -1
  54. package/dist/mod-uUuj4gSb.js +27 -0
  55. package/dist/models/NanoGPTV1.d.ts +15 -0
  56. package/dist/models/NanoGPTV1.js +71 -0
  57. package/dist/{config.d.ts → models/config.d.ts} +1 -0
  58. package/dist/{config.js → models/config.js} +1 -0
  59. package/dist/models/factory.d.ts +3 -0
  60. package/dist/models/factory.js +14 -0
  61. package/dist/models/model.d.ts +26 -0
  62. package/dist/models/model.js +68 -0
  63. package/dist/{mulmat_packed_gpu-VSekgsNv.js → mulmat_packed_gpu-Cm2gw-c8.js} +1 -1
  64. package/dist/{ones-Dj0SDhHf.js → ones-ZdgQGBCP.js} +2 -2
  65. package/dist/ops/adamAdjust.js +1 -1
  66. package/dist/ops/adamMoments.js +1 -1
  67. package/dist/ops/appendCache.js +3 -3
  68. package/dist/ops/attentionMask.js +1 -1
  69. package/dist/ops/cpu/adamAdjust.js +9 -9
  70. package/dist/ops/cpu/adamMoments.js +2 -2
  71. package/dist/ops/cpu/appendCache.js +2 -2
  72. package/dist/ops/cpu/attentionMask.js +5 -5
  73. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  74. package/dist/ops/cpu/gatherSub.js +3 -3
  75. package/dist/ops/cpu/gelu.js +1 -1
  76. package/dist/ops/cpu/matMulGelu.js +2 -2
  77. package/dist/ops/cpu/matMulMul.js +1 -1
  78. package/dist/ops/cpu/mulDropout.js +1 -1
  79. package/dist/ops/cpu/normRMS.js +1 -1
  80. package/dist/ops/cpu/qkv.js +3 -3
  81. package/dist/ops/cpu/rope.js +5 -5
  82. package/dist/ops/cpu/scatterSub.js +11 -11
  83. package/dist/ops/fusedSoftmax.js +1 -1
  84. package/dist/ops/gatherSub.js +1 -1
  85. package/dist/ops/gelu.js +2 -2
  86. package/dist/ops/grads/attentionMask.js +1 -1
  87. package/dist/ops/grads/fusedSoftmax.js +2 -2
  88. package/dist/ops/grads/gelu.js +2 -2
  89. package/dist/ops/grads/matMulGelu.js +1 -1
  90. package/dist/ops/grads/normRMS.js +1 -1
  91. package/dist/ops/grads/qkv.js +1 -1
  92. package/dist/ops/grads/rope.js +1 -1
  93. package/dist/ops/matMulGelu.js +1 -1
  94. package/dist/ops/matMulMul.js +1 -1
  95. package/dist/ops/mulDrop.js +1 -1
  96. package/dist/ops/normRMS.js +1 -1
  97. package/dist/ops/qkv.js +1 -1
  98. package/dist/ops/rope.js +4 -4
  99. package/dist/ops/scatterSub.js +1 -1
  100. package/dist/ops/webgl/adamAdjust.js +2 -2
  101. package/dist/ops/webgl/adamMoments.js +1 -1
  102. package/dist/ops/webgl/appendCache.js +1 -1
  103. package/dist/ops/webgl/attentionMask.js +1 -1
  104. package/dist/ops/webgl/fusedSoftmax.js +4 -4
  105. package/dist/ops/webgl/gatherSub.js +1 -1
  106. package/dist/ops/webgl/gelu.js +2 -2
  107. package/dist/ops/webgl/log.js +3 -3
  108. package/dist/ops/webgl/matMulGelu.js +10 -10
  109. package/dist/ops/webgl/matMulMul.js +1 -1
  110. package/dist/ops/webgl/mulDropout.js +1 -1
  111. package/dist/ops/webgl/normRMS.js +2 -2
  112. package/dist/ops/webgl/qkv.js +1 -1
  113. package/dist/ops/webgl/rope.js +1 -1
  114. package/dist/ops/webgl/scatterSub.js +1 -1
  115. package/dist/ops/webgpu/adamAdjust.js +3 -3
  116. package/dist/ops/webgpu/adamMoments.js +3 -3
  117. package/dist/ops/webgpu/appendCache.js +3 -3
  118. package/dist/ops/webgpu/attentionMask.js +3 -3
  119. package/dist/ops/webgpu/gatherSub.js +3 -3
  120. package/dist/ops/webgpu/gelu.js +3 -3
  121. package/dist/ops/webgpu/normRMS.js +2 -2
  122. package/dist/ops/webgpu/normRMSGrad.js +5 -5
  123. package/dist/ops/webgpu/qkv.js +3 -3
  124. package/dist/ops/webgpu/rope.js +3 -3
  125. package/dist/ops/webgpu/scatterSub.js +3 -3
  126. package/dist/ops/webgpu/utils/reductions.js +4 -4
  127. package/dist/{ops-BFGCx8Ri.js → ops-C_1K_-35.js} +103 -103
  128. package/dist/{random_width-sZORGo5k.js → random_width-D8Pwy_na.js} +136 -136
  129. package/dist/{range-CRuAh-gd.js → range-LVHrSLdi.js} +1 -1
  130. package/dist/{reciprocal-BvGAyKyu.js → reciprocal-CaR9e67G.js} +1 -1
  131. package/dist/{register_all_kernels-BwDSRN-f.js → register_all_kernels-DUshvVWP.js} +2026 -2049
  132. package/dist/{reshape-CdBq1WJ6.js → reshape-DEfQGSin.js} +1 -1
  133. package/dist/{scatter_nd_util-DUstGbU1.js → scatter_nd_util-CUPPNLaA.js} +1 -1
  134. package/dist/{selu_util-BJEXVvjX.js → selu_util-8vv5JxQV.js} +3 -3
  135. package/dist/{shared-B8ztnyEk.js → shared-CkNorDcU.js} +83 -83
  136. package/dist/{shared-wS99K7_n.js → shared-D1elLckx.js} +1 -1
  137. package/dist/{sin-BeA3tsEd.js → sin-D2CKKmyR.js} +1 -1
  138. package/dist/{slice-BiOsknYS.js → slice-BnyE-M_7.js} +1 -1
  139. package/dist/{softmax-Bv_6lyMX.js → softmax-DLoZWYBx.js} +1 -1
  140. package/dist/{split-B-dikLRw.js → split-By_n4TKP.js} +1 -1
  141. package/dist/{stack-B17UN2nn.js → stack-DkdFLq37.js} +1 -1
  142. package/dist/{sum-66ew2byf.js → sum-l_0SqM4h.js} +3 -3
  143. package/dist/{tensor-JwS7ZYY6.js → tensor-BAQdLqoU.js} +1 -1
  144. package/dist/{tensor2d-wxPAnDQy.js → tensor2d-BHy261cI.js} +1 -1
  145. package/dist/training/Adam.js +2 -2
  146. package/dist/training/AdamExt.js +1 -1
  147. package/dist/training/DatasetBuilder.js +2 -2
  148. package/dist/training/Evaluator.d.ts +2 -2
  149. package/dist/training/FullTrainer.d.ts +3 -3
  150. package/dist/training/FullTrainer.js +61 -69
  151. package/dist/training/Trainer.d.ts +15 -3
  152. package/dist/training/Trainer.js +39 -47
  153. package/dist/training/sparseCrossEntropy.js +9 -9
  154. package/dist/utilities/dummy.d.ts +4 -4
  155. package/dist/utilities/dummy.js +13 -13
  156. package/dist/utilities/multinomialCPU.js +2 -2
  157. package/dist/utilities/parameters.d.ts +1 -1
  158. package/dist/utilities/performance.js +1 -1
  159. package/dist/utilities/profile.js +1 -1
  160. package/dist/utilities/safetensors.js +2 -2
  161. package/dist/utilities/weights.js +2 -2
  162. package/dist/{variable-BuddVFLa.js → variable-C9hihzDB.js} +1 -1
  163. package/dist/{webgpu_program-PFzf1hAQ.js → webgpu_program-dFEVbDPL.js} +1 -1
  164. package/dist/{webgpu_util-D____QpY.js → webgpu_util-DLImlSc6.js} +27 -27
  165. package/dist/{zeros--BdLQ3oG.js → zeros-VZ72lWXM.js} +1 -1
  166. package/package.json +2 -3
  167. package/dist/NanoGPTModel.d.ts +0 -52
  168. package/dist/NanoGPTModel.js +0 -203
  169. package/dist/TiedEmbedding-BxOerUmB.js +0 -43
  170. package/dist/utilities/generate.d.ts +0 -3
  171. package/dist/utilities/generate.js +0 -22
  172. package/dist/utilities/save.d.ts +0 -9
  173. package/dist/utilities/save.js +0 -61
package/dist/Trainer.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import { E as l } from "./index-Dwqa6Zy2.js";
2
2
  import h from "./training/FullTrainer.js";
3
- class p extends l {
3
+ class m extends l {
4
4
  trainer;
5
5
  hasTrained = !1;
6
6
  trainDataset;
7
7
  validationDataset;
8
8
  totalSamples = 0;
9
+ log = [];
10
+ progress = null;
9
11
  constructor(t, e) {
10
12
  super(), this.trainer = new h(t, e, 1e-3);
11
13
  }
@@ -13,7 +15,7 @@ class p extends l {
13
15
  this.trainer.stop();
14
16
  }
15
17
  reset() {
16
- this.hasTrained = !1, this.trainer.reset();
18
+ this.hasTrained = !1, this.log = [], this.trainer.reset();
17
19
  }
18
20
  async prepare(t, e) {
19
21
  const { trainDataset: a, validationDataset: s } = await this.trainer.createTrainValidationSplit(
@@ -26,7 +28,7 @@ class p extends l {
26
28
  async train(t) {
27
29
  if (!this.trainDataset || !this.validationDataset)
28
30
  throw new Error("Datasets not prepared");
29
- this.hasTrained || this.trainer.setLearningRate(t?.learningRate || 1e-3), this.hasTrained = !0, this.emit("start"), await this.trainer.trainOnDataset(
31
+ this.hasTrained || this.trainer.setLearningRate(t?.learningRate || 1e-3), this.hasTrained = !0, this.emit("start"), this.trainer.setGradientCheckpointing(t?.gradientCheckpointing || !1), await this.trainer.trainOnDataset(
30
32
  this.trainDataset,
31
33
  {
32
34
  prompt: t?.prompt,
@@ -35,16 +37,17 @@ class p extends l {
35
37
  maxSteps: t?.maxSteps || 1e3,
36
38
  advancedMetrics: t?.advancedMetrics || !1,
37
39
  onStep: async (e, a) => {
40
+ this.log.push(e), this.progress = {
41
+ ...a,
42
+ progress: a.totalSamples / this.totalSamples,
43
+ remaining: Math.max(
44
+ 0,
45
+ (this.totalSamples - a.totalSamples) / a.totalSamples * a.duration
46
+ )
47
+ };
38
48
  const s = this.listeners("log");
39
49
  for (const i of s)
40
- await i(e, {
41
- ...a,
42
- progress: a.totalSamples / this.totalSamples,
43
- remaining: Math.max(
44
- 0,
45
- (this.totalSamples - a.totalSamples) / a.totalSamples * a.duration
46
- )
47
- });
50
+ await i(e, this.progress);
48
51
  }
49
52
  },
50
53
  this.validationDataset
@@ -76,7 +79,13 @@ class p extends l {
76
79
  });
77
80
  this.emit("stop");
78
81
  }
82
+ getLog() {
83
+ return this.log;
84
+ }
85
+ getProgress() {
86
+ return this.progress;
87
+ }
79
88
  }
80
89
  export {
81
- p as default
90
+ m as default
82
91
  };
@@ -1,4 +1,4 @@
1
- import { l as c } from "./index-BoWRt-10.js";
1
+ import { n as c } from "./index-CUQrfsw_.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2017 Google LLC. All Rights Reserved.
@@ -28,7 +28,7 @@ function a(e, n, t) {
28
28
  t.indexOf(u) === -1 ? s.push(e[o++]) : s.push(n[f++]);
29
29
  return s;
30
30
  }
31
- function p(e, n) {
31
+ function l(e, n) {
32
32
  const t = [], r = e.length;
33
33
  for (let o = 0; o < r; o++)
34
34
  n.indexOf(o) === -1 && t.push(e[o]);
@@ -62,7 +62,7 @@ function x(e, n) {
62
62
  export {
63
63
  x as a,
64
64
  m as b,
65
- p as c,
65
+ l as c,
66
66
  i as d,
67
67
  h as e,
68
68
  a as f,
package/dist/backend.js CHANGED
@@ -1,6 +1,6 @@
1
- import { g as a, s as i, r as o } from "./index-BoWRt-10.js";
1
+ import { g as a, s as i, r as o } from "./index-CUQrfsw_.js";
2
2
  async function e(t) {
3
- a() !== t && (t === "webgpu" && (await import("./index-CLthM0TO.js"), await import("./ops/webgpu/index.js")), await i(t), await o(), console.log(`Backend set to ${t}`));
3
+ a() !== t && (t === "webgpu" && (await import("./index-BaPo_0H8.js"), await import("./ops/webgpu/index.js")), await i(t), await o(), console.log(`Backend set to ${t}`));
4
4
  }
5
5
  export {
6
6
  e as selectBackend
@@ -1,7 +1,7 @@
1
- import { j as m, a1 as O, l as g, aK as $, aL as R, aM as M, k as _, aa as y, aw as D, aN as T, u as b, aO as F } from "./index-BoWRt-10.js";
2
- import { b as L, d as W, f as v, c as N, e as x, g as P, a as C, h as z } from "./axis_util-BzbKo31C.js";
3
- import { S as U, a as B, b as V, c as j, d as k, e as G, f as H, g as q, h as Z, i as K, j as X, k as J, l as Y, m as Q, s as ee, n as te, o as ne, t as se } from "./selu_util-BJEXVvjX.js";
4
- import { c as re, v as oe, a as ae } from "./scatter_nd_util-DUstGbU1.js";
1
+ import { j as m, a2 as O, n as g, aM as $, aN as R, aO as M, l as _, ad as y, ay as D, aP as T, u as b, aQ as F } from "./index-CUQrfsw_.js";
2
+ import { b as L, d as W, f as v, c as N, e as x, g as P, a as C, h as z } from "./axis_util-DubwyOhW.js";
3
+ import { S as U, a as B, b as V, c as j, d as G, e as H, f as k, g as q, h as Z, i as X, j as J, k as K, l as Q, m as Y, s as ee, n as te, o as ne, t as se } from "./selu_util-8vv5JxQV.js";
4
+ import { c as re, v as oe, a as ae } from "./scatter_nd_util-CUPPNLaA.js";
5
5
  function ie(e, n) {
6
6
  const r = e.shape.length, t = n.shape.length;
7
7
  if (r < 1)
@@ -233,7 +233,7 @@ function Ie(e, n) {
233
233
  r.push(e[t][0]);
234
234
  return r;
235
235
  }
236
- function we(e, n, r) {
236
+ function Se(e, n, r) {
237
237
  const t = e.slice(0, 1);
238
238
  for (let s = 0; s < r; ++s)
239
239
  t.push(e[s + 1] - n[s][0] - n[s][1]);
@@ -255,7 +255,7 @@ function we(e, n, r) {
255
255
  * limitations under the License.
256
256
  * =============================================================================
257
257
  */
258
- const Se = 0.3275911, Ae = 0.254829592, Oe = -0.284496736, Re = 1.421413741, Me = -1.453152027, _e = 1.061405429;
258
+ const we = 0.3275911, Ae = 0.254829592, Oe = -0.284496736, Re = 1.421413741, Me = -1.453152027, _e = 1.061405429;
259
259
  /**
260
260
  * @license
261
261
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -333,7 +333,7 @@ function ve(e, n, r) {
333
333
  * limitations under the License.
334
334
  * =============================================================================
335
335
  */
336
- const E = "->", Ne = /->/g, w = ",", S = "...";
336
+ const E = "->", Ne = /->/g, S = ",", w = "...";
337
337
  function xe(e, n) {
338
338
  e = e.replace(/\s/g, "");
339
339
  const r = (e.length - e.replace(Ne, "").length) / E.length;
@@ -342,8 +342,8 @@ function xe(e, n) {
342
342
  if (r > 1)
343
343
  throw new Error(`Equation must contain exactly one arrow ("${E}").`);
344
344
  const [t, s] = e.split(E);
345
- g(t.indexOf(S) === -1, () => `The ellipsis notation ("${S}") is not supported yet.`);
346
- const o = t.split(w), a = o.length;
345
+ g(t.indexOf(w) === -1, () => `The ellipsis notation ("${w}") is not supported yet.`);
346
+ const o = t.split(S), a = o.length;
347
347
  if (n !== a)
348
348
  throw new Error(`Expected ${a} input tensors, received ${n}`);
349
349
  if (a > 2)
@@ -357,7 +357,7 @@ function xe(e, n) {
357
357
  }
358
358
  for (let l = 0; l < t.length; ++l) {
359
359
  const f = t[l];
360
- u.indexOf(f) === -1 && f !== w && u.push(f);
360
+ u.indexOf(f) === -1 && f !== S && u.push(f);
361
361
  }
362
362
  const c = new Array(o.length);
363
363
  for (let l = 0; l < a; ++l) {
@@ -449,10 +449,10 @@ function je(e) {
449
449
  return `Received SparseTensor with denseShape[0] = 0 but
450
450
  indices.shape[0] = ${e}`;
451
451
  }
452
- function ke(e, n) {
452
+ function Ge(e, n) {
453
453
  return `indices(${e}, 0) is invalid: ${n} < 0`;
454
454
  }
455
- function Ge(e, n, r) {
455
+ function He(e, n, r) {
456
456
  return `indices(${e}, 0) is invalid: ${n} >= ${r}`;
457
457
  }
458
458
  /**
@@ -471,7 +471,7 @@ function Ge(e, n, r) {
471
471
  * limitations under the License.
472
472
  * =============================================================================
473
473
  */
474
- function He(e, n) {
474
+ function ke(e, n) {
475
475
  return `only one output dimension may be -1, not both ${e} and ${n}`;
476
476
  }
477
477
  function qe(e, n) {
@@ -480,12 +480,12 @@ function qe(e, n) {
480
480
  function Ze() {
481
481
  return "reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero";
482
482
  }
483
- function Ke(e, n) {
483
+ function Xe(e, n) {
484
484
  const r = m(e), t = m(n);
485
485
  return `Input to reshape is a SparseTensor with ${r}
486
486
  dense values, but the requested shape requires a multiple of ${t}. inputShape=${e} outputShape= ${n}`;
487
487
  }
488
- function Xe(e, n) {
488
+ function Je(e, n) {
489
489
  const r = m(e), t = m(n);
490
490
  return `Input to reshape is a tensor with ${r} dense values, but the requested shape has ${t}. inputShape=${e} outputShape=${n}`;
491
491
  }
@@ -505,13 +505,13 @@ function Xe(e, n) {
505
505
  * limitations under the License.
506
506
  * =============================================================================
507
507
  */
508
- function Je() {
508
+ function Ke() {
509
509
  return "segment ids must be >= 0";
510
510
  }
511
- function Ye() {
511
+ function Qe() {
512
512
  return "segment ids are not increasing";
513
513
  }
514
- function Qe(e, n) {
514
+ function Ye(e, n) {
515
515
  return `Segment id ${e} out of range [0, ${n}), possibly because segmentIds input is not sorted.`;
516
516
  }
517
517
  function et(e, n, r) {
@@ -608,7 +608,7 @@ const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
608
608
  ERF_A3: Re,
609
609
  ERF_A4: Me,
610
610
  ERF_A5: _e,
611
- ERF_P: Se,
611
+ ERF_P: we,
612
612
  PARALLELIZE_THRESHOLD: I,
613
613
  get RowPartitionType() {
614
614
  return p;
@@ -628,18 +628,18 @@ const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
628
628
  combineRaggedTensorToTensorShapes: ce,
629
629
  complexWithEvenIndex: Te,
630
630
  complexWithOddIndex: be,
631
- computeConv2DInfo: k,
632
- computeConv3DInfo: G,
633
- computeDefaultPad: H,
631
+ computeConv2DInfo: G,
632
+ computeConv3DInfo: H,
633
+ computeDefaultPad: k,
634
634
  computeDilation2DInfo: q,
635
635
  computeOptimalWindowSize: ge,
636
636
  computeOutAndReduceShapes: N,
637
637
  computeOutShape: le,
638
638
  computePool2DInfo: Z,
639
- computePool3DInfo: K,
640
- convertConv2DDataFormat: X,
639
+ computePool3DInfo: X,
640
+ convertConv2DDataFormat: J,
641
641
  decodeEinsumEquation: xe,
642
- eitherStridesOrDilationsAreOne: J,
642
+ eitherStridesOrDilationsAreOne: K,
643
643
  expandShapeToKeepDim: x,
644
644
  exponent: ve,
645
645
  exponents: We,
@@ -650,8 +650,8 @@ const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
650
650
  getComplexWithIndex: Fe,
651
651
  getEinsumComputePath: ze,
652
652
  getEinsumPermutation: Pe,
653
- getFusedBiasGradient: Y,
654
- getFusedDyActivation: Q,
653
+ getFusedBiasGradient: Q,
654
+ getFusedDyActivation: Y,
655
655
  getImageCenter: de,
656
656
  getInnerMostAxes: C,
657
657
  getPermuted: Ee,
@@ -661,19 +661,19 @@ const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
661
661
  getReshapedPermuted: $e,
662
662
  getRowPartitionTypesHelper: he,
663
663
  getSliceBeginCoords: Ie,
664
- getSliceSize: we,
664
+ getSliceSize: Se,
665
665
  getSparseFillEmptyRowsIndicesDenseShapeMismatch: je,
666
- getSparseFillEmptyRowsNegativeIndexErrorMessage: ke,
667
- getSparseFillEmptyRowsOutOfRangeIndexErrorMessage: Ge,
666
+ getSparseFillEmptyRowsNegativeIndexErrorMessage: Ge,
667
+ getSparseFillEmptyRowsOutOfRangeIndexErrorMessage: He,
668
668
  getSparseReshapeEmptyTensorZeroOutputDimErrorMessage: Ze,
669
- getSparseReshapeInputOutputMismatchErrorMessage: Xe,
670
- getSparseReshapeInputOutputMultipleErrorMessage: Ke,
671
- getSparseReshapeMultipleNegativeOneOutputDimErrorMessage: He,
669
+ getSparseReshapeInputOutputMismatchErrorMessage: Je,
670
+ getSparseReshapeInputOutputMultipleErrorMessage: Xe,
671
+ getSparseReshapeMultipleNegativeOneOutputDimErrorMessage: ke,
672
672
  getSparseReshapeNegativeOutputDimErrorMessage: qe,
673
673
  getSparseSegmentReductionIndicesOutOfRangeErrorMessage: et,
674
- getSparseSegmentReductionNegativeSegmentIdsErrorMessage: Je,
675
- getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage: Ye,
676
- getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage: Qe,
674
+ getSparseSegmentReductionNegativeSegmentIdsErrorMessage: Ke,
675
+ getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage: Qe,
676
+ getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage: Ye,
677
677
  getUndoAxesPermutation: z,
678
678
  isIdentityPermutation: Ue,
679
679
  log: T,
@@ -697,8 +697,8 @@ export {
697
697
  Ee as B,
698
698
  $e as C,
699
699
  Ie as D,
700
- Se as E,
701
- we as F,
700
+ we as E,
701
+ Se as F,
702
702
  le as G,
703
703
  ue as H,
704
704
  xe as I,
@@ -728,17 +728,17 @@ export {
728
728
  ot as f,
729
729
  he as g,
730
730
  je as h,
731
- ke as i,
732
- Ge as j,
733
- He as k,
731
+ Ge as i,
732
+ He as j,
733
+ ke as k,
734
734
  qe as l,
735
735
  ye as m,
736
736
  Ze as n,
737
- Ke as o,
738
- Xe as p,
739
- Je as q,
740
- Ye as r,
741
- Qe as s,
737
+ Xe as o,
738
+ Je as p,
739
+ Ke as q,
740
+ Qe as r,
741
+ Ye as s,
742
742
  et as t,
743
743
  Ae as u,
744
744
  pe as v,
@@ -1,5 +1,5 @@
1
- import { B as h, C as f, F as p, M as g, E as u, N as b } from "./index-BoWRt-10.js";
2
- import { r as T } from "./reshape-CdBq1WJ6.js";
1
+ import { B as h, C as f, L as p, F as g, E as u, W as b } from "./index-CUQrfsw_.js";
2
+ import { r as T } from "./reshape-DEfQGSin.js";
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { B as s, l as a, D as p, M as i, E as l, Q as f } from "./index-BoWRt-10.js";
1
+ import { B as s, n as a, D as p, F as i, E as l, H as f } from "./index-CUQrfsw_.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1,7 +1,7 @@
1
- import { ag as S, T as h, ac as N, d as v, ah as o, ai as p, aj as g, l as k, t as y } from "./index-BoWRt-10.js";
1
+ import { ai as S, T as h, af as k, d as v, aj as o, ak as p, al as g, n as N, t as y } from "./index-CUQrfsw_.js";
2
2
  import { s as R } from "./index-C4L8Cm77.js";
3
- import { s as $ } from "./stack-B17UN2nn.js";
4
- import { t as B } from "./tensor-JwS7ZYY6.js";
3
+ import { s as $ } from "./stack-DkdFLq37.js";
4
+ import { t as B } from "./tensor-BAQdLqoU.js";
5
5
  /**
6
6
  * @license
7
7
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -75,7 +75,7 @@ function I(s) {
75
75
  }
76
76
  function c(s) {
77
77
  let t = !1;
78
- if (N().get("IS_BROWSER"))
78
+ if (k().get("IS_BROWSER"))
79
79
  t = s instanceof TextDecoder;
80
80
  else {
81
81
  const { StringDecoder: e } = require("string_decoder");
@@ -930,7 +930,7 @@ class T {
930
930
  */
931
931
  batch(t, e = !0) {
932
932
  const r = this;
933
- k(t > 0, () => `batchSize needs to be positive, but it is
933
+ N(t > 0, () => `batchSize needs to be positive, but it is
934
934
  ${t}`);
935
935
  let n;
936
936
  return this.size === 1 / 0 || this.size == null ? n = this.size : e ? n = Math.ceil(this.size / t) : n = Math.floor(this.size / t), u(async () => (await r.iterator()).columnMajorBatch(t, e, st), n);
@@ -1,4 +1,4 @@
1
- import { B as l, C as h, E as m, ak as p, F as c, al as d, ab as g, l as u, T as V, n as v, o as N, a as w } from "./index-BoWRt-10.js";
1
+ import { B as l, C as h, E as m, am as p, L as c, an as d, ae as g, n as u, T as V, o as v, q as N, a as w } from "./index-CUQrfsw_.js";
2
2
  import { s as f } from "./index-C4L8Cm77.js";
3
3
  /**
4
4
  * @license
@@ -16,11 +16,11 @@ import { s as f } from "./index-C4L8Cm77.js";
16
16
  * limitations under the License.
17
17
  * =============================================================================
18
18
  */
19
- function b(r) {
19
+ function x(r) {
20
20
  const e = { x: h(r, "x", "floor", "float32") };
21
21
  return m.runKernel(p, e);
22
22
  }
23
- const x = /* @__PURE__ */ l({ floor_: b });
23
+ const b = /* @__PURE__ */ l({ floor_: x });
24
24
  /**
25
25
  * @license
26
26
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -176,18 +176,18 @@ function E(r, t) {
176
176
  * limitations under the License.
177
177
  * =============================================================================
178
178
  */
179
- function F(r, t, e, s) {
179
+ function R(r, t, e, s) {
180
180
  const n = h(r, "x", "dropout");
181
181
  if (u(n.dtype === "float32", () => `x has to be a floating point tensor since it's going to be scaled, but got a ${n.dtype} tensor instead.`), u(t >= 0 && t < 1, () => `rate must be a float in the range [0, 1), but got ${t}.`), t === 0)
182
182
  return r instanceof V ? n.clone() : n;
183
- const o = E(n, e), a = 1 - t, i = v(x(N(D(o, 0, 1, "float32", s), a)), a);
183
+ const o = E(n, e), a = 1 - t, i = v(b(N(D(o, 0, 1, "float32", s), a)), a);
184
184
  return w(n, i);
185
185
  }
186
- const G = /* @__PURE__ */ l({ dropout_: F });
186
+ const q = /* @__PURE__ */ l({ dropout_: R });
187
187
  export {
188
188
  T as M,
189
189
  D as a,
190
- G as d,
191
- x as f,
190
+ q as d,
191
+ b as f,
192
192
  _ as r
193
193
  };
@@ -0,0 +1,16 @@
1
+ import { R as o } from "./random_width-D8Pwy_na.js";
2
+ /**
3
+ * @license
4
+ * Copyright 2018 Google LLC
5
+ *
6
+ * Use of this source code is governed by an MIT-style
7
+ * license that can be found in the LICENSE file or at
8
+ * https://opensource.org/licenses/MIT.
9
+ * =============================================================================
10
+ */
11
+ function m(r) {
12
+ return new o(r);
13
+ }
14
+ export {
15
+ m as r
16
+ };
@@ -1,4 +1,4 @@
1
- import { B as g, C as t, E as h, G as p } from "./index-BoWRt-10.js";
1
+ import { B as g, C as t, E as h, G as p } from "./index-CUQrfsw_.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { i as t, e as n } from "./index-BoWRt-10.js";
1
+ import { i as t, e as n } from "./index-CUQrfsw_.js";
2
2
  import "./ops/cpu/gelu.js";
3
3
  import "./ops/webgl/gelu.js";
4
4
  const a = {
@@ -1,6 +1,6 @@
1
- import { aA as z, ac as v, aB as oe, aC as ie, aD as ae, l as F, aE as me, aF as J, a1 as B, aG as I, ab as T, j as E, aH as H, aI as $e, aJ as Y, aa as Te } from "./index-BoWRt-10.js";
1
+ import { aC as z, af as v, aD as oe, aE as ie, aF as ae, n as F, aG as me, aH as J, a2 as B, aI as I, ae as T, j as E, aJ as H, aK as $e, aL as Y, ad as Te } from "./index-CUQrfsw_.js";
2
2
  import "./index-Tf7vU29b.js";
3
- import { b as Se } from "./backend_util-TE7aTPhZ.js";
3
+ import { b as Se } from "./backend_util-BJ-_jSeK.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -104,7 +104,7 @@ async function ge(e, t) {
104
104
  const n = t.fetchFunc == null ? v().platform.fetch : t.fetchFunc, r = e.map((f) => n(f, t.requestInit, { isBinary: !0 })), s = (t.onProgress == null ? await Promise.all(r) : await Z(r, t.onProgress, 0, 0.5)).map((f) => f.arrayBuffer());
105
105
  return t.onProgress == null ? await Promise.all(s) : await Z(s, t.onProgress, 0.5, 1);
106
106
  }
107
- function Ae(e, t) {
107
+ function _e(e, t) {
108
108
  var n;
109
109
  const r = t.fetchFunc == null ? v().platform.fetch : t.fetchFunc;
110
110
  let o = 0, i;
@@ -140,7 +140,7 @@ function Ae(e, t) {
140
140
  * limitations under the License.
141
141
  * =============================================================================
142
142
  */
143
- const _e = "application/octet-stream", Ne = "application/json";
143
+ const Ae = "application/octet-stream", Ne = "application/json";
144
144
  class q {
145
145
  constructor(t, n) {
146
146
  if (this.DEFAULT_METHOD = "POST", n == null && (n = {}), this.weightPathPrefix = n.weightPathPrefix, this.weightUrlConverter = n.weightUrlConverter, n.fetchFunc != null ? (F(typeof n.fetchFunc == "function", () => "Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"), this.fetch = n.fetchFunc) : this.fetch = v().platform.fetch, F(t != null && t.length > 0, () => "URL path for http must not be null, undefined or empty."), Array.isArray(t) && F(t.length === 2, () => `URL paths for http must have a length of 2, (actual length is ${t.length}).`), this.path = t, n.requestInit != null && n.requestInit.body != null)
@@ -158,7 +158,7 @@ class q {
158
158
  }], o = ie(t, r);
159
159
  if (n.body.append("model.json", new Blob([JSON.stringify(o)], { type: Ne }), "model.json"), t.weightData != null) {
160
160
  const a = oe.join(t.weightData);
161
- n.body.append("model.weights.bin", new Blob([a], { type: _e }), "model.weights.bin");
161
+ n.body.append("model.weights.bin", new Blob([a], { type: Ae }), "model.weights.bin");
162
162
  }
163
163
  const i = await this.fetch(this.path, n);
164
164
  if (i.ok)
@@ -199,7 +199,7 @@ class q {
199
199
  return me(t, (n) => this.loadWeights(n));
200
200
  }
201
201
  async loadStream() {
202
- const t = await this.loadModelJSON(), n = await this.getWeightUrls(t.weightsManifest), r = J(t.weightsManifest), o = () => Ae(n, this.loadOptions);
202
+ const t = await this.loadModelJSON(), n = await this.getWeightUrls(t.weightsManifest), r = J(t.weightsManifest), o = () => _e(n, this.loadOptions);
203
203
  return Object.assign(Object.assign({}, t), { weightSpecs: r, getWeightStream: o });
204
204
  }
205
205
  async getWeightUrls(t) {
@@ -1683,7 +1683,7 @@ function M(e, t) {
1683
1683
  * limitations under the License.
1684
1684
  * =============================================================================
1685
1685
  */
1686
- const _ = {}, k = {
1686
+ const A = {}, k = {
1687
1687
  alpha: !1,
1688
1688
  antialias: !1,
1689
1689
  premultipliedAlpha: !1,
@@ -1693,18 +1693,18 @@ const _ = {}, k = {
1693
1693
  failIfMajorPerformanceCaveat: !0
1694
1694
  };
1695
1695
  function Mt(e, t) {
1696
- _[e] = t;
1696
+ A[e] = t;
1697
1697
  }
1698
- function A(e, t) {
1699
- if (!(e in _) || t != null) {
1698
+ function _(e, t) {
1699
+ if (!(e in A) || t != null) {
1700
1700
  const r = vt(e, t);
1701
1701
  if (r !== null)
1702
- _[e] = r;
1702
+ A[e] = r;
1703
1703
  else
1704
1704
  return console.log("Could not get context for WebGL version", e), null;
1705
1705
  }
1706
- const n = _[e];
1707
- return n == null || n.isContextLost() ? (delete _[e], A(e)) : (n.disable(n.DEPTH_TEST), n.disable(n.STENCIL_TEST), n.disable(n.BLEND), n.disable(n.DITHER), n.disable(n.POLYGON_OFFSET_FILL), n.disable(n.SAMPLE_COVERAGE), n.enable(n.SCISSOR_TEST), n.enable(n.CULL_FACE), n.cullFace(n.BACK), _[e]);
1706
+ const n = A[e];
1707
+ return n == null || n.isContextLost() ? (delete A[e], _(e)) : (n.disable(n.DEPTH_TEST), n.disable(n.STENCIL_TEST), n.disable(n.BLEND), n.disable(n.DITHER), n.disable(n.POLYGON_OFFSET_FILL), n.disable(n.SAMPLE_COVERAGE), n.enable(n.SCISSOR_TEST), n.enable(n.CULL_FACE), n.cullFace(n.BACK), A[e]);
1708
1708
  }
1709
1709
  function pt(e) {
1710
1710
  if (!v().getBool("IS_SAFARI") && typeof OffscreenCanvas < "u" && e === 2)
@@ -1718,7 +1718,7 @@ function vt(e, t) {
1718
1718
  throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");
1719
1719
  const n = t ?? pt(e);
1720
1720
  return n.addEventListener("webglcontextlost", (r) => {
1721
- r.preventDefault(), delete _[e];
1721
+ r.preventDefault(), delete A[e];
1722
1722
  }, !1), v().getBool("SOFTWARE_WEBGL_ENABLED") && (k.failIfMajorPerformanceCaveat = !1), e === 1 ? (
1723
1723
  // tslint:disable-next-line
1724
1724
  n.getContext("webgl", k) || n.getContext("experimental-webgl", k)
@@ -1913,7 +1913,7 @@ function Qt(e, t, n, r, o, i, a) {
1913
1913
  return s === -1 ? !1 : (m(e, () => e.bindBuffer(e.ARRAY_BUFFER, r)), m(e, () => e.vertexAttribPointer(s, o, e.FLOAT, !1, i, a)), m(e, () => e.enableVertexAttribArray(s)), !0);
1914
1914
  }
1915
1915
  function Ft(e, t, n) {
1916
- At(e, n), m(e, () => e.activeTexture(e.TEXTURE0 + n)), m(e, () => e.bindTexture(e.TEXTURE_2D, t));
1916
+ _t(e, n), m(e, () => e.activeTexture(e.TEXTURE0 + n)), m(e, () => e.bindTexture(e.TEXTURE_2D, t));
1917
1917
  }
1918
1918
  function en(e, t, n) {
1919
1919
  return C(e, () => e.getUniformLocation(t, n), 'uniform "' + n + '" not present in program.');
@@ -1955,7 +1955,7 @@ function C(e, t, n) {
1955
1955
  throw new Error(n);
1956
1956
  return r;
1957
1957
  }
1958
- function At(e, t) {
1958
+ function _t(e, t) {
1959
1959
  const n = e.MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1, r = t + e.TEXTURE0;
1960
1960
  if (r < e.TEXTURE0 || r > n) {
1961
1961
  const o = `[gl.TEXTURE0, gl.TEXTURE${n}]`;
@@ -2008,14 +2008,14 @@ function un(e, t) {
2008
2008
  let W, X;
2009
2009
  function ln(e) {
2010
2010
  if (W == null) {
2011
- const t = A(e);
2011
+ const t = _(e);
2012
2012
  W = t.getParameter(t.MAX_TEXTURE_SIZE);
2013
2013
  }
2014
2014
  return W;
2015
2015
  }
2016
2016
  function fn(e) {
2017
2017
  if (X == null) {
2018
- const t = A(e);
2018
+ const t = _(e);
2019
2019
  X = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);
2020
2020
  }
2021
2021
  return Math.min(16, X);
@@ -2024,7 +2024,7 @@ function hn(e) {
2024
2024
  if (e === 0)
2025
2025
  return 0;
2026
2026
  let t;
2027
- const n = A(e);
2027
+ const n = _(e);
2028
2028
  return g(n, "EXT_disjoint_timer_query_webgl2") && e === 2 ? t = 2 : g(n, "EXT_disjoint_timer_query") ? t = 1 : t = 0, t;
2029
2029
  }
2030
2030
  function g(e, t) {
@@ -2032,7 +2032,7 @@ function g(e, t) {
2032
2032
  }
2033
2033
  function dn(e) {
2034
2034
  try {
2035
- if (A(e) != null)
2035
+ if (_(e) != null)
2036
2036
  return !0;
2037
2037
  } catch (t) {
2038
2038
  return console.log("Error when getting WebGL context: ", t), !1;
@@ -2042,7 +2042,7 @@ function dn(e) {
2042
2042
  function xn(e) {
2043
2043
  if (e === 0)
2044
2044
  return !1;
2045
- const t = A(e);
2045
+ const t = _(e);
2046
2046
  if (e === 1) {
2047
2047
  if (!g(t, "OES_texture_float"))
2048
2048
  return !1;
@@ -2053,7 +2053,7 @@ function xn(e) {
2053
2053
  function pn(e) {
2054
2054
  if (e === 0)
2055
2055
  return !1;
2056
- const t = A(e);
2056
+ const t = _(e);
2057
2057
  if (e === 1) {
2058
2058
  if (!g(t, "OES_texture_float") || !g(t, "WEBGL_color_buffer_float"))
2059
2059
  return !1;
@@ -2063,7 +2063,7 @@ function pn(e) {
2063
2063
  const r = "EXT_color_buffer_half_float";
2064
2064
  if (g(t, r)) {
2065
2065
  const o = t.getExtension(r);
2066
- return _t(t, o);
2066
+ return At(t, o);
2067
2067
  }
2068
2068
  return !1;
2069
2069
  }
@@ -2077,7 +2077,7 @@ function G(e) {
2077
2077
  const a = e.checkFramebufferStatus(e.FRAMEBUFFER) === e.FRAMEBUFFER_COMPLETE;
2078
2078
  return e.bindTexture(e.TEXTURE_2D, null), e.bindFramebuffer(e.FRAMEBUFFER, null), e.deleteTexture(n), e.deleteFramebuffer(i), a;
2079
2079
  }
2080
- function _t(e, t) {
2080
+ function At(e, t) {
2081
2081
  const n = de(e, t), r = e.createTexture();
2082
2082
  e.bindTexture(e.TEXTURE_2D, r), e.texImage2D(e.TEXTURE_2D, 0, n.internalFormatHalfFloat, 1, 1, 0, n.textureFormatFloat, n.textureTypeHalfFloat, null);
2083
2083
  const a = e.createFramebuffer();
@@ -2086,7 +2086,7 @@ function _t(e, t) {
2086
2086
  return e.bindTexture(e.TEXTURE_2D, null), e.bindFramebuffer(e.FRAMEBUFFER, null), e.deleteTexture(r), e.deleteFramebuffer(a), s;
2087
2087
  }
2088
2088
  function vn(e) {
2089
- return e !== 2 ? !1 : A(e).fenceSync != null;
2089
+ return e !== 2 ? !1 : _(e).fenceSync != null;
2090
2090
  }
2091
2091
  function mn(e, t) {
2092
2092
  Array.isArray(e) || (e = [e]), e.forEach((n) => {
@@ -2314,7 +2314,7 @@ export {
2314
2314
  mt as A,
2315
2315
  kt as B,
2316
2316
  Vt as C,
2317
- A as D,
2317
+ _ as D,
2318
2318
  yt as E,
2319
2319
  Xt as F,
2320
2320
  g as G,