@genai-fi/nanogpt 0.5.4 → 0.5.5

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 (102) hide show
  1. package/dist/Generator.js +5 -5
  2. package/dist/NanoGPTModel.d.ts +2 -0
  3. package/dist/NanoGPTModel.js +8 -8
  4. package/dist/{Reshape-Bt_t7RNz.js → Reshape-Biok_3X1.js} +6 -6
  5. package/dist/TeachableLLM.js +1 -1
  6. package/dist/{TiedEmbedding-DORsPlNL.js → TiedEmbedding-8S8xn8e6.js} +5 -5
  7. package/dist/Trainer.d.ts +1 -0
  8. package/dist/Trainer.js +8 -7
  9. package/dist/{axis_util-CVbf1vmL.js → axis_util-BczFISHz.js} +1 -1
  10. package/dist/{broadcast_to-BBoMQXbL.js → broadcast_to-B7NGsBSh.js} +2 -2
  11. package/dist/{concat-BRRtq4S2.js → concat-DdKPyAtw.js} +1 -1
  12. package/dist/{dataset-ZHEPJmED.js → dataset-iqT4Otvb.js} +7 -7
  13. package/dist/{dropout-lQm_YyX3.js → dropout-B09InSJS.js} +1 -1
  14. package/dist/{gather-BWyutxwi.js → gather-D6MsdXqc.js} +1 -1
  15. package/dist/{gpgpu_math-Df7gzJWH.js → gpgpu_math-BFbOyvk4.js} +1 -1
  16. package/dist/{index-CnHyhpKc.js → index-Du-bmOP8.js} +98 -98
  17. package/dist/{kernel_funcs_utils-Dqo82NH4.js → kernel_funcs_utils-DShm7-0k.js} +33 -33
  18. package/dist/layers/BaseLayer.js +2 -2
  19. package/dist/layers/CausalSelfAttention.js +6 -6
  20. package/dist/layers/MLP.js +5 -5
  21. package/dist/layers/RMSNorm.js +3 -3
  22. package/dist/layers/RoPECache.js +3 -3
  23. package/dist/layers/TiedEmbedding.js +6 -6
  24. package/dist/layers/TransformerBlock.js +1 -1
  25. package/dist/{log_sum_exp-CRH7Np9v.js → log_sum_exp-CxfBtUaG.js} +5 -5
  26. package/dist/main.js +1 -1
  27. package/dist/{mat_mul-DeGU1U_C.js → mat_mul-CbiqIe2d.js} +1 -1
  28. package/dist/{max-CcnEArWK.js → max-0Xnlpv8k.js} +1 -1
  29. package/dist/{norm-BpWsOapl.js → norm-01kY9I2B.js} +5 -5
  30. package/dist/{ones-CDWGzVnm.js → ones-CrutWGas.js} +2 -2
  31. package/dist/ops/appendCache.js +3 -3
  32. package/dist/ops/attentionMask.js +1 -1
  33. package/dist/ops/cpu/appendCache.js +2 -2
  34. package/dist/ops/cpu/attentionMask.js +5 -5
  35. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  36. package/dist/ops/cpu/gatherSub.js +3 -3
  37. package/dist/ops/cpu/gelu.js +1 -1
  38. package/dist/ops/cpu/matMulGelu.js +1 -1
  39. package/dist/ops/cpu/matMulMul.js +1 -1
  40. package/dist/ops/cpu/mulDropout.js +1 -1
  41. package/dist/ops/cpu/normRMS.js +1 -1
  42. package/dist/ops/cpu/qkv.js +3 -3
  43. package/dist/ops/cpu/rope.js +5 -5
  44. package/dist/ops/cpu/scatterSub.js +4 -4
  45. package/dist/ops/fusedSoftmax.js +1 -1
  46. package/dist/ops/gatherSub.js +1 -1
  47. package/dist/ops/gelu.js +1 -1
  48. package/dist/ops/grads/attentionMask.js +1 -1
  49. package/dist/ops/grads/fusedSoftmax.js +2 -2
  50. package/dist/ops/grads/gelu.js +1 -1
  51. package/dist/ops/grads/matMulGelu.js +1 -1
  52. package/dist/ops/grads/normRMS.js +1 -1
  53. package/dist/ops/grads/qkv.js +1 -1
  54. package/dist/ops/grads/rope.js +1 -1
  55. package/dist/ops/matMulGelu.js +1 -1
  56. package/dist/ops/matMulMul.js +1 -1
  57. package/dist/ops/mulDrop.js +1 -1
  58. package/dist/ops/node/sparseCrossEntropy.js +1 -1
  59. package/dist/ops/normRMS.js +1 -1
  60. package/dist/ops/qkv.js +1 -1
  61. package/dist/ops/scatterSub.js +1 -1
  62. package/dist/ops/webgl/appendCache.js +1 -1
  63. package/dist/ops/webgl/attentionMask.js +1 -1
  64. package/dist/ops/webgl/fusedSoftmax.js +96 -96
  65. package/dist/ops/webgl/gatherSub.js +1 -1
  66. package/dist/ops/webgl/gelu.js +2 -2
  67. package/dist/ops/webgl/matMulGelu.js +4 -4
  68. package/dist/ops/webgl/matMulMul.js +1 -1
  69. package/dist/ops/webgl/mulDropout.js +1 -1
  70. package/dist/ops/webgl/normRMS.js +2 -2
  71. package/dist/ops/webgl/qkv.js +1 -1
  72. package/dist/ops/webgl/rope.js +1 -1
  73. package/dist/ops/webgl/scatterSub.js +1 -1
  74. package/dist/{ops-DzQTmLIl.js → ops-CJNniCAV.js} +13 -13
  75. package/dist/{random_width-DI2h9CMs.js → random_width-C-v-35bY.js} +1324 -1279
  76. package/dist/{range-CkOJ7090.js → range-Bvs1hidm.js} +1 -1
  77. package/dist/{reshape-CTIbqjwm.js → reshape-BH7eBpwq.js} +1 -1
  78. package/dist/{sin-HzioENy_.js → sin-CPAZXNjH.js} +1 -1
  79. package/dist/{slice_util-n4wHKmex.js → slice_util-DskXqRZa.js} +1 -1
  80. package/dist/{softmax-DX6qXAbm.js → softmax-DhWoBa7r.js} +1 -1
  81. package/dist/{split-CVwhL8Oe.js → split-BCUhuU7B.js} +1 -1
  82. package/dist/{stack-S2-D2JAQ.js → stack-BV1v7l3S.js} +1 -1
  83. package/dist/{sum-UdfvaNhB.js → sum-Cvq06317.js} +1 -1
  84. package/dist/{tensor-IZex6Bwp.js → tensor-DgTOPY6h.js} +1 -1
  85. package/dist/{tensor2d-CqtBzOKq.js → tensor2d-CRWjDyUe.js} +1 -1
  86. package/dist/{tfjs_backend-DX9yVvwk.js → tfjs_backend-D9Ytje0G.js} +39 -39
  87. package/dist/training/AdamExt.js +1 -1
  88. package/dist/training/DatasetBuilder.js +2 -2
  89. package/dist/training/FullTrainer.js +36 -32
  90. package/dist/training/Trainer.d.ts +7 -4
  91. package/dist/training/Trainer.js +58 -50
  92. package/dist/training/sparseCrossEntropy.js +4 -4
  93. package/dist/utilities/dummy.js +2 -2
  94. package/dist/utilities/generate.js +3 -3
  95. package/dist/utilities/load.js +1 -1
  96. package/dist/utilities/profile.d.ts +1 -0
  97. package/dist/utilities/profile.js +6 -3
  98. package/dist/utilities/weights.js +2 -2
  99. package/dist/{variable-BGvK-VN3.js → variable-DZ3fF0R2.js} +1 -1
  100. package/dist/{zeros-CYMicyqz.js → zeros-BaHhQTWf.js} +1 -1
  101. package/package.json +1 -1
  102. package/dist/moments-DLTE6-1p.js +0 -53
@@ -5,6 +5,7 @@ export default class MemoryProfiler {
5
5
  private lastMemInfo;
6
6
  private peakMemory;
7
7
  startMemory(): void;
8
+ getPeakMemory(): number;
8
9
  endMemory(label: string): void;
9
10
  printSummary(): void;
10
11
  }
@@ -1,6 +1,6 @@
1
- import { m as s } from "../index-CnHyhpKc.js";
1
+ import { m as s } from "../index-Du-bmOP8.js";
2
2
  const m = 1024 * 1024;
3
- class i {
3
+ class M {
4
4
  log = /* @__PURE__ */ new Map();
5
5
  maxMemory = 0;
6
6
  maxLabel;
@@ -9,6 +9,9 @@ class i {
9
9
  startMemory() {
10
10
  this.lastMemInfo.push(s());
11
11
  }
12
+ getPeakMemory() {
13
+ return this.peakMemory;
14
+ }
12
15
  endMemory(e) {
13
16
  if (this.lastMemInfo.length === 0) {
14
17
  console.warn("MemoryProfiler: endMemory called without matching startMemory");
@@ -25,5 +28,5 @@ class i {
25
28
  }
26
29
  }
27
30
  export {
28
- i as default
31
+ M as default
29
32
  };
@@ -1,5 +1,5 @@
1
- import "../index-CnHyhpKc.js";
2
- import { t as p } from "../tensor-IZex6Bwp.js";
1
+ import "../index-Du-bmOP8.js";
2
+ import { t as p } from "../tensor-DgTOPY6h.js";
3
3
  function h(n) {
4
4
  const e = n.reduce((s, o) => s + o.length, 0), a = new Float32Array(e);
5
5
  let t = 0;
@@ -1,4 +1,4 @@
1
- import { E as i } from "./index-CnHyhpKc.js";
1
+ import { E as i } from "./index-Du-bmOP8.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { o as m, j as r, X as l, E as c, Y as i, n as p, Z as u, q as f } from "./index-CnHyhpKc.js";
1
+ import { o as m, j as r, X as l, E as c, Y as i, n as p, Z as u, q as f } from "./index-Du-bmOP8.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2020 Google LLC. All Rights Reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/nanogpt",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -1,53 +0,0 @@
1
- import { o as m, j as c, E as f, a0 as i, a1 as l, a2 as h, s as x, D as d } from "./index-CnHyhpKc.js";
2
- import { e as v } from "./axis_util-CVbf1vmL.js";
3
- import { r as E } from "./reshape-CTIbqjwm.js";
4
- /**
5
- * @license
6
- * Copyright 2020 Google Inc. All Rights Reserved.
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * =============================================================================
19
- */
20
- function S(a, t = null, e = !1) {
21
- const s = { x: c(a, "x", "mean") }, o = { axis: t, keepDims: e };
22
- return f.runKernel(i, s, o);
23
- }
24
- const r = /* @__PURE__ */ m({ mean_: S });
25
- /**
26
- * @license
27
- * Copyright 2020 Google LLC. All Rights Reserved.
28
- * Licensed under the Apache License, Version 2.0 (the "License");
29
- * you may not use this file except in compliance with the License.
30
- * You may obtain a copy of the License at
31
- *
32
- * http://www.apache.org/licenses/LICENSE-2.0
33
- *
34
- * Unless required by applicable law or agreed to in writing, software
35
- * distributed under the License is distributed on an "AS IS" BASIS,
36
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37
- * See the License for the specific language governing permissions and
38
- * limitations under the License.
39
- * =============================================================================
40
- */
41
- function T(a, t = null, e = !1) {
42
- a = c(a, "x", "moments");
43
- const n = l(t, a.shape), s = r(a, n, e);
44
- let o = s.shape;
45
- e || (o = v(s.shape, n));
46
- const p = h(x(d(a, "float32"), E(s, o))), u = r(p, n, e);
47
- return { mean: s, variance: u };
48
- }
49
- const N = /* @__PURE__ */ m({ moments_: T });
50
- export {
51
- N as a,
52
- r as m
53
- };