@genai-fi/nanogpt 0.8.0 → 0.8.1

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 (160) hide show
  1. package/dist/Generator.js +29 -27
  2. package/dist/{RealDiv-N8TpOMYv.js → RealDiv-D_q39E3A.js} +14 -14
  3. package/dist/{Reshape-B-lWQRnF.js → Reshape-41YpQqEo.js} +1 -1
  4. package/dist/{Reshape-Bo8HzP8V.js → Reshape-Bh_jzKzV.js} +2 -2
  5. package/dist/TeachableLLM.js +7 -5
  6. package/dist/{axis_util-DubwyOhW.js → axis_util-Did9235A.js} +1 -1
  7. package/dist/backend.js +2 -2
  8. package/dist/{backend_util-BJ-_jSeK.js → backend_util-yC3YH1jo.js} +17 -17
  9. package/dist/{broadcast_to-BYfCp5iL.js → broadcast_to-CUvOdOT5.js} +2 -2
  10. package/dist/checks/appendCache.d.ts +1 -0
  11. package/dist/checks/appendCache.js +22 -0
  12. package/dist/checks/attentionMask.d.ts +1 -0
  13. package/dist/checks/attentionMask.js +37 -0
  14. package/dist/checks/check.d.ts +9 -0
  15. package/dist/checks/check.js +20 -0
  16. package/dist/checks/gelu.d.ts +1 -0
  17. package/dist/checks/gelu.js +18 -0
  18. package/dist/checks/index.d.ts +19 -0
  19. package/dist/checks/index.js +21 -0
  20. package/dist/checks/normRMS.d.ts +1 -0
  21. package/dist/checks/normRMS.js +16 -0
  22. package/dist/checks/normRMSGrad.d.ts +1 -0
  23. package/dist/checks/normRMSGrad.js +12 -0
  24. package/dist/checks/qkv.d.ts +1 -0
  25. package/dist/checks/qkv.js +25 -0
  26. package/dist/checks/rope.d.ts +1 -0
  27. package/dist/checks/rope.js +21 -0
  28. package/dist/{concat-BmDqqFsa.js → concat-pHiVqR3L.js} +1 -1
  29. package/dist/{dataset-CJmEGu6D.js → dataset-DPPl-iLT.js} +7 -7
  30. package/dist/{dropout-sx0sjVAT.js → dropout-CcKSfOYE.js} +11 -11
  31. package/dist/{exports_initializers-DAKM8UO9.js → exports_initializers-DKk7-bsx.js} +1 -1
  32. package/dist/{gather-C1siEkdp.js → gather-CPg6ZlQA.js} +1 -1
  33. package/dist/{gelu-Bd3UBBxg.js → gelu-BkcmEEyD.js} +1 -1
  34. package/dist/{gpgpu_math-TFLxaLkw.js → gpgpu_math-D_ODOLix.js} +2 -2
  35. package/dist/{index-CUQrfsw_.js → index-DdmHGZjq.js} +655 -647
  36. package/dist/{index-BaPo_0H8.js → index-evZ57wr4.js} +10 -10
  37. package/dist/{kernel_funcs_utils-P9aFa232.js → kernel_funcs_utils-CDfFpUab.js} +15 -15
  38. package/dist/layers/BaseLayer.js +2 -2
  39. package/dist/layers/CausalSelfAttention.js +6 -6
  40. package/dist/layers/MLP.js +5 -5
  41. package/dist/layers/PositionEmbedding.js +5 -5
  42. package/dist/layers/RMSNorm.js +3 -3
  43. package/dist/layers/RoPECache.js +4 -4
  44. package/dist/layers/TiedEmbedding.js +5 -5
  45. package/dist/layers/TransformerBlock.js +1 -1
  46. package/dist/loader/loadTransformers.js +1 -1
  47. package/dist/loader/oldZipLoad.js +9 -7
  48. package/dist/{log_sum_exp-C142qZqY.js → log_sum_exp-C8yFJfZz.js} +45 -24
  49. package/dist/main.d.ts +1 -0
  50. package/dist/main.js +9 -7
  51. package/dist/{mat_mul-DMkduNJu.js → mat_mul-Dpy2mMRu.js} +1 -1
  52. package/dist/{mod-uUuj4gSb.js → mod-CbibJi3D.js} +1 -1
  53. package/dist/models/NanoGPTV1.js +1 -1
  54. package/dist/models/model.js +9 -7
  55. package/dist/{mulmat_packed_gpu-Cm2gw-c8.js → mulmat_packed_gpu-q_Gmwyld.js} +1 -1
  56. package/dist/{ones-ZdgQGBCP.js → ones-BAqVh-eA.js} +2 -2
  57. package/dist/ops/adamAdjust.js +1 -1
  58. package/dist/ops/adamMoments.js +1 -1
  59. package/dist/ops/appendCache.js +3 -3
  60. package/dist/ops/attentionMask.js +1 -1
  61. package/dist/ops/cpu/adamAdjust.js +1 -1
  62. package/dist/ops/cpu/adamMoments.js +2 -2
  63. package/dist/ops/cpu/appendCache.js +2 -2
  64. package/dist/ops/cpu/attentionMask.js +5 -5
  65. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  66. package/dist/ops/cpu/gatherSub.js +5 -5
  67. package/dist/ops/cpu/gelu.js +1 -1
  68. package/dist/ops/cpu/matMulGelu.js +2 -2
  69. package/dist/ops/cpu/matMulMul.js +1 -1
  70. package/dist/ops/cpu/mulDropout.js +1 -1
  71. package/dist/ops/cpu/normRMS.js +1 -1
  72. package/dist/ops/cpu/qkv.js +3 -3
  73. package/dist/ops/cpu/rope.js +5 -5
  74. package/dist/ops/cpu/scatterSub.js +13 -13
  75. package/dist/ops/fusedSoftmax.js +1 -1
  76. package/dist/ops/gatherSub.js +1 -1
  77. package/dist/ops/gelu.js +2 -2
  78. package/dist/ops/grads/attentionMask.js +1 -1
  79. package/dist/ops/grads/fusedSoftmax.js +2 -2
  80. package/dist/ops/grads/gelu.js +2 -2
  81. package/dist/ops/grads/matMulGelu.js +1 -1
  82. package/dist/ops/grads/normRMS.js +1 -1
  83. package/dist/ops/grads/qkv.js +1 -1
  84. package/dist/ops/grads/rope.js +1 -1
  85. package/dist/ops/matMulGelu.js +1 -1
  86. package/dist/ops/matMulMul.js +1 -1
  87. package/dist/ops/mulDrop.js +1 -1
  88. package/dist/ops/normRMS.js +1 -1
  89. package/dist/ops/qkv.js +1 -1
  90. package/dist/ops/rope.js +4 -4
  91. package/dist/ops/scatterSub.js +1 -1
  92. package/dist/ops/webgl/adamAdjust.js +2 -2
  93. package/dist/ops/webgl/adamMoments.js +1 -1
  94. package/dist/ops/webgl/appendCache.js +1 -1
  95. package/dist/ops/webgl/attentionMask.js +1 -1
  96. package/dist/ops/webgl/fusedSoftmax.js +4 -4
  97. package/dist/ops/webgl/gatherSub.js +1 -1
  98. package/dist/ops/webgl/gelu.js +2 -2
  99. package/dist/ops/webgl/log.js +3 -3
  100. package/dist/ops/webgl/matMulGelu.js +4 -4
  101. package/dist/ops/webgl/matMulMul.js +1 -1
  102. package/dist/ops/webgl/mulDropout.js +1 -1
  103. package/dist/ops/webgl/normRMS.js +2 -2
  104. package/dist/ops/webgl/qkv.js +1 -1
  105. package/dist/ops/webgl/rope.js +1 -1
  106. package/dist/ops/webgl/scatterSub.js +1 -1
  107. package/dist/ops/webgpu/adamAdjust.js +3 -3
  108. package/dist/ops/webgpu/adamMoments.js +3 -3
  109. package/dist/ops/webgpu/appendCache.js +3 -3
  110. package/dist/ops/webgpu/attentionMask.js +3 -3
  111. package/dist/ops/webgpu/gatherSub.js +3 -3
  112. package/dist/ops/webgpu/gelu.js +3 -3
  113. package/dist/ops/webgpu/normRMS.js +2 -2
  114. package/dist/ops/webgpu/normRMSGrad.js +5 -5
  115. package/dist/ops/webgpu/qkv.js +3 -3
  116. package/dist/ops/webgpu/rope.js +3 -3
  117. package/dist/ops/webgpu/scatterSub.js +3 -3
  118. package/dist/ops/webgpu/utils/reductions.js +4 -4
  119. package/dist/ops-542ai2vG.js +1525 -0
  120. package/dist/{random_width-D8Pwy_na.js → random_width-DKGeiFuR.js} +1514 -1581
  121. package/dist/{range-LVHrSLdi.js → range-BcUvLuf5.js} +1 -1
  122. package/dist/{reciprocal-CaR9e67G.js → reciprocal-DhDWSKiD.js} +1 -1
  123. package/dist/{register_all_kernels-DUshvVWP.js → register_all_kernels-Do9VvZmo.js} +2312 -2335
  124. package/dist/{max-B3JOcNGb.js → relu-B1AXs7p5.js} +6 -6
  125. package/dist/{reshape-DEfQGSin.js → reshape-WeJkT3ja.js} +1 -1
  126. package/dist/{scatter_nd_util-CUPPNLaA.js → scatter_nd_util-B7yDhiQr.js} +1 -1
  127. package/dist/{selu_util-8vv5JxQV.js → selu_util-BgUO9gHY.js} +125 -146
  128. package/dist/{shared-D1elLckx.js → shared-CZiWmQCI.js} +1 -1
  129. package/dist/{shared-CkNorDcU.js → shared-V6D_md-c.js} +120 -120
  130. package/dist/{sin-D2CKKmyR.js → sin-CPxad7Am.js} +1 -1
  131. package/dist/{slice-BnyE-M_7.js → slice-B7jXtPnp.js} +1 -1
  132. package/dist/{softmax-DLoZWYBx.js → softmax-BfsyI4As.js} +1 -1
  133. package/dist/{split-By_n4TKP.js → split-BPxr8_8m.js} +1 -1
  134. package/dist/{stack-DkdFLq37.js → stack-BNwLzE43.js} +1 -1
  135. package/dist/{sum-l_0SqM4h.js → sum-ByFINZgi.js} +1 -1
  136. package/dist/{tensor-BAQdLqoU.js → tensor-DbqgIV9B.js} +1 -1
  137. package/dist/tensor1d-CtJq5BOv.js +27 -0
  138. package/dist/{tensor2d-BHy261cI.js → tensor2d-CObBWBkW.js} +1 -1
  139. package/dist/tensor3d-BOukqWwr.js +30 -0
  140. package/dist/tensor4d-DLtk7Nxh.js +30 -0
  141. package/dist/training/Adam.js +2 -2
  142. package/dist/training/AdamExt.js +1 -1
  143. package/dist/training/DatasetBuilder.js +2 -2
  144. package/dist/training/FullTrainer.js +1 -1
  145. package/dist/training/Trainer.js +2 -2
  146. package/dist/training/sparseCrossEntropy.js +8 -9
  147. package/dist/utilities/arrayClose.d.ts +1 -1
  148. package/dist/utilities/arrayClose.js +16 -7
  149. package/dist/utilities/dummy.js +2 -2
  150. package/dist/utilities/multinomialCPU.js +2 -2
  151. package/dist/utilities/performance.js +1 -1
  152. package/dist/utilities/profile.js +1 -1
  153. package/dist/utilities/safetensors.js +2 -2
  154. package/dist/utilities/weights.js +2 -2
  155. package/dist/{variable-C9hihzDB.js → variable-DPFOJyRG.js} +1 -1
  156. package/dist/{webgpu_program-dFEVbDPL.js → webgpu_program-Dhk9R5aG.js} +1 -1
  157. package/dist/{webgpu_util-DLImlSc6.js → webgpu_util-BqGnZg8t.js} +1 -1
  158. package/dist/{zeros-VZ72lWXM.js → zeros-Dnwix0p4.js} +1 -1
  159. package/package.json +1 -1
  160. package/dist/ops-C_1K_-35.js +0 -1202
@@ -1,7 +1,7 @@
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";
1
+ import { ak as S, T as h, ag as k, d as v, al as o, am as p, an as g, n as N, t as y } from "./index-DdmHGZjq.js";
2
2
  import { s as R } from "./index-C4L8Cm77.js";
3
- import { s as $ } from "./stack-DkdFLq37.js";
4
- import { t as B } from "./tensor-BAQdLqoU.js";
3
+ import { s as $ } from "./stack-BNwLzE43.js";
4
+ import { t as B } from "./tensor-DbqgIV9B.js";
5
5
  /**
6
6
  * @license
7
7
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -381,7 +381,7 @@ class i {
381
381
  * throw an `Error`.
382
382
  */
383
383
  handleErrors(t) {
384
- return new j(this, t);
384
+ return new Z(this, t);
385
385
  }
386
386
  // TODO(soergel): Implement reduce() etc.
387
387
  /**
@@ -708,7 +708,7 @@ class K extends i {
708
708
  return { value: r, done: !1 };
709
709
  }
710
710
  }
711
- class j extends i {
711
+ class Z extends i {
712
712
  constructor(t, e) {
713
713
  super(), this.upstream = t, this.handler = e, this.count = 0, this.lastRead = Promise.resolve({ value: null, done: !1 });
714
714
  }
@@ -745,7 +745,7 @@ class w extends i {
745
745
  return { value: r, done: !1 };
746
746
  }
747
747
  }
748
- class Z extends i {
748
+ class j extends i {
749
749
  constructor() {
750
750
  super(), this.outputQueue = new f(), this.lastRead = Promise.resolve({ value: null, done: !1 });
751
751
  }
@@ -759,7 +759,7 @@ class Z extends i {
759
759
  return { value: this.outputQueue.shift(), done: !1 };
760
760
  }
761
761
  }
762
- class tt extends Z {
762
+ class tt extends j {
763
763
  constructor(t, e) {
764
764
  super(), this.upstream = t, this.transform = e;
765
765
  }
@@ -1,5 +1,5 @@
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
- import { s as f } from "./index-C4L8Cm77.js";
1
+ import { C as l, D as h, E as m, ao as p, M as c, ap as f, af as g, n as u, T as V, o as v, q as N, a as w } from "./index-DdmHGZjq.js";
2
+ import { s as d } from "./index-C4L8Cm77.js";
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -41,7 +41,7 @@ class T {
41
41
  constructor(t, e, s, n, o) {
42
42
  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);
43
43
  const a = o || Math.random();
44
- this.random = f.alea(a.toString());
44
+ this.random = d.alea(a.toString());
45
45
  }
46
46
  /** Returns next sample from a Gaussian distribution. */
47
47
  nextValue() {
@@ -69,11 +69,11 @@ class T {
69
69
  return t <= this.upper && t >= this.lower;
70
70
  }
71
71
  }
72
- class $ {
72
+ class M {
73
73
  constructor(t = 0, e = 1, s, n) {
74
74
  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)
75
75
  throw new Error(`The difference between ${t} - ${e} <= 1 and dtype is not float`);
76
- this.random = f.alea(n);
76
+ this.random = d.alea(n);
77
77
  }
78
78
  convertValue(t) {
79
79
  return this.canReturnFloat() ? t : Math.round(t);
@@ -98,15 +98,15 @@ class $ {
98
98
  * limitations under the License.
99
99
  * =============================================================================
100
100
  */
101
- function y(r, t = 0, e = 1, s, n) {
101
+ function $(r, t = 0, e = 1, s, n) {
102
102
  if (c(r), s != null && s === "bool")
103
103
  throw new Error(`Unsupported data type ${s}`);
104
- const o = new T(t, e, s, !1, n), a = d(r, s);
104
+ const o = new T(t, e, s, !1, n), a = f(r, s);
105
105
  for (let i = 0; i < a.values.length; i++)
106
106
  a.values[i] = o.nextValue();
107
107
  return a.toTensor();
108
108
  }
109
- const _ = /* @__PURE__ */ l({ randomNormal_: y });
109
+ const _ = /* @__PURE__ */ l({ randomNormal_: $ });
110
110
  /**
111
111
  * @license
112
112
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -123,14 +123,14 @@ const _ = /* @__PURE__ */ l({ randomNormal_: y });
123
123
  * limitations under the License.
124
124
  * =============================================================================
125
125
  */
126
- function M(r, t = 0, e = 1, s = "float32", n) {
126
+ function y(r, t = 0, e = 1, s = "float32", n) {
127
127
  c(r);
128
- const o = d(r, s), a = new $(t, e, null, n);
128
+ const o = f(r, s), a = new M(t, e, null, n);
129
129
  for (let i = 0; i < o.values.length; i++)
130
130
  o.values[i] = a.nextValue();
131
131
  return o.toTensor();
132
132
  }
133
- const D = /* @__PURE__ */ l({ randomUniform_: M });
133
+ const D = /* @__PURE__ */ l({ randomUniform_: y });
134
134
  /**
135
135
  * @license
136
136
  * Copyright 2019 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { R as o } from "./random_width-D8Pwy_na.js";
1
+ import { R as o } from "./random_width-DKGeiFuR.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2018 Google LLC
@@ -1,4 +1,4 @@
1
- import { B as g, C as t, E as h, G as p } from "./index-CUQrfsw_.js";
1
+ import { C as g, D as t, E as h, G as p } from "./index-DdmHGZjq.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-CUQrfsw_.js";
1
+ import { i as t, e as n } from "./index-DdmHGZjq.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 { 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";
1
+ import { aD as z, ag as v, aE as oe, aF as ie, aG as ae, n as F, aH as me, aI as J, a3 as B, aJ as I, af as T, j as E, aK as H, aL as $e, aM as Y, ae as Te } from "./index-DdmHGZjq.js";
2
2
  import "./index-Tf7vU29b.js";
3
- import { b as Se } from "./backend_util-BJ-_jSeK.js";
3
+ import { b as Se } from "./backend_util-yC3YH1jo.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2018 Google LLC. All Rights Reserved.