@genai-fi/nanogpt 0.6.0 → 0.6.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 (110) hide show
  1. package/dist/Generator.js +7 -7
  2. package/dist/NanoGPTModel.js +70 -121
  3. package/dist/RealDiv-7xu-pkZN.js +540 -0
  4. package/dist/Reshape-BYC1oUku.js +127 -0
  5. package/dist/TeachableLLM.d.ts +2 -0
  6. package/dist/TeachableLLM.js +34 -27
  7. package/dist/{TiedEmbedding-BhxWO8QR.js → TiedEmbedding-C1HBot-5.js} +12 -13
  8. package/dist/{axis_util-D17qZRQm.js → axis_util-CCNL7jea.js} +14 -12
  9. package/dist/{broadcast_to-BMQLjvt_.js → broadcast_to-CddAF879.js} +2 -2
  10. package/dist/{concat-DhZfF1GY.js → concat-XOK9ANZu.js} +7 -7
  11. package/dist/{dataset-oilnemHf.js → dataset-BFFipD1c.js} +5 -5
  12. package/dist/{dropout-CrMQPCeG.js → dropout-xlKRoJyU.js} +9 -9
  13. package/dist/{gather-DZCMHZuN.js → gather-DKtUaTtA.js} +1 -1
  14. package/dist/gpgpu_math-B_ycgZ4W.js +3115 -0
  15. package/dist/{index-bMBtI-WR.js → index-CamYe_M8.js} +843 -646
  16. package/dist/{kernel_funcs_utils-CNmjLWnB.js → kernel_funcs_utils-D5MS0JFg.js} +232 -138
  17. package/dist/layers/BaseLayer.js +2 -2
  18. package/dist/layers/CausalSelfAttention.js +6 -6
  19. package/dist/layers/MLP.js +5 -5
  20. package/dist/layers/RMSNorm.js +3 -3
  21. package/dist/layers/RoPECache.js +13 -33
  22. package/dist/layers/TiedEmbedding.js +6 -7
  23. package/dist/layers/TransformerBlock.js +1 -1
  24. package/dist/{log_sum_exp-BHdkCb4s.js → log_sum_exp-CV_5-TTu.js} +15 -15
  25. package/dist/main.js +23 -20
  26. package/dist/{mat_mul-BsrLfy81.js → mat_mul-CAbRFWUj.js} +4 -4
  27. package/dist/{max-DechV4Bc.js → max-JBBv7aUf.js} +3 -3
  28. package/dist/mulmat_packed_gpu-DW4doKL_.js +71 -0
  29. package/dist/{norm-B9hWHZH1.js → norm-B9dQTFYn.js} +12 -12
  30. package/dist/{ones-g0K8jVwm.js → ones-CMHNqMr6.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 +5 -5
  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 +18 -49
  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/rope.js +8 -4
  62. package/dist/ops/scatterSub.js +1 -1
  63. package/dist/ops/webgl/appendCache.js +1 -1
  64. package/dist/ops/webgl/attentionMask.js +1 -1
  65. package/dist/ops/webgl/fusedSoftmax.js +29 -560
  66. package/dist/ops/webgl/gatherSub.js +1 -1
  67. package/dist/ops/webgl/gelu.js +2 -2
  68. package/dist/ops/webgl/log.js +3 -3
  69. package/dist/ops/webgl/matMulGelu.js +48 -115
  70. package/dist/ops/webgl/matMulMul.js +1 -1
  71. package/dist/ops/webgl/mulDropout.js +1 -1
  72. package/dist/ops/webgl/normRMS.js +2 -2
  73. package/dist/ops/webgl/qkv.js +1 -1
  74. package/dist/ops/webgl/rope.js +1 -1
  75. package/dist/ops/webgl/scatterSub.js +1 -1
  76. package/dist/{ops-Mv7Ta72x.js → ops-DqtYemmV.js} +143 -135
  77. package/dist/{random_width-BBAWzDym.js → random_width-CLMQG5Jn.js} +6925 -6291
  78. package/dist/{range-DMaG9A3G.js → range-DqYjKnuG.js} +1 -1
  79. package/dist/{gpgpu_math-Ctc31slO.js → reciprocal-z49filta.js} +7 -5
  80. package/dist/register_all_kernels-COt6wLD0.js +21397 -0
  81. package/dist/{reshape-T4yDEqoF.js → reshape-C45vIIRU.js} +1 -1
  82. package/dist/scatter_nd_util-qgtnviTE.js +46 -0
  83. package/dist/selu_util-4QV_GXTB.js +740 -0
  84. package/dist/{shared-XNAoXhOa.js → shared-ByfrGA97.js} +1462 -1089
  85. package/dist/{sin-EEhbrRO_.js → sin-9JBrfVaB.js} +1 -1
  86. package/dist/{softmax-B2_IKPDR.js → softmax-DvMvui-_.js} +1 -1
  87. package/dist/{split-dcks18H1.js → split-DxrHrPFK.js} +4 -4
  88. package/dist/{stack-lpJ5kYvE.js → stack-DgaoDmnF.js} +1 -1
  89. package/dist/{sum-CutF5lj2.js → sum-BpcpxNEh.js} +3 -3
  90. package/dist/{tensor-C15NA2LA.js → tensor-CDz5x1mP.js} +1 -1
  91. package/dist/{tensor2d-DZ_e5eKM.js → tensor2d-jO8JY5Jd.js} +1 -1
  92. package/dist/training/AdamExt.js +1 -1
  93. package/dist/training/DatasetBuilder.js +2 -2
  94. package/dist/training/FullTrainer.js +1 -1
  95. package/dist/training/Trainer.js +3 -3
  96. package/dist/training/sparseCrossEntropy.js +4 -4
  97. package/dist/utilities/dummy.d.ts +6 -0
  98. package/dist/utilities/dummy.js +31 -10
  99. package/dist/utilities/generate.js +3 -3
  100. package/dist/utilities/load.js +1 -1
  101. package/dist/utilities/profile.d.ts +5 -0
  102. package/dist/utilities/profile.js +10 -7
  103. package/dist/utilities/safetensors.js +2 -2
  104. package/dist/utilities/weights.js +2 -2
  105. package/dist/{variable-CdRKKp8x.js → variable-CLVXjN7F.js} +1 -1
  106. package/dist/{zeros-CAbHfODe.js → zeros-DUkkVccu.js} +8 -8
  107. package/package.json +3 -9
  108. package/dist/Reshape-CLOrdpve.js +0 -212
  109. package/dist/slice_util-Ddk0uxGJ.js +0 -49
  110. package/dist/tfjs_backend-BDb8r9qx.js +0 -1010
@@ -1,4 +1,4 @@
1
- import { o, j as t, E as a, w as p } from "./index-bMBtI-WR.js";
1
+ import { q as o, w as t, E as a, F as p } from "./index-CamYe_M8.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -0,0 +1,46 @@
1
+ import { i as p, W as w } from "./index-CamYe_M8.js";
2
+ function k(o, t, r) {
3
+ const n = t.rank > 1 ? t.shape[t.rank - 1] : 1, e = t.rank > 1 ? t.rank - 1 : 1, h = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${r.shape}, indices.shape: ${t.shape}, shape: ${o}, sliceDim: ${n}, and batchDim: ${e}.`;
4
+ if (r.rank < e)
5
+ throw new Error(h + ` update.rank < ${e}. `);
6
+ if (o.length < n + (r.rank - e))
7
+ throw new Error(h + ` Output shape length < ${n + (r.rank - e)}`);
8
+ if (r.rank !== e + o.length - n)
9
+ throw new Error(h + ` update.rank != ${e + o.length - n}`);
10
+ for (let a = 0; a < e; ++a)
11
+ if (r.shape[a] !== t.shape[a])
12
+ throw new Error(h + ` updates.shape[${a}] (${r.shape[a]}) != indices.shape[${a}] (${t.shape[a]}).`);
13
+ for (let a = 0; a < r.rank - e; ++a)
14
+ if (r.shape[a + e] !== o[a + n])
15
+ throw new Error(h + ` updates.shape[${a + e}] (${r.shape[a + e]}) != shape[${a + e}] (${o[a + e]})`);
16
+ }
17
+ function $(o, t, r) {
18
+ if (t.rank < 1)
19
+ throw new Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);
20
+ if (o.rank < 1)
21
+ throw new Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${o.rank}.`);
22
+ if (t.dtype !== "int32")
23
+ throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);
24
+ if (r.length < 1)
25
+ throw new Error(`Output rank must be greater or equal to 1, but got shape: ${r}`);
26
+ if (r.length === 0) {
27
+ if (t.size === 0)
28
+ throw new Error(`Indices specified for empty output. indices shape: ${t.shape}`);
29
+ if (o.size === 0)
30
+ throw new Error(`Updates specified for empty output. updates shape: ${o.shape}`);
31
+ }
32
+ k(r, t, o);
33
+ }
34
+ function m(o, t, r) {
35
+ const n = t.shape.length, e = n > 1 ? t.shape[n - 1] : 1, h = r.length;
36
+ let a = 1;
37
+ for (let s = e; s < h; ++s)
38
+ a *= r[s];
39
+ const i = e < 1 ? 1 : e, f = p(t.shape) / i, c = [...w(r.slice(0, e)), 1], l = p(r);
40
+ return { sliceRank: e, numUpdates: f, sliceSize: a, strides: c, outputSize: l };
41
+ }
42
+ export {
43
+ k as a,
44
+ m as c,
45
+ $ as v
46
+ };