@genai-fi/nanogpt 0.10.3 → 0.12.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 (238) hide show
  1. package/dist/Generator.d.ts +10 -5
  2. package/dist/Generator.js +1789 -1765
  3. package/dist/{RealDiv-KAPDe8zB.js → RealDiv-C8neBwFi.js} +15 -15
  4. package/dist/{Reshape-BYkmUnAv.js → Reshape-Bd4V_4X7.js} +1 -1
  5. package/dist/{Reshape-Zt6eb7yh.js → Reshape-Ck29jQSY.js} +5 -5
  6. package/dist/TeachableLLM.d.ts +5 -3
  7. package/dist/TeachableLLM.js +14 -14
  8. package/dist/Trainer.d.ts +3 -1
  9. package/dist/Trainer.js +11 -8
  10. package/dist/{axis_util-BaG7mf5A.js → axis_util-DGqbT-FX.js} +3 -3
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-RCe-rHaj.js → backend_util-DC3rBo_H.js} +18 -18
  13. package/dist/{backend_webgpu-DE3ACOLx.js → backend_webgpu-mbhNnlx9.js} +3 -3
  14. package/dist/{broadcast_to-B3eYlZm7.js → broadcast_to-D1Dmg2Oz.js} +2 -2
  15. package/dist/checks/appendCache.js +2 -2
  16. package/dist/checks/attentionMask.js +3 -3
  17. package/dist/checks/gelu.js +2 -2
  18. package/dist/checks/matMulGelu.js +2 -2
  19. package/dist/checks/normRMS.js +4 -4
  20. package/dist/checks/normRMSGrad.js +3 -3
  21. package/dist/checks/packUnpack.js +2 -2
  22. package/dist/checks/qkv.js +4 -4
  23. package/dist/checks/rope.js +2 -2
  24. package/dist/{clip_by_value-BnO7-a88.js → clip_by_value-fg2aKzUy.js} +5 -5
  25. package/dist/complex-Cyg-eQeZ.js +11 -0
  26. package/dist/concat-CSm2rMwe.js +17 -0
  27. package/dist/{concat_util-DpW8mL_l.js → concat_util-D0je5Ppu.js} +1 -1
  28. package/dist/{dataset-BcwmTGYc.js → dataset-CVIJu7Xa.js} +7 -7
  29. package/dist/{dropout-BcvN9JYi.js → dropout-DLhSMNTZ.js} +9 -9
  30. package/dist/expand_dims-ChkuOp6I.js +11 -0
  31. package/dist/{exports_initializers-Hta_rEnm.js → exports_initializers-1KWPiStI.js} +1 -1
  32. package/dist/{floor-D5QdR_le.js → floor-BRMPgeIs.js} +1 -1
  33. package/dist/{gather-D3JcZUaI.js → gather-BSULDalH.js} +1 -1
  34. package/dist/{gelu-CjNPL4OH.js → gelu-BK1k-n1i.js} +1 -1
  35. package/dist/{gpgpu_math-DAOmgtXR.js → gpgpu_math-BJSTk_mW.js} +25 -25
  36. package/dist/{index-BwexR4lA.js → index-BBVLAXZD.js} +89 -89
  37. package/dist/{index-DOvlwCh-.js → index-Duu1Lvvv.js} +53 -53
  38. package/dist/{kernel_funcs_utils-CCzYdUZg.js → kernel_funcs_utils-BtYrPoJu.js} +6 -6
  39. package/dist/layers/BaseLayer.js +2 -2
  40. package/dist/layers/CausalSelfAttention.js +6 -6
  41. package/dist/layers/MLP.js +4 -4
  42. package/dist/layers/PositionEmbedding.js +5 -5
  43. package/dist/layers/RMSNorm.js +3 -3
  44. package/dist/layers/RoPECache.js +4 -4
  45. package/dist/layers/TiedEmbedding.js +6 -6
  46. package/dist/layers/TransformerBlock.js +1 -1
  47. package/dist/loader/loadTransformers.js +1 -1
  48. package/dist/loader/oldZipLoad.js +9 -9
  49. package/dist/log_sum_exp-CVqLsVLl.js +39 -0
  50. package/dist/main.d.ts +10 -1
  51. package/dist/main.js +68 -58
  52. package/dist/{matMul16-BWRSOCWB.js → matMul16-xswmhSuF.js} +3 -3
  53. package/dist/{matMulGelu-CzfgT6Wq.js → matMulGelu-BpvgnYG8.js} +14 -14
  54. package/dist/mat_mul-Bn2BDpT4.js +11 -0
  55. package/dist/{mod-AnXEvvpo.js → mod-B4AUd1Np.js} +1 -1
  56. package/dist/models/NanoGPTV1.js +2 -2
  57. package/dist/models/model.js +9 -9
  58. package/dist/{ones-D2rT0xk2.js → ones-CBI1AQjb.js} +3 -3
  59. package/dist/ops/adamAdjust.js +1 -1
  60. package/dist/ops/adamMoments.js +1 -1
  61. package/dist/ops/add16.js +1 -1
  62. package/dist/ops/appendCache.js +3 -3
  63. package/dist/ops/attentionMask.js +1 -1
  64. package/dist/ops/concat16.js +2 -2
  65. package/dist/ops/cpu/adamAdjust.js +9 -9
  66. package/dist/ops/cpu/adamMoments.js +5 -5
  67. package/dist/ops/cpu/appendCache.js +6 -6
  68. package/dist/ops/cpu/attentionMask.js +10 -10
  69. package/dist/ops/cpu/fusedSoftmax.js +5 -5
  70. package/dist/ops/cpu/gatherSub.js +9 -9
  71. package/dist/ops/cpu/gelu.js +5 -5
  72. package/dist/ops/cpu/matMul16.js +2 -2
  73. package/dist/ops/cpu/matMulGelu.js +3 -3
  74. package/dist/ops/cpu/matMulMul.js +5 -5
  75. package/dist/ops/cpu/mulDropout.js +1 -1
  76. package/dist/ops/cpu/normRMS.js +7 -7
  77. package/dist/ops/cpu/qkv.js +3 -3
  78. package/dist/ops/cpu/rope.js +5 -5
  79. package/dist/ops/cpu/scatterSub.js +11 -11
  80. package/dist/ops/dot16.js +2 -2
  81. package/dist/ops/gatherSub.js +1 -1
  82. package/dist/ops/gelu.js +2 -2
  83. package/dist/ops/grads/add16.js +4 -4
  84. package/dist/ops/grads/attentionMask.js +2 -2
  85. package/dist/ops/grads/gelu.js +2 -2
  86. package/dist/ops/grads/matMul16.js +3 -3
  87. package/dist/ops/grads/matMulGelu.js +6 -6
  88. package/dist/ops/grads/normRMS.js +4 -4
  89. package/dist/ops/grads/pack16.js +3 -3
  90. package/dist/ops/grads/qkv.js +10 -10
  91. package/dist/ops/grads/rope.js +2 -2
  92. package/dist/ops/grads/softmax16.js +1 -1
  93. package/dist/ops/grads/unpack16.js +2 -2
  94. package/dist/ops/matMul16.js +3 -3
  95. package/dist/ops/matMulGelu.js +2 -2
  96. package/dist/ops/matMulMul.js +1 -1
  97. package/dist/ops/mul16.js +1 -1
  98. package/dist/ops/mulDrop.js +1 -1
  99. package/dist/ops/normRMS.js +1 -1
  100. package/dist/ops/pack16.js +2 -2
  101. package/dist/ops/qkv.js +1 -1
  102. package/dist/ops/reshape16.js +2 -2
  103. package/dist/ops/rope.js +2 -2
  104. package/dist/ops/scatterSub.js +1 -1
  105. package/dist/ops/slice16.js +2 -2
  106. package/dist/ops/softmax16.js +1 -1
  107. package/dist/ops/sub16.js +1 -1
  108. package/dist/ops/sum16.js +2 -2
  109. package/dist/ops/transpose16.js +6 -6
  110. package/dist/ops/unpack16.js +2 -2
  111. package/dist/ops/webgl/adamAdjust.js +2 -2
  112. package/dist/ops/webgl/adamMoments.js +1 -1
  113. package/dist/ops/webgl/appendCache.js +1 -1
  114. package/dist/ops/webgl/attentionMask.js +1 -1
  115. package/dist/ops/webgl/fusedSoftmax.js +4 -4
  116. package/dist/ops/webgl/gatherSub.js +1 -1
  117. package/dist/ops/webgl/gelu.js +2 -2
  118. package/dist/ops/webgl/log.js +3 -3
  119. package/dist/ops/webgl/matMul16.js +8 -8
  120. package/dist/ops/webgl/matMulGelu.js +4 -4
  121. package/dist/ops/webgl/matMulMul.js +7 -7
  122. package/dist/ops/webgl/mulDropout.js +1 -1
  123. package/dist/ops/webgl/normRMS.js +7 -7
  124. package/dist/ops/webgl/qkv.js +1 -1
  125. package/dist/ops/webgl/rope.js +1 -1
  126. package/dist/ops/webgl/scatterSub.js +1 -1
  127. package/dist/ops/webgpu/adamAdjust.js +3 -3
  128. package/dist/ops/webgpu/adamMoments.js +5 -5
  129. package/dist/ops/webgpu/add16.js +1 -1
  130. package/dist/ops/webgpu/appendCache.js +3 -3
  131. package/dist/ops/webgpu/attentionMask.js +2 -2
  132. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  133. package/dist/ops/webgpu/concat16.js +5 -5
  134. package/dist/ops/webgpu/gatherSub.js +5 -5
  135. package/dist/ops/webgpu/gelu.js +3 -3
  136. package/dist/ops/webgpu/matMul16.js +19 -19
  137. package/dist/ops/webgpu/matMul16_program.js +2 -2
  138. package/dist/ops/webgpu/mul16.js +4 -4
  139. package/dist/ops/webgpu/normRMS.js +6 -6
  140. package/dist/ops/webgpu/normRMSGrad.js +4 -4
  141. package/dist/ops/webgpu/pack16.js +3 -3
  142. package/dist/ops/webgpu/pack16_program.js +2 -2
  143. package/dist/ops/webgpu/qkv.js +8 -8
  144. package/dist/ops/webgpu/rope.js +3 -3
  145. package/dist/ops/webgpu/scatterSub.js +3 -3
  146. package/dist/ops/webgpu/slice16.js +4 -4
  147. package/dist/ops/webgpu/softmax16.js +4 -4
  148. package/dist/ops/webgpu/softmax16_program.js +2 -2
  149. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  150. package/dist/ops/webgpu/softmax16grad.js +1 -1
  151. package/dist/ops/webgpu/sub16.js +4 -4
  152. package/dist/ops/webgpu/sum16.js +5 -5
  153. package/dist/ops/webgpu/transpose16.js +2 -2
  154. package/dist/ops/webgpu/transpose16_program.js +2 -2
  155. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  156. package/dist/ops/webgpu/unpack16.js +5 -5
  157. package/dist/ops/webgpu/utils/binary_op.js +3 -3
  158. package/dist/ops/webgpu/utils/reductions.js +4 -4
  159. package/dist/{ops-B5yanEdW.js → ops-C2_OXuZ4.js} +69 -69
  160. package/dist/{pack16-nQ6JaLo-.js → pack16-atD0eYRm.js} +9 -9
  161. package/dist/patches/webgpu_backend.js +6 -6
  162. package/dist/patches/webgpu_base.js +1 -1
  163. package/dist/patches/webgpu_program.js +8 -8
  164. package/dist/{random_width-or-CEftb.js → random_width-BN4wGJaW.js} +33 -33
  165. package/dist/range-DKmP1-OQ.js +10 -0
  166. package/dist/relu-BsXmGzzu.js +9 -0
  167. package/dist/{reshape-ByE68wS9.js → reshape-BI0yzp1T.js} +1 -1
  168. package/dist/{resize_nearest_neighbor-B19mCEg2.js → resize_nearest_neighbor-BA_BX-ub.js} +26 -26
  169. package/dist/{rope-Ir4mTyD1.js → rope-DJ7Y7c-u.js} +1 -1
  170. package/dist/{scatter_nd_util-lvSiX8q4.js → scatter_nd_util-k9MUVUkn.js} +1 -1
  171. package/dist/{selu_util-kbhpTdYD.js → selu_util-DyW0X1WG.js} +5 -5
  172. package/dist/{shared-DT1TkE6w.js → shared-Q3BS6T03.js} +1 -1
  173. package/dist/{shared-dntlHIDQ.js → shared-nnSWpC3u.js} +86 -86
  174. package/dist/{slice-BfEGSH82.js → slice-wBNvzVyz.js} +1 -1
  175. package/dist/{slice_util-uTKwiEpW.js → slice_util-zN8KFC5I.js} +1 -1
  176. package/dist/{softmax-CA5jFsLR.js → softmax-DfuYyjMh.js} +1 -1
  177. package/dist/split-BYrLboMq.js +9 -0
  178. package/dist/squeeze-Bk8Brcct.js +10 -0
  179. package/dist/{stack-Cf4n9h0N.js → stack-CDWShFHF.js} +1 -1
  180. package/dist/{step-CINUs5QB.js → step-BS5JXRR6.js} +23 -23
  181. package/dist/{sum-DWAtNGez.js → sum-BPUfDB2X.js} +3 -3
  182. package/dist/tensor-CEt9Nm2s.js +8 -0
  183. package/dist/tensor1d-Cc_KCIDg.js +11 -0
  184. package/dist/{tensor2d-Bs9wZRc7.js → tensor2d-BN97fF71.js} +3 -3
  185. package/dist/{tensor4d-BARPdTaS.js → tensor4d-vuDDgdUI.js} +1 -1
  186. package/dist/{tfjs_backend-y1cvNhLA.js → tfjs_backend-806hyYve.js} +49 -49
  187. package/dist/{tile-mbfagpsB.js → tile-OWUvpIVt.js} +3 -3
  188. package/dist/tokeniser/BaseTokeniser.d.ts +25 -0
  189. package/dist/tokeniser/BaseTokeniser.js +94 -0
  190. package/dist/tokeniser/CharTokeniser.d.ts +10 -9
  191. package/dist/tokeniser/CharTokeniser.js +44 -30
  192. package/dist/tokeniser/bpe.d.ts +10 -9
  193. package/dist/tokeniser/bpe.js +67 -52
  194. package/dist/tokeniser/type.d.ts +14 -5
  195. package/dist/training/Adam.js +2 -2
  196. package/dist/training/AdamExt.js +1 -1
  197. package/dist/training/DatasetBuilder.d.ts +3 -3
  198. package/dist/training/DatasetBuilder.js +34 -38
  199. package/dist/training/FullTrainer.js +1 -1
  200. package/dist/training/Trainer.d.ts +4 -3
  201. package/dist/training/Trainer.js +22 -25
  202. package/dist/training/sparseCrossEntropy.js +3 -3
  203. package/dist/training/tasks/ConversationTask.d.ts +11 -0
  204. package/dist/training/tasks/ConversationTask.js +26 -0
  205. package/dist/training/tasks/PretrainingTask.d.ts +11 -0
  206. package/dist/training/tasks/PretrainingTask.js +34 -0
  207. package/dist/training/tasks/StartSentenceTask.d.ts +12 -0
  208. package/dist/training/tasks/StartSentenceTask.js +42 -0
  209. package/dist/training/tasks/Task.d.ts +8 -0
  210. package/dist/training/tasks/Task.js +41 -0
  211. package/dist/{transpose-ClWiBS_b.js → transpose-BUkQCJp9.js} +6 -6
  212. package/dist/{unsorted_segment_sum-BDDhB_E6.js → unsorted_segment_sum-BljxHhCY.js} +5 -5
  213. package/dist/utilities/dummy.js +3 -3
  214. package/dist/utilities/multinomialCPU.js +2 -2
  215. package/dist/utilities/packed.js +1 -1
  216. package/dist/utilities/performance.js +1 -1
  217. package/dist/utilities/profile.js +1 -1
  218. package/dist/utilities/safetensors.js +2 -2
  219. package/dist/utilities/sentences.d.ts +1 -1
  220. package/dist/utilities/sentences.js +11 -11
  221. package/dist/utilities/weights.js +2 -2
  222. package/dist/{variable-WawDEaAb.js → variable-DPt_Iuog.js} +1 -1
  223. package/dist/{webgpu_program-DuOXPQol.js → webgpu_program-BpWRlghH.js} +3 -3
  224. package/dist/{webgpu_util-RxEF33Rj.js → webgpu_util-DMiKzzQM.js} +7 -7
  225. package/dist/{zeros-KnWaWf-X.js → zeros-5YROwwUH.js} +2 -2
  226. package/dist/{zeros_like-DvE73F4e.js → zeros_like-De4n1C3m.js} +71 -71
  227. package/package.json +1 -1
  228. package/dist/complex-DjxcVmoX.js +0 -11
  229. package/dist/concat-BV8bt5H-.js +0 -17
  230. package/dist/expand_dims-DT4tEPwA.js +0 -11
  231. package/dist/log_sum_exp-ngO0-4pK.js +0 -39
  232. package/dist/mat_mul-SjpJRLyL.js +0 -11
  233. package/dist/range-BklejeeW.js +0 -10
  234. package/dist/relu-CP0ZcxWO.js +0 -9
  235. package/dist/split-CVLc0w--.js +0 -9
  236. package/dist/squeeze-C7Z2srUo.js +0 -10
  237. package/dist/tensor-DJoc7gJU.js +0 -8
  238. package/dist/tensor1d-D11P_7Dp.js +0 -11
@@ -1,7 +1,7 @@
1
- import { aC as S, a8 as h, j as N, d as v, aD as o, aE as p, aF as g, l as k, t as y } from "./index-DOvlwCh-.js";
1
+ import { aC as S, a3 as h, aa as N, d as v, aD as o, aE as p, aF as g, x as k, t as y } from "./index-Duu1Lvvv.js";
2
2
  import { s as R } from "./index-CieiGp4Y.js";
3
- import { s as $ } from "./stack-Cf4n9h0N.js";
4
- import { t as B } from "./tensor-DJoc7gJU.js";
3
+ import { s as $ } from "./stack-CDWShFHF.js";
4
+ import { t as B } from "./tensor-CEt9Nm2s.js";
5
5
  function _(s, t) {
6
6
  return b(s, t);
7
7
  }
@@ -296,7 +296,7 @@ class i {
296
296
  * throw an `Error`.
297
297
  */
298
298
  handleErrors(t) {
299
- return new j(this, t);
299
+ return new Z(this, t);
300
300
  }
301
301
  // TODO(soergel): Implement reduce() etc.
302
302
  /**
@@ -623,7 +623,7 @@ class K extends i {
623
623
  return { value: r, done: !1 };
624
624
  }
625
625
  }
626
- class j extends i {
626
+ class Z extends i {
627
627
  constructor(t, e) {
628
628
  super(), this.upstream = t, this.handler = e, this.count = 0, this.lastRead = Promise.resolve({ value: null, done: !1 });
629
629
  }
@@ -660,7 +660,7 @@ class w extends i {
660
660
  return { value: r, done: !1 };
661
661
  }
662
662
  }
663
- class Z extends i {
663
+ class j extends i {
664
664
  constructor() {
665
665
  super(), this.outputQueue = new f(), this.lastRead = Promise.resolve({ value: null, done: !1 });
666
666
  }
@@ -674,7 +674,7 @@ class Z extends i {
674
674
  return { value: this.outputQueue.shift(), done: !1 };
675
675
  }
676
676
  }
677
- class tt extends Z {
677
+ class tt extends j {
678
678
  constructor(t, e) {
679
679
  super(), this.upstream = t, this.transform = e;
680
680
  }
@@ -1,7 +1,7 @@
1
- import { A as l, C as h, at as d, n as f, B as m, l as u, a8 as p, w as g, x as V, m as v } from "./index-DOvlwCh-.js";
2
- import { f as w } from "./floor-D5QdR_le.js";
1
+ import { o as l, u as h, at as d, ab as f, q as m, x as u, a3 as p, j as g, l as V, m as v } from "./index-Duu1Lvvv.js";
2
+ import { f as w } from "./floor-BRMPgeIs.js";
3
3
  import { s as c } from "./index-CieiGp4Y.js";
4
- class N {
4
+ class b {
5
5
  constructor(t, e, s, n, o) {
6
6
  this.mean = t, this.stdDev = e, this.dtype = s, this.nextVal = NaN, this.truncated = n, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
7
7
  const a = o || Math.random();
@@ -33,7 +33,7 @@ class N {
33
33
  return t <= this.upper && t >= this.lower;
34
34
  }
35
35
  }
36
- class b {
36
+ class N {
37
37
  constructor(t = 0, e = 1, s, n) {
38
38
  if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = t, this.range = e - t, this.dtype = s, n == null && (n = Math.random()), typeof n == "number" && (n = n.toString()), !this.canReturnFloat() && this.range <= 1)
39
39
  throw new Error(`The difference between ${t} - ${e} <= 1 and dtype is not float`);
@@ -49,7 +49,7 @@ class b {
49
49
  function T(r, t = 0, e = 1, s, n) {
50
50
  if (h(r), s != null && s === "bool")
51
51
  throw new Error(`Unsupported data type ${s}`);
52
- const o = new N(t, e, s, !1, n), a = d(r, s);
52
+ const o = new b(t, e, s, !1, n), a = d(r, s);
53
53
  for (let i = 0; i < a.values.length; i++)
54
54
  a.values[i] = o.nextValue();
55
55
  return a.toTensor();
@@ -57,7 +57,7 @@ function T(r, t = 0, e = 1, s, n) {
57
57
  const U = /* @__PURE__ */ l({ randomNormal_: T });
58
58
  function x(r, t = 0, e = 1, s = "float32", n) {
59
59
  h(r);
60
- const o = d(r, s), a = new b(t, e, null, n);
60
+ const o = d(r, s), a = new N(t, e, null, n);
61
61
  for (let i = 0; i < o.values.length; i++)
62
62
  o.values[i] = a.nextValue();
63
63
  return o.toTensor();
@@ -83,10 +83,10 @@ function D(r, t, e, s) {
83
83
  const o = M(n, e), a = 1 - t, i = g(w(V(y(o, 0, 1, "float32", s), a)), a);
84
84
  return v(n, i);
85
85
  }
86
- const F = /* @__PURE__ */ l({ dropout_: D });
86
+ const q = /* @__PURE__ */ l({ dropout_: D });
87
87
  export {
88
- N as M,
88
+ b as M,
89
89
  y as a,
90
- F as d,
90
+ q as d,
91
91
  U as r
92
92
  };
@@ -0,0 +1,11 @@
1
+ import { o as e, q as a, x as i, E as m, A as p } from "./index-Duu1Lvvv.js";
2
+ function x(t, n = 0) {
3
+ const s = a(t, "x", "expandDims", "string_or_numeric");
4
+ i(n <= s.rank, () => "Axis must be <= rank of the tensor");
5
+ const r = { input: s }, o = { dim: n };
6
+ return m.runKernel(p, r, o);
7
+ }
8
+ const u = /* @__PURE__ */ e({ expandDims_: x });
9
+ export {
10
+ u as e
11
+ };
@@ -1,4 +1,4 @@
1
- import { R as o } from "./random_width-or-CEftb.js";
1
+ import { R as o } from "./random_width-BN4wGJaW.js";
2
2
  function m(r) {
3
3
  return new o(r);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { A as n, B as s, E as t, J as f } from "./index-DOvlwCh-.js";
1
+ import { o as n, q as s, E as t, F as f } from "./index-Duu1Lvvv.js";
2
2
  function a(o) {
3
3
  const r = { x: s(o, "x", "floor", "float32") };
4
4
  return t.runKernel(f, r);
@@ -1,4 +1,4 @@
1
- import { A as g, B as t, E as h, K as p } from "./index-DOvlwCh-.js";
1
+ import { o as g, q as t, E as h, G as p } from "./index-Duu1Lvvv.js";
2
2
  function u(n, s, r = 0, e = 0) {
3
3
  const o = t(n, "x", "gather"), a = t(s, "indices", "gather", "int32"), c = { x: o, indices: a }, i = { axis: r, batchDims: e };
4
4
  return h.runKernel(p, c, i);
@@ -1,4 +1,4 @@
1
- import { u as t, e as n } from "./index-DOvlwCh-.js";
1
+ import { i as t, e as n } from "./index-Duu1Lvvv.js";
2
2
  import "./ops/cpu/gelu.js";
3
3
  import "./ops/webgl/gelu.js";
4
4
  const a = {
@@ -1,5 +1,5 @@
1
- import { j as $, h as E, aN as X, n as T, aO as ae, V as N, aP as G, l as ie, ad as k, o as ce } from "./index-DOvlwCh-.js";
2
- import { b as se } from "./backend_util-RCe-rHaj.js";
1
+ import { aa as $, U as E, aN as X, ab as T, aO as ae, K as N, aP as G, x as ie, a8 as k, ac as ce } from "./index-Duu1Lvvv.js";
2
+ import { b as se } from "./backend_util-DC3rBo_H.js";
3
3
  const w = {}, M = {
4
4
  alpha: !1,
5
5
  antialias: !1,
@@ -215,7 +215,7 @@ function Ot(e, t, n) {
215
215
  function It(e, t) {
216
216
  v(e, () => e.bindFramebuffer(e.FRAMEBUFFER, t)), v(e, () => e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, null, 0));
217
217
  }
218
- function Lt(e) {
218
+ function Ut(e) {
219
219
  const t = e.checkFramebufferStatus(e.FRAMEBUFFER);
220
220
  if (t !== e.FRAMEBUFFER_COMPLETE)
221
221
  throw new Error("Error binding framebuffer: " + Se(e, t));
@@ -258,7 +258,7 @@ function J(e) {
258
258
  e[e.length - 1]
259
259
  ];
260
260
  }
261
- function Ut(e) {
261
+ function Lt(e) {
262
262
  let t = [1, 1, 1];
263
263
  return e.length === 0 || e.length === 1 && e[0] === 1 || (t = [Z(e), ...J(e)]), t;
264
264
  }
@@ -378,7 +378,7 @@ function Xt(e, t) {
378
378
  n != null && ie(n.dtype !== "complex64", () => `${t} does not support complex64 tensors in the WebGL backend.`);
379
379
  });
380
380
  }
381
- function L() {
381
+ function U() {
382
382
  let e, t, n, r, o, a, i, c, s, l;
383
383
  return $().getNumber("WEBGL_VERSION") === 2 ? (e = "#version 300 es", t = "in", n = "out", r = "in", o = "texture", a = "outputColor", i = "out vec4 outputColor;", c = $().getBool("WEBGL2_ISNAN_CUSTOM") ? `
384
384
  bool isnan_custom(float val) {
@@ -567,8 +567,8 @@ function Fe(e, t, n) {
567
567
  });
568
568
  const o = r.join(`
569
569
  `), a = e.map((x) => _e(x, t, n.packedInputs, n.enableShapeUniforms)).join(`
570
- `), i = t.texShape, c = L(), s = Ne(c);
571
- let l, u, f = Le(c);
570
+ `), i = t.texShape, c = U(), s = Ne(c);
571
+ let l, u, f = Ue(c);
572
572
  return t.isPacked ? (l = Ae(t.logicalShape, i, n.enableShapeUniforms), u = Ie(c)) : (l = we(t.logicalShape, i, n.enableShapeUniforms), u = Oe(c)), n.packedInputs && (f += be), [
573
573
  f,
574
574
  s,
@@ -580,7 +580,7 @@ function Fe(e, t, n) {
580
580
  ].join(`
581
581
  `);
582
582
  }
583
- function U(e, t = !1) {
583
+ function L(e, t = !1) {
584
584
  const n = e.shapeInfo.logicalShape;
585
585
  switch (n.length) {
586
586
  case 0:
@@ -617,7 +617,7 @@ function te(e, t) {
617
617
  }
618
618
  function _e(e, t, n = !1, r) {
619
619
  let o = "";
620
- n ? o += te(e, r) : o += U(e, r);
620
+ n ? o += te(e, r) : o += L(e, r);
621
621
  const a = e.shapeInfo.logicalShape, i = t.logicalShape;
622
622
  return a.length <= i.length && (n ? o += ot(e, t) : o += at(e, t)), o;
623
623
  }
@@ -676,7 +676,7 @@ function Ie(e) {
676
676
  }
677
677
  `;
678
678
  }
679
- function Le(e) {
679
+ function Ue(e) {
680
680
  return `${e.version}
681
681
  precision highp float;
682
682
  precision highp int;
@@ -732,12 +732,12 @@ function Le(e) {
732
732
  return fract((p3.x + p3.y) * p3.z);
733
733
  }
734
734
 
735
- ${Ue}
735
+ ${Le}
736
736
  ${De}
737
737
  ${ge}
738
738
  `;
739
739
  }
740
- const Ue = `
740
+ const Le = `
741
741
  vec2 uvFromFlat(int texNumR, int texNumC, int index) {
742
742
  int texR = index / texNumC;
743
743
  int texC = index - texR * texNumC;
@@ -1112,7 +1112,7 @@ function O(e) {
1112
1112
  return `offset${e}`;
1113
1113
  }
1114
1114
  function He(e) {
1115
- const t = e.name, n = "get" + t.charAt(0).toUpperCase() + t.slice(1), r = L();
1115
+ const t = e.name, n = "get" + t.charAt(0).toUpperCase() + t.slice(1), r = U();
1116
1116
  return `
1117
1117
  vec4 ${n}() {
1118
1118
  return ${r.texture2D}(${t}, halfCR);
@@ -1147,7 +1147,7 @@ function qe(e, t) {
1147
1147
  `;
1148
1148
  }
1149
1149
  function je(e, t) {
1150
- const n = e.name, r = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = e.shapeInfo.texShape, a = L();
1150
+ const n = e.name, r = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = e.shapeInfo.texShape, a = U();
1151
1151
  if (t)
1152
1152
  return `
1153
1153
  vec4 ${r}(int index) {
@@ -1215,7 +1215,7 @@ function Ye(e, t) {
1215
1215
  `;
1216
1216
  }
1217
1217
  function Ke(e, t) {
1218
- const n = e.shapeInfo.logicalShape, r = e.name, o = "get" + r.charAt(0).toUpperCase() + r.slice(1), a = e.shapeInfo.texShape, i = a[0], c = a[1], s = L();
1218
+ const n = e.shapeInfo.logicalShape, r = e.name, o = "get" + r.charAt(0).toUpperCase() + r.slice(1), a = e.shapeInfo.texShape, i = a[0], c = a[1], s = U();
1219
1219
  if (a != null && T(n, a))
1220
1220
  return t ? `
1221
1221
  vec4 ${o}(int row, int col) {
@@ -1269,7 +1269,7 @@ function Ze(e, t) {
1269
1269
  if (s.length < n.length) {
1270
1270
  const d = g(e, s), x = ["row", "col"];
1271
1271
  return `
1272
- ${U(d, t)}
1272
+ ${L(d, t)}
1273
1273
  float ${o}(int row, int col) {
1274
1274
  return ${o}(${b(x, c)});
1275
1275
  }
@@ -1334,7 +1334,7 @@ function Je(e, t) {
1334
1334
  }
1335
1335
  `;
1336
1336
  }
1337
- const c = L();
1337
+ const c = U();
1338
1338
  if (t)
1339
1339
  return `
1340
1340
  vec4 ${o}(int b, int row, int col) {
@@ -1360,7 +1360,7 @@ function Qe(e, t) {
1360
1360
  if (l.length < n.length) {
1361
1361
  const p = g(e, l), m = ["row", "col", "depth"];
1362
1362
  return `
1363
- ${U(p, t)}
1363
+ ${L(p, t)}
1364
1364
  float ${o}(int row, int col, int depth) {
1365
1365
  return ${o}(${b(m, s)});
1366
1366
  }
@@ -1430,7 +1430,7 @@ function Qe(e, t) {
1430
1430
  `;
1431
1431
  }
1432
1432
  function et(e, t) {
1433
- const n = e.name, r = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = L();
1433
+ const n = e.name, r = "get" + n.charAt(0).toUpperCase() + n.slice(1), o = U();
1434
1434
  if (t)
1435
1435
  return `
1436
1436
  vec4 ${r}(int b2, int b, int row, int col) {
@@ -1464,7 +1464,7 @@ function tt(e, t) {
1464
1464
  if (s.length < n.length) {
1465
1465
  const R = g(e, s), F = ["row", "col", "depth", "depth2"];
1466
1466
  return `
1467
- ${U(R, t)}
1467
+ ${L(R, t)}
1468
1468
  float ${o}(int row, int col, int depth, int depth2) {
1469
1469
  return ${o}(${b(F, l)});
1470
1470
  }
@@ -1550,7 +1550,7 @@ function nt(e) {
1550
1550
  if (s.length < t.length) {
1551
1551
  const p = g(e, s), m = ["row", "col", "depth", "depth2", "depth3"];
1552
1552
  return `
1553
- ${U(p)}
1553
+ ${L(p)}
1554
1554
  float ${r}(int row, int col, int depth, int depth2, int depth3) {
1555
1555
  return ${r}(${b(m, l)});
1556
1556
  }
@@ -1607,7 +1607,7 @@ function rt(e) {
1607
1607
  if (o.length < t.length) {
1608
1608
  const m = g(e, o), S = ["row", "col", "depth", "depth2", "depth3", "depth4"];
1609
1609
  return `
1610
- ${U(m)}
1610
+ ${L(m)}
1611
1611
  float ${r}(int row, int col, int depth,
1612
1612
  int depth2, int depth3, int depth4) {
1613
1613
  return ${r}(${b(S, a)});
@@ -1979,12 +1979,12 @@ export {
1979
1979
  wt as O,
1980
1980
  H as P,
1981
1981
  Nt as Q,
1982
- Lt as R,
1982
+ Ut as R,
1983
1983
  Ot as S,
1984
1984
  q as T,
1985
1985
  ut as U,
1986
1986
  j as V,
1987
- Ut as W,
1987
+ Lt as W,
1988
1988
  xt as X,
1989
1989
  ht as Y,
1990
1990
  Yt as Z,
@@ -2008,7 +2008,7 @@ export {
2008
2008
  yt as m,
2009
2009
  Pt as n,
2010
2010
  Vt as o,
2011
- L as p,
2011
+ U as p,
2012
2012
  Q as q,
2013
2013
  St as r,
2014
2014
  Rt as s,