@genai-fi/nanogpt 0.7.3 → 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 (197) hide show
  1. package/dist/Generator.d.ts +25 -2
  2. package/dist/Generator.js +152 -49
  3. package/dist/{RealDiv-Dy0p8Bvo.js → RealDiv-D_q39E3A.js} +13 -13
  4. package/dist/{Reshape-DvudQDvJ.js → Reshape-41YpQqEo.js} +1 -1
  5. package/dist/{Reshape-DH5srBP0.js → Reshape-Bh_jzKzV.js} +5 -5
  6. package/dist/TeachableLLM.d.ts +6 -6
  7. package/dist/TeachableLLM.js +33 -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-Did9235A.js} +3 -3
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-TE7aTPhZ.js → backend_util-yC3YH1jo.js} +58 -58
  13. package/dist/{broadcast_to-CdbwV-Dj.js → broadcast_to-CUvOdOT5.js} +2 -2
  14. package/dist/checks/appendCache.d.ts +1 -0
  15. package/dist/checks/appendCache.js +22 -0
  16. package/dist/checks/attentionMask.d.ts +1 -0
  17. package/dist/checks/attentionMask.js +37 -0
  18. package/dist/checks/check.d.ts +9 -0
  19. package/dist/checks/check.js +20 -0
  20. package/dist/checks/gelu.d.ts +1 -0
  21. package/dist/checks/gelu.js +18 -0
  22. package/dist/checks/index.d.ts +19 -0
  23. package/dist/checks/index.js +21 -0
  24. package/dist/checks/normRMS.d.ts +1 -0
  25. package/dist/checks/normRMS.js +16 -0
  26. package/dist/checks/normRMSGrad.d.ts +1 -0
  27. package/dist/checks/normRMSGrad.js +12 -0
  28. package/dist/checks/qkv.d.ts +1 -0
  29. package/dist/checks/qkv.js +25 -0
  30. package/dist/checks/rope.d.ts +1 -0
  31. package/dist/checks/rope.js +21 -0
  32. package/dist/{concat-CsxrgovM.js → concat-pHiVqR3L.js} +1 -1
  33. package/dist/{dataset-CtdBYwjo.js → dataset-DPPl-iLT.js} +9 -9
  34. package/dist/{dropout-DYs5QFGQ.js → dropout-CcKSfOYE.js} +18 -18
  35. package/dist/exports_initializers-DKk7-bsx.js +16 -0
  36. package/dist/{gather-CMMy2KEG.js → gather-CPg6ZlQA.js} +1 -1
  37. package/dist/{gelu-C-dPj6Ku.js → gelu-BkcmEEyD.js} +1 -1
  38. package/dist/{gpgpu_math-DGNLNL4I.js → gpgpu_math-D_ODOLix.js} +26 -26
  39. package/dist/{index-BoWRt-10.js → index-DdmHGZjq.js} +659 -650
  40. package/dist/{index-CLthM0TO.js → index-evZ57wr4.js} +185 -185
  41. package/dist/{kernel_funcs_utils-BYKWV8Aa.js → kernel_funcs_utils-CDfFpUab.js} +21 -21
  42. package/dist/layers/BaseLayer.d.ts +8 -13
  43. package/dist/layers/BaseLayer.js +25 -13
  44. package/dist/layers/CausalSelfAttention.d.ts +3 -2
  45. package/dist/layers/CausalSelfAttention.js +28 -28
  46. package/dist/layers/MLP.d.ts +3 -2
  47. package/dist/layers/MLP.js +16 -20
  48. package/dist/layers/PositionEmbedding.d.ts +9 -0
  49. package/dist/layers/PositionEmbedding.js +45 -0
  50. package/dist/layers/RMSNorm.d.ts +3 -2
  51. package/dist/layers/RMSNorm.js +6 -6
  52. package/dist/layers/RoPECache.d.ts +1 -1
  53. package/dist/layers/RoPECache.js +4 -4
  54. package/dist/layers/TiedEmbedding.d.ts +3 -2
  55. package/dist/layers/TiedEmbedding.js +29 -7
  56. package/dist/layers/TransformerBlock.d.ts +3 -2
  57. package/dist/layers/TransformerBlock.js +1 -1
  58. package/dist/loader/load.d.ts +2 -2
  59. package/dist/loader/loadHF.d.ts +2 -2
  60. package/dist/loader/loadTransformers.d.ts +4 -2
  61. package/dist/loader/loadTransformers.js +10 -9
  62. package/dist/loader/newZipLoad.d.ts +2 -2
  63. package/dist/loader/oldZipLoad.d.ts +2 -2
  64. package/dist/loader/oldZipLoad.js +44 -51
  65. package/dist/loader/save.d.ts +8 -0
  66. package/dist/loader/save.js +62 -0
  67. package/dist/{log_sum_exp-DbjkV734.js → log_sum_exp-C8yFJfZz.js} +45 -24
  68. package/dist/main.d.ts +6 -4
  69. package/dist/main.js +24 -18
  70. package/dist/{mat_mul-8m8pfdcx.js → mat_mul-Dpy2mMRu.js} +1 -1
  71. package/dist/mod-CbibJi3D.js +27 -0
  72. package/dist/models/NanoGPTV1.d.ts +15 -0
  73. package/dist/models/NanoGPTV1.js +71 -0
  74. package/dist/{config.d.ts → models/config.d.ts} +1 -0
  75. package/dist/{config.js → models/config.js} +1 -0
  76. package/dist/models/factory.d.ts +3 -0
  77. package/dist/models/factory.js +14 -0
  78. package/dist/models/model.d.ts +26 -0
  79. package/dist/models/model.js +70 -0
  80. package/dist/{mulmat_packed_gpu-VSekgsNv.js → mulmat_packed_gpu-q_Gmwyld.js} +1 -1
  81. package/dist/{ones-Dj0SDhHf.js → ones-BAqVh-eA.js} +2 -2
  82. package/dist/ops/adamAdjust.js +1 -1
  83. package/dist/ops/adamMoments.js +1 -1
  84. package/dist/ops/appendCache.js +3 -3
  85. package/dist/ops/attentionMask.js +1 -1
  86. package/dist/ops/cpu/adamAdjust.js +9 -9
  87. package/dist/ops/cpu/adamMoments.js +2 -2
  88. package/dist/ops/cpu/appendCache.js +2 -2
  89. package/dist/ops/cpu/attentionMask.js +5 -5
  90. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  91. package/dist/ops/cpu/gatherSub.js +5 -5
  92. package/dist/ops/cpu/gelu.js +1 -1
  93. package/dist/ops/cpu/matMulGelu.js +2 -2
  94. package/dist/ops/cpu/matMulMul.js +1 -1
  95. package/dist/ops/cpu/mulDropout.js +1 -1
  96. package/dist/ops/cpu/normRMS.js +1 -1
  97. package/dist/ops/cpu/qkv.js +3 -3
  98. package/dist/ops/cpu/rope.js +5 -5
  99. package/dist/ops/cpu/scatterSub.js +7 -7
  100. package/dist/ops/fusedSoftmax.js +1 -1
  101. package/dist/ops/gatherSub.js +1 -1
  102. package/dist/ops/gelu.js +2 -2
  103. package/dist/ops/grads/attentionMask.js +1 -1
  104. package/dist/ops/grads/fusedSoftmax.js +2 -2
  105. package/dist/ops/grads/gelu.js +2 -2
  106. package/dist/ops/grads/matMulGelu.js +1 -1
  107. package/dist/ops/grads/normRMS.js +1 -1
  108. package/dist/ops/grads/qkv.js +1 -1
  109. package/dist/ops/grads/rope.js +1 -1
  110. package/dist/ops/matMulGelu.js +1 -1
  111. package/dist/ops/matMulMul.js +1 -1
  112. package/dist/ops/mulDrop.js +1 -1
  113. package/dist/ops/normRMS.js +1 -1
  114. package/dist/ops/qkv.js +1 -1
  115. package/dist/ops/rope.js +4 -4
  116. package/dist/ops/scatterSub.js +1 -1
  117. package/dist/ops/webgl/adamAdjust.js +2 -2
  118. package/dist/ops/webgl/adamMoments.js +1 -1
  119. package/dist/ops/webgl/appendCache.js +1 -1
  120. package/dist/ops/webgl/attentionMask.js +1 -1
  121. package/dist/ops/webgl/fusedSoftmax.js +4 -4
  122. package/dist/ops/webgl/gatherSub.js +1 -1
  123. package/dist/ops/webgl/gelu.js +2 -2
  124. package/dist/ops/webgl/log.js +3 -3
  125. package/dist/ops/webgl/matMulGelu.js +10 -10
  126. package/dist/ops/webgl/matMulMul.js +1 -1
  127. package/dist/ops/webgl/mulDropout.js +1 -1
  128. package/dist/ops/webgl/normRMS.js +2 -2
  129. package/dist/ops/webgl/qkv.js +1 -1
  130. package/dist/ops/webgl/rope.js +1 -1
  131. package/dist/ops/webgl/scatterSub.js +1 -1
  132. package/dist/ops/webgpu/adamAdjust.js +3 -3
  133. package/dist/ops/webgpu/adamMoments.js +3 -3
  134. package/dist/ops/webgpu/appendCache.js +3 -3
  135. package/dist/ops/webgpu/attentionMask.js +3 -3
  136. package/dist/ops/webgpu/gatherSub.js +3 -3
  137. package/dist/ops/webgpu/gelu.js +3 -3
  138. package/dist/ops/webgpu/normRMS.js +2 -2
  139. package/dist/ops/webgpu/normRMSGrad.js +5 -5
  140. package/dist/ops/webgpu/qkv.js +3 -3
  141. package/dist/ops/webgpu/rope.js +3 -3
  142. package/dist/ops/webgpu/scatterSub.js +3 -3
  143. package/dist/ops/webgpu/utils/reductions.js +4 -4
  144. package/dist/ops-542ai2vG.js +1525 -0
  145. package/dist/{random_width-sZORGo5k.js → random_width-DKGeiFuR.js} +1471 -1538
  146. package/dist/{range-CRuAh-gd.js → range-BcUvLuf5.js} +1 -1
  147. package/dist/{reciprocal-BvGAyKyu.js → reciprocal-DhDWSKiD.js} +1 -1
  148. package/dist/{register_all_kernels-BwDSRN-f.js → register_all_kernels-Do9VvZmo.js} +2488 -2534
  149. package/dist/{max-Ddnnb5xe.js → relu-B1AXs7p5.js} +6 -6
  150. package/dist/{reshape-CdBq1WJ6.js → reshape-WeJkT3ja.js} +1 -1
  151. package/dist/{scatter_nd_util-DUstGbU1.js → scatter_nd_util-B7yDhiQr.js} +1 -1
  152. package/dist/{selu_util-BJEXVvjX.js → selu_util-BgUO9gHY.js} +125 -146
  153. package/dist/{shared-wS99K7_n.js → shared-CZiWmQCI.js} +1 -1
  154. package/dist/{shared-B8ztnyEk.js → shared-V6D_md-c.js} +72 -72
  155. package/dist/{sin-BeA3tsEd.js → sin-CPxad7Am.js} +1 -1
  156. package/dist/{slice-BiOsknYS.js → slice-B7jXtPnp.js} +1 -1
  157. package/dist/{softmax-Bv_6lyMX.js → softmax-BfsyI4As.js} +1 -1
  158. package/dist/{split-B-dikLRw.js → split-BPxr8_8m.js} +1 -1
  159. package/dist/{stack-B17UN2nn.js → stack-BNwLzE43.js} +1 -1
  160. package/dist/{sum-66ew2byf.js → sum-ByFINZgi.js} +3 -3
  161. package/dist/{tensor-JwS7ZYY6.js → tensor-DbqgIV9B.js} +1 -1
  162. package/dist/tensor1d-CtJq5BOv.js +27 -0
  163. package/dist/{tensor2d-wxPAnDQy.js → tensor2d-CObBWBkW.js} +1 -1
  164. package/dist/tensor3d-BOukqWwr.js +30 -0
  165. package/dist/tensor4d-DLtk7Nxh.js +30 -0
  166. package/dist/training/Adam.js +2 -2
  167. package/dist/training/AdamExt.js +1 -1
  168. package/dist/training/DatasetBuilder.js +2 -2
  169. package/dist/training/Evaluator.d.ts +2 -2
  170. package/dist/training/FullTrainer.d.ts +3 -3
  171. package/dist/training/FullTrainer.js +61 -69
  172. package/dist/training/Trainer.d.ts +15 -3
  173. package/dist/training/Trainer.js +39 -47
  174. package/dist/training/sparseCrossEntropy.js +12 -13
  175. package/dist/utilities/arrayClose.d.ts +1 -1
  176. package/dist/utilities/arrayClose.js +16 -7
  177. package/dist/utilities/dummy.d.ts +4 -4
  178. package/dist/utilities/dummy.js +13 -13
  179. package/dist/utilities/multinomialCPU.js +2 -2
  180. package/dist/utilities/parameters.d.ts +1 -1
  181. package/dist/utilities/performance.js +1 -1
  182. package/dist/utilities/profile.js +1 -1
  183. package/dist/utilities/safetensors.js +2 -2
  184. package/dist/utilities/weights.js +2 -2
  185. package/dist/{variable-BuddVFLa.js → variable-DPFOJyRG.js} +1 -1
  186. package/dist/{webgpu_program-PFzf1hAQ.js → webgpu_program-Dhk9R5aG.js} +1 -1
  187. package/dist/{webgpu_util-D____QpY.js → webgpu_util-BqGnZg8t.js} +27 -27
  188. package/dist/{zeros--BdLQ3oG.js → zeros-Dnwix0p4.js} +1 -1
  189. package/package.json +2 -3
  190. package/dist/NanoGPTModel.d.ts +0 -52
  191. package/dist/NanoGPTModel.js +0 -203
  192. package/dist/TiedEmbedding-BxOerUmB.js +0 -43
  193. package/dist/ops-BFGCx8Ri.js +0 -1202
  194. package/dist/utilities/generate.d.ts +0 -3
  195. package/dist/utilities/generate.js +0 -22
  196. package/dist/utilities/save.d.ts +0 -9
  197. package/dist/utilities/save.js +0 -61
@@ -0,0 +1,71 @@
1
+ import { defaultConfig as m } from "./config.js";
2
+ import f from "../layers/TransformerBlock.js";
3
+ import u from "../layers/TiedEmbedding.js";
4
+ import g from "../layers/RoPECache.js";
5
+ import b from "../layers/RMSNorm.js";
6
+ import { t as l, k as p } from "../index-DdmHGZjq.js";
7
+ import w from "./model.js";
8
+ import k from "../layers/PositionEmbedding.js";
9
+ class R extends w {
10
+ wte;
11
+ // Token embeddings
12
+ wpe;
13
+ // Position embeddings
14
+ // private drop: layers.Layer; // Dropout
15
+ blocks;
16
+ lnF;
17
+ // Final layer norm
18
+ ropeCache;
19
+ constructor(e = {}) {
20
+ super({ ...m, ...e }), this.wte = new u(this.config, "token_embedding", this), this.config.useRope === !1 ? this.wpe = new k(this.config, "positional_embedding", this) : this.ropeCache = new g(this.config), this.blocks = [];
21
+ for (let i = 0; i < this.config.nLayer; i++)
22
+ this.blocks.push(new f(i, this.config, this));
23
+ this.lnF = new b(this.config, "final_rms_norm", this);
24
+ }
25
+ getClassName() {
26
+ return "GenAI_NanoGPT_v1";
27
+ }
28
+ inputPhase(e, i) {
29
+ return l(() => {
30
+ const s = this.wte.embed(e);
31
+ if (this.config.useRope === !1) {
32
+ const o = this.wpe.call(i, s);
33
+ if (Array.isArray(o))
34
+ throw new Error("PositionEmbedding output should not be an array");
35
+ return o;
36
+ }
37
+ return s;
38
+ });
39
+ }
40
+ forward(e, i, s) {
41
+ return this.validateInput(i), e.ropeCache = this.ropeCache, e.outputEmbeddings && (e.embeddings = []), l(() => {
42
+ this.startMemory();
43
+ let o = this.inputPhase(i, e);
44
+ if (e.cache && e.cache.length !== this.blocks.length)
45
+ throw console.error("Cache", e.cache), new Error(
46
+ `Cache length ${e.cache.length} does not match number of blocks ${this.blocks.length}`
47
+ );
48
+ for (let t = 0; t < this.blocks.length; t++) {
49
+ const c = this.blocks[t], d = Math.random() * 1e9, r = {
50
+ ropeCache: e.ropeCache,
51
+ training: e.training,
52
+ seed: d,
53
+ attentionScores: e.attentionScores,
54
+ pastKV: e.cache ? e.cache[t] : void 0
55
+ }, a = e.checkpointing && e.training ? c.callCheckpoint(r, o) : c.call(r, o);
56
+ e.outputEmbeddings ? (p(o), e.embeddings.push(o)) : o.dispose(), o = a;
57
+ }
58
+ o = this.lnF.call(e, o);
59
+ const n = this.wte.project(o);
60
+ e.outputEmbeddings ? (p(o), e.embeddings.push(o)) : o.dispose();
61
+ let h;
62
+ return s && (h = this.calculateLoss(n, s)), this.endMemory("Forward"), h ? [n, h] : [n];
63
+ });
64
+ }
65
+ dispose() {
66
+ this.wte.dispose(), this.wpe && this.wpe.dispose(), this.blocks.forEach((e) => e.dispose()), this.lnF.dispose();
67
+ }
68
+ }
69
+ export {
70
+ R as default
71
+ };
@@ -1,4 +1,5 @@
1
1
  export interface GPTConfig {
2
+ modelType?: string;
2
3
  vocabSize: number;
3
4
  blockSize: number;
4
5
  nLayer: number;
@@ -1,4 +1,5 @@
1
1
  const e = {
2
+ modelType: "GenAI_NanoGPT_v1",
2
3
  vocabSize: 2e3,
3
4
  blockSize: 128,
4
5
  // Maximum sequence length
@@ -0,0 +1,3 @@
1
+ import { GPTConfig } from './config';
2
+ import { default as Model, ModelForwardAttributes } from './model';
3
+ export default function createModelInstance(config: GPTConfig): Model<ModelForwardAttributes>;
@@ -0,0 +1,14 @@
1
+ import o from "./NanoGPTV1.js";
2
+ function a(e) {
3
+ const n = e.modelType || "GenAI_NanoGPT_v1";
4
+ switch (n) {
5
+ case "GenAI_NanoGPT_1":
6
+ case "GenAI_NanoGPT_v1":
7
+ return new o(e);
8
+ default:
9
+ throw new Error(`Unsupported model type: ${n}`);
10
+ }
11
+ }
12
+ export {
13
+ a as default
14
+ };
@@ -0,0 +1,26 @@
1
+ import { Tensor } from '@tensorflow/tfjs-core';
2
+ import { ForwardAttributes, default as BaseLayer } from '../layers/BaseLayer';
3
+ import { AttentionScores, KVCache } from '../layers/CausalSelfAttention';
4
+ export interface ModelForwardAttributes extends ForwardAttributes {
5
+ cache?: KVCache[];
6
+ attentionScores?: AttentionScores;
7
+ seed?: number;
8
+ outputEmbeddings?: boolean;
9
+ embeddings?: Tensor[];
10
+ }
11
+ interface TrainingState {
12
+ steps: number;
13
+ learningRate: number;
14
+ batchSize: number;
15
+ loss: number;
16
+ }
17
+ export default abstract class Model<T extends ModelForwardAttributes> extends BaseLayer<T> {
18
+ trainingState: TrainingState | null;
19
+ abstract getClassName(): string;
20
+ abstract forward(attrs: T, idx: Tensor, targets?: Tensor): Tensor[];
21
+ abstract dispose(): void;
22
+ getNumParams(): number;
23
+ protected validateInput(idx: Tensor): void;
24
+ protected calculateLoss(logits: Tensor, targets: Tensor): Tensor;
25
+ }
26
+ export {};
@@ -0,0 +1,70 @@
1
+ import i from "../layers/BaseLayer.js";
2
+ import "../index-DdmHGZjq.js";
3
+ import "../ops/cpu/attentionMask.js";
4
+ import "../ops/webgl/attentionMask.js";
5
+ import "../ops/grads/attentionMask.js";
6
+ import "../ops/cpu/qkv.js";
7
+ import "../ops/webgl/qkv.js";
8
+ import "../ops/grads/qkv.js";
9
+ import "../random_width-DKGeiFuR.js";
10
+ import "../register_all_kernels-Do9VvZmo.js";
11
+ import "../index-Tf7vU29b.js";
12
+ import "../dataset-DPPl-iLT.js";
13
+ import "../ops/cpu/rope.js";
14
+ import "../ops/webgl/rope.js";
15
+ import "../ops/grads/rope.js";
16
+ import "../ops/cpu/appendCache.js";
17
+ import "../ops/webgl/appendCache.js";
18
+ import "../ops/cpu/fusedSoftmax.js";
19
+ import "../ops/webgl/fusedSoftmax.js";
20
+ import "../ops/grads/fusedSoftmax.js";
21
+ import "../ops/cpu/matMulGelu.js";
22
+ import "../ops/webgl/matMulGelu.js";
23
+ import "../ops/grads/matMulGelu.js";
24
+ import "../ops/cpu/normRMS.js";
25
+ import "../ops/webgl/normRMS.js";
26
+ import "../ops/grads/normRMS.js";
27
+ import "../jszip.min-CjP2V1VV.js";
28
+ import "../index-Dwqa6Zy2.js";
29
+ import "../Generator.js";
30
+ import "../ops/cpu/adamAdjust.js";
31
+ import "../ops/webgl/adamAdjust.js";
32
+ import "../ops/cpu/adamMoments.js";
33
+ import "../ops/webgl/adamMoments.js";
34
+ import "../papaparse.min-C8l2Kvo1.js";
35
+ import { estimateParameterCount as p } from "../utilities/parameters.js";
36
+ import "../ops/cpu/scatterSub.js";
37
+ import "../ops/webgl/scatterSub.js";
38
+ import "../ops/cpu/gatherSub.js";
39
+ import "../ops/webgl/gatherSub.js";
40
+ import "../ops/cpu/gelu.js";
41
+ import "../ops/webgl/gelu.js";
42
+ import "../gelu-BkcmEEyD.js";
43
+ import "../ops/webgl/log.js";
44
+ import "../checks/normRMS.js";
45
+ import "../checks/normRMSGrad.js";
46
+ import { createSoftmaxCrossEntropyWithGrad as m } from "../training/sparseCrossEntropy.js";
47
+ class x extends i {
48
+ trainingState = null;
49
+ getNumParams() {
50
+ return p(this.config);
51
+ }
52
+ validateInput(t) {
53
+ if (t.shape.length !== 2)
54
+ throw new Error(`Invalid input shape: expected [batch_size, sequence_length], got ${t.shape}`);
55
+ if (t.shape[1] > this.config.blockSize)
56
+ throw new Error(`Input sequence length ${t.shape[1]} isn't block size ${this.config.blockSize}`);
57
+ if (t.dtype !== "int32")
58
+ throw new Error(`Input tensor must be of type int32, got ${t.dtype}`);
59
+ }
60
+ calculateLoss(t, o) {
61
+ try {
62
+ return m()(t, o).mean();
63
+ } catch (r) {
64
+ throw console.error("Error computing loss:", r), new Error(`Loss computation failed: ${r}`);
65
+ }
66
+ }
67
+ }
68
+ export {
69
+ x as default
70
+ };
@@ -1,4 +1,4 @@
1
- import { u as z } from "./gpgpu_math-DGNLNL4I.js";
1
+ import { u as z } from "./gpgpu_math-D_ODOLix.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -1,5 +1,5 @@
1
- import { F as n, H as t, j as m, E as i } from "./index-BoWRt-10.js";
2
- import { z as c, c as f } from "./zeros--BdLQ3oG.js";
1
+ import { M as n, N as t, j as m, E as i } from "./index-DdmHGZjq.js";
2
+ import { z as c, c as f } from "./zeros-Dnwix0p4.js";
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { e as i } from "../index-BoWRt-10.js";
1
+ import { e as i } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/adamAdjust.js";
3
3
  import "./webgl/adamAdjust.js";
4
4
  function p(r, t, e, n, m, o) {
@@ -1,4 +1,4 @@
1
- import { e as o } from "../index-BoWRt-10.js";
1
+ import { e as o } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/adamMoments.js";
3
3
  import "./webgl/adamMoments.js";
4
4
  function p(e, n, r, m) {
@@ -1,8 +1,8 @@
1
- import { e as a } from "../index-BoWRt-10.js";
1
+ import { e as a } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/appendCache.js";
3
3
  import "./webgl/appendCache.js";
4
- import { c as s } from "../concat-CsxrgovM.js";
5
- import { z as c } from "../zeros--BdLQ3oG.js";
4
+ import { c as s } from "../concat-pHiVqR3L.js";
5
+ import { z as c } from "../zeros-Dnwix0p4.js";
6
6
  function i(r, p, n, o) {
7
7
  if (!o) {
8
8
  const e = r.shape[2];
@@ -1,4 +1,4 @@
1
- import { e as o } from "../index-BoWRt-10.js";
1
+ import { e as o } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/attentionMask.js";
3
3
  import "./webgl/attentionMask.js";
4
4
  import "./grads/attentionMask.js";
@@ -1,18 +1,18 @@
1
- import { f as k, n as t, o as i, a as q, q as z } from "../../index-BoWRt-10.js";
2
- function A(a) {
3
- const { moments: n, value: r } = a.inputs, { beta1: l, beta2: u, epsilon: m, learningRate: d } = a.attrs, e = n.shape.length, c = new Array(e).fill(0), s = n.shape.slice();
4
- s[e - 1] = 1;
1
+ import { f as k, o as t, q as i, a as q, w } from "../../index-DdmHGZjq.js";
2
+ function z(a) {
3
+ const { moments: s, value: r } = a.inputs, { beta1: l, beta2: u, epsilon: m, learningRate: d } = a.attrs, e = s.shape.length, c = new Array(e).fill(0), n = s.shape.slice();
4
+ n[e - 1] = 1;
5
5
  const o = c.slice();
6
6
  o[e - 1] = 1;
7
- const b = s.slice(), p = n.slice(c, s).squeeze([e - 1]), M = n.slice(o, b).squeeze([e - 1]), f = t(p, l), g = t(M, u);
7
+ const b = n.slice(), p = s.slice(c, n).squeeze([e - 1]), M = s.slice(o, b).squeeze([e - 1]), f = t(p, l), g = t(M, u);
8
8
  return i(
9
- q(t(f, i(z(g), m ?? 1e-8)), -d),
9
+ q(t(f, i(w(g), m ?? 1e-8)), -d),
10
10
  r
11
11
  );
12
12
  }
13
- const C = {
13
+ const A = {
14
14
  kernelName: "AdamAdjust",
15
15
  backendName: "cpu",
16
- kernelFunc: A
16
+ kernelFunc: z
17
17
  };
18
- k(C);
18
+ k(A);
@@ -1,5 +1,5 @@
1
- import { f as p } from "../../index-BoWRt-10.js";
2
- import { s as f } from "../../stack-B17UN2nn.js";
1
+ import { f as p } from "../../index-DdmHGZjq.js";
2
+ import { s as f } from "../../stack-BNwLzE43.js";
3
3
  function b(t) {
4
4
  const { moments: n, gradient: c } = t.inputs, { beta1: o, beta2: m } = t.attrs, e = n.shape.length, a = new Array(e).fill(0), s = n.shape.slice();
5
5
  s[e - 1] = 1;
@@ -1,5 +1,5 @@
1
- import { f as d } from "../../index-BoWRt-10.js";
2
- import { c as h } from "../../concat-CsxrgovM.js";
1
+ import { f as d } from "../../index-DdmHGZjq.js";
2
+ import { c as h } from "../../concat-pHiVqR3L.js";
3
3
  function u(p) {
4
4
  const { cache: n, item: s } = p.inputs, { maxSize: i, pastLen: c } = p.attrs, t = n.shape[0], o = n.shape[1], a = n.shape[3], e = s.shape[2];
5
5
  if (c + e <= i) {
@@ -1,8 +1,8 @@
1
- import { f as a, h as p, b as u } from "../../index-BoWRt-10.js";
2
- import { l as N, w as b } from "../../ops-BFGCx8Ri.js";
3
- import { o as A } from "../../ones-Dj0SDhHf.js";
4
- import { z as I } from "../../zeros--BdLQ3oG.js";
5
- import { m as g } from "../../mat_mul-8m8pfdcx.js";
1
+ import { f as a, h as p, b as u } from "../../index-DdmHGZjq.js";
2
+ import { l as N, w as b } from "../../ops-542ai2vG.js";
3
+ import { o as A } from "../../ones-BAqVh-eA.js";
4
+ import { z as I } from "../../zeros-Dnwix0p4.js";
5
+ import { m as g } from "../../mat_mul-Dpy2mMRu.js";
6
6
  function o(n) {
7
7
  const { q: s, k: e } = n.inputs, { divisor: r } = n.attrs, c = s.shape[2], t = e.shape[2], m = N.bandPart(A([t, t]), -1, 0).cast("bool"), l = I([t, t]), i = p([t, t], Number.NEGATIVE_INFINITY), f = b(m, l, i), k = g(s, e, !1, !0).mul(u(r)), d = f.slice([0, 0], [c, t]).expandDims(0).expandDims(0);
8
8
  return k.add(d);
@@ -1,5 +1,5 @@
1
- import { f as e } from "../../index-BoWRt-10.js";
2
- import { s as f } from "../../softmax-Bv_6lyMX.js";
1
+ import { f as e } from "../../index-DdmHGZjq.js";
2
+ import { s as f } from "../../softmax-BfsyI4As.js";
3
3
  function n(t) {
4
4
  const { inputs: s, attrs: a } = t, { logits: o } = s, { dim: i, dropoutRate: r } = a;
5
5
  if (!o)
@@ -1,6 +1,6 @@
1
- import { B as u, C as c, E as g, a5 as h, f as m, c as p } from "../../index-BoWRt-10.js";
2
- import { r as f } from "../../range-CRuAh-gd.js";
3
- import { s as l } from "../../stack-B17UN2nn.js";
1
+ import { C as u, D as c, E as g, a8 as h, f as m, c as p } from "../../index-DdmHGZjq.js";
2
+ import { r as f } from "../../range-BcUvLuf5.js";
3
+ import { s as l } from "../../stack-BNwLzE43.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -26,9 +26,9 @@ function d(e) {
26
26
  const { values: t, labels: n, logits: r } = e.inputs, s = n.shape[0], a = f(0, s, 1, "int32"), i = l([a, n], 1), o = b(r, i);
27
27
  return p(t, o);
28
28
  }
29
- const k = {
29
+ const D = {
30
30
  kernelName: "EfficientGatherSub",
31
31
  backendName: "cpu",
32
32
  kernelFunc: d
33
33
  };
34
- m(k);
34
+ m(D);
@@ -1,4 +1,4 @@
1
- import { f as t, t as d } from "../../index-BoWRt-10.js";
1
+ import { f as t, t as d } from "../../index-DdmHGZjq.js";
2
2
  const o = 0.7978845608028654, c = 0.044715;
3
3
  function m(r) {
4
4
  const { inputs: u } = r, { x: n } = u, e = n;
@@ -1,5 +1,5 @@
1
- import { f as e, t as m } from "../../index-BoWRt-10.js";
2
- import { g as d, d as M } from "../../gelu-C-dPj6Ku.js";
1
+ import { f as e, t as m } from "../../index-DdmHGZjq.js";
2
+ import { g as d, d as M } from "../../gelu-BkcmEEyD.js";
3
3
  function c(t) {
4
4
  const { inputs: u } = t, { x: n, kernel: l } = u, a = n, r = l;
5
5
  return m(() => {
@@ -1,4 +1,4 @@
1
- import { f as e, t as i } from "../../index-BoWRt-10.js";
1
+ import { f as e, t as i } from "../../index-DdmHGZjq.js";
2
2
  function n(t) {
3
3
  const { inputs: r, attrs: l } = t, { transposeA: o, transposeB: s } = l, { x: u, kernel: a, y: c } = r, m = u, k = a, M = c;
4
4
  return i(() => m.matMul(k, o, s).mul(M));
@@ -1,4 +1,4 @@
1
- import { f as e, a as t } from "../../index-BoWRt-10.js";
1
+ import { f as e, a as t } from "../../index-DdmHGZjq.js";
2
2
  function n(o) {
3
3
  const { inputs: r } = o, { a: l, b: u } = r;
4
4
  return console.warn("Using fallback mulDrop implementation without dropout."), t(l, u);
@@ -1,4 +1,4 @@
1
- import { f as o, t as d } from "../../index-BoWRt-10.js";
1
+ import { f as o, t as d } from "../../index-DdmHGZjq.js";
2
2
  function i(t) {
3
3
  const { inputs: e } = t, { x: n, gamma: s } = e, r = n, a = s;
4
4
  return d(() => {
@@ -1,6 +1,6 @@
1
- import { f as q } from "../../index-BoWRt-10.js";
2
- import { r as o } from "../../reshape-CdBq1WJ6.js";
3
- import { s as x } from "../../split-B-dikLRw.js";
1
+ import { f as q } from "../../index-DdmHGZjq.js";
2
+ import { r as o } from "../../reshape-WeJkT3ja.js";
3
+ import { s as x } from "../../split-BPxr8_8m.js";
4
4
  function v(p) {
5
5
  const { x: c, kernel: K } = p.inputs, { heads: n } = p.attrs, [s, e, t] = c.shape, a = o(c, [s * e, t]), i = a.dot(K);
6
6
  a.dispose();
@@ -1,8 +1,8 @@
1
- import { f as S } from "../../index-BoWRt-10.js";
2
- import { r as F } from "../../range-CRuAh-gd.js";
3
- import { g as I } from "../../gather-CMMy2KEG.js";
4
- import { s as E } from "../../stack-B17UN2nn.js";
5
- import { c as T } from "../../concat-CsxrgovM.js";
1
+ import { f as S } from "../../index-DdmHGZjq.js";
2
+ import { r as F } from "../../range-BcUvLuf5.js";
3
+ import { g as I } from "../../gather-CPg6ZlQA.js";
4
+ import { s as E } from "../../stack-BNwLzE43.js";
5
+ import { c as T } from "../../concat-pHiVqR3L.js";
6
6
  function U(t, c, p, o, r) {
7
7
  const n = o.shape[3], s = p;
8
8
  if (s > n) return o;
@@ -1,8 +1,8 @@
1
- import { B as f, F as g, C as r, E as l, a4 as N, f as b, c as S, a as h } from "../../index-BoWRt-10.js";
2
- import { v as D } from "../../scatter_nd_util-DUstGbU1.js";
3
- import { r as k } from "../../range-CRuAh-gd.js";
4
- import { s as v } from "../../stack-B17UN2nn.js";
5
- import { o as E } from "../../ones-Dj0SDhHf.js";
1
+ import { C as f, M as g, D as r, E as l, a7 as N, f as b, c as S, a as D } from "../../index-DdmHGZjq.js";
2
+ import { v as h } from "../../scatter_nd_util-B7yDhiQr.js";
3
+ import { r as k } from "../../range-BcUvLuf5.js";
4
+ import { s as v } from "../../stack-BNwLzE43.js";
5
+ import { o as E } from "../../ones-BAqVh-eA.js";
6
6
  /**
7
7
  * @license
8
8
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -22,14 +22,14 @@ import { o as E } from "../../ones-Dj0SDhHf.js";
22
22
  function I(a, e, s) {
23
23
  g(s);
24
24
  const n = r(a, "indices", "scatterND", "int32"), t = r(e, "updates", "scatterND");
25
- D(t, n, s);
25
+ h(t, n, s);
26
26
  const c = { indices: n, updates: t }, o = { shape: s };
27
27
  return l.runKernel(N, c, o);
28
28
  }
29
29
  const C = /* @__PURE__ */ f({ scatterND_: I });
30
30
  function K(a) {
31
31
  const { logits: e, labels: s, dy: n } = a.inputs, t = s.shape[0], c = e.shape[1], o = k(0, t, 1, "int32"), i = v([o, s], 1), d = E([t]), u = C(i, d, [t, c]), p = S(e, u), m = n.reshape([t, 1]);
32
- return h(p, m);
32
+ return D(p, m);
33
33
  }
34
34
  const L = {
35
35
  kernelName: "EfficientScatterSub",
@@ -1,4 +1,4 @@
1
- import { e as t } from "../index-BoWRt-10.js";
1
+ import { e as t } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/fusedSoftmax.js";
3
3
  import "./webgl/fusedSoftmax.js";
4
4
  import "./grads/fusedSoftmax.js";
@@ -1,4 +1,4 @@
1
- import { e as n } from "../index-BoWRt-10.js";
1
+ import { e as n } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/gatherSub.js";
3
3
  import "./webgl/gatherSub.js";
4
4
  function f(r, e, t) {
package/dist/ops/gelu.js CHANGED
@@ -1,7 +1,7 @@
1
- import "../index-BoWRt-10.js";
1
+ import "../index-DdmHGZjq.js";
2
2
  import "./cpu/gelu.js";
3
3
  import "./webgl/gelu.js";
4
- import { d as e, g as i } from "../gelu-C-dPj6Ku.js";
4
+ import { d as e, g as i } from "../gelu-BkcmEEyD.js";
5
5
  export {
6
6
  e as dGelu,
7
7
  i as gelu
@@ -1,4 +1,4 @@
1
- import { i as m, b as i } from "../../index-BoWRt-10.js";
1
+ import { i as m, b as i } from "../../index-DdmHGZjq.js";
2
2
  import { matMulMul as u } from "../matMulMul.js";
3
3
  const p = {
4
4
  kernelName: "AttentionMask",
@@ -1,6 +1,6 @@
1
- import { i as f, a as i, c as l } from "../../index-BoWRt-10.js";
1
+ import { i as f, a as i, c as l } from "../../index-DdmHGZjq.js";
2
2
  import { mulDrop as g } from "../mulDrop.js";
3
- import { s as T } from "../../sum-66ew2byf.js";
3
+ import { s as T } from "../../sum-ByFINZgi.js";
4
4
  const Y = {
5
5
  kernelName: "FusedSoftmax",
6
6
  outputsToSave: [!0],
@@ -1,5 +1,5 @@
1
- import "../../index-BoWRt-10.js";
2
- import { a as e } from "../../gelu-C-dPj6Ku.js";
1
+ import "../../index-DdmHGZjq.js";
2
+ import { a as e } from "../../gelu-BkcmEEyD.js";
3
3
  export {
4
4
  e as geluGradConfig
5
5
  };
@@ -1,4 +1,4 @@
1
- import { i as a, e as o } from "../../index-BoWRt-10.js";
1
+ import { i as a, e as o } from "../../index-DdmHGZjq.js";
2
2
  function i(e, n, r) {
3
3
  return o().runKernel("MatMulGeluGrad", { dy: e, x: n, kernel: r });
4
4
  }
@@ -1,4 +1,4 @@
1
- import { i as t, e as g } from "../../index-BoWRt-10.js";
1
+ import { i as t, e as g } from "../../index-DdmHGZjq.js";
2
2
  function i(r, a, n) {
3
3
  return g().runKernel("RMSNormGrad", { dy: r, x: a, gamma: n });
4
4
  }
@@ -1,4 +1,4 @@
1
- import { i as Q } from "../../index-BoWRt-10.js";
1
+ import { i as Q } from "../../index-DdmHGZjq.js";
2
2
  const V = {
3
3
  kernelName: "QKV",
4
4
  inputsToSave: ["x", "kernel"],
@@ -1,4 +1,4 @@
1
- import { i, e as a } from "../../index-BoWRt-10.js";
1
+ import { i, e as a } from "../../index-DdmHGZjq.js";
2
2
  function p(n, e, s, o) {
3
3
  return a().runKernel("Rope", { x: n, sin: e, cos: s }, { pastLen: o });
4
4
  }
@@ -1,4 +1,4 @@
1
- import { e as u } from "../index-BoWRt-10.js";
1
+ import { e as u } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/matMulGelu.js";
3
3
  import "./webgl/matMulGelu.js";
4
4
  import "./grads/matMulGelu.js";
@@ -1,4 +1,4 @@
1
- import { e as u } from "../index-BoWRt-10.js";
1
+ import { e as u } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/matMulMul.js";
3
3
  import "./webgl/matMulMul.js";
4
4
  function m(e, r, t, l = !1, n = !1) {
@@ -1,4 +1,4 @@
1
- import { e as t } from "../index-BoWRt-10.js";
1
+ import { e as t } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/mulDropout.js";
3
3
  import "./webgl/mulDropout.js";
4
4
  function m(r, o, e, n) {
@@ -1,4 +1,4 @@
1
- import { e as n } from "../index-BoWRt-10.js";
1
+ import { e as n } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/normRMS.js";
3
3
  import "./webgl/normRMS.js";
4
4
  import "./grads/normRMS.js";
package/dist/ops/qkv.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as o } from "../index-BoWRt-10.js";
1
+ import { e as o } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/qkv.js";
3
3
  import "./webgl/qkv.js";
4
4
  import "./grads/qkv.js";
package/dist/ops/rope.js CHANGED
@@ -1,8 +1,8 @@
1
- import { e as p } from "../index-BoWRt-10.js";
2
- import "../random_width-sZORGo5k.js";
3
- import "../register_all_kernels-BwDSRN-f.js";
1
+ import { e as p } from "../index-DdmHGZjq.js";
2
+ import "../random_width-DKGeiFuR.js";
3
+ import "../register_all_kernels-Do9VvZmo.js";
4
4
  import "../index-Tf7vU29b.js";
5
- import "../dataset-CtdBYwjo.js";
5
+ import "../dataset-DPPl-iLT.js";
6
6
  import "./cpu/rope.js";
7
7
  import "./webgl/rope.js";
8
8
  import "./grads/rope.js";
@@ -1,4 +1,4 @@
1
- import { e as i } from "../index-BoWRt-10.js";
1
+ import { e as i } from "../index-DdmHGZjq.js";
2
2
  import "./cpu/scatterSub.js";
3
3
  import "./webgl/scatterSub.js";
4
4
  function c(t, r, e) {
@@ -1,5 +1,5 @@
1
- import { r as n } from "../../Reshape-DH5srBP0.js";
2
- import { f } from "../../index-BoWRt-10.js";
1
+ import { r as n } from "../../Reshape-Bh_jzKzV.js";
2
+ import { f } from "../../index-DdmHGZjq.js";
3
3
  class v {
4
4
  variableNames = ["moments", "value"];
5
5
  outputShape;
@@ -1,4 +1,4 @@
1
- import { f as m } from "../../index-BoWRt-10.js";
1
+ import { f as m } from "../../index-DdmHGZjq.js";
2
2
  class i {
3
3
  variableNames = ["moments", "gradient"];
4
4
  outputShape;
@@ -1,4 +1,4 @@
1
- import { f as p } from "../../index-BoWRt-10.js";
1
+ import { f as p } from "../../index-DdmHGZjq.js";
2
2
  class m {
3
3
  variableNames = ["cache", "item"];
4
4
  outputShape;
@@ -1,4 +1,4 @@
1
- import { f as m } from "../../index-BoWRt-10.js";
1
+ import { f as m } from "../../index-DdmHGZjq.js";
2
2
  class h {
3
3
  variableNames = ["q", "k"];
4
4
  outputShape;
@@ -1,7 +1,7 @@
1
- import { m as b, s as I, r as k } from "../../RealDiv-Dy0p8Bvo.js";
2
- import { r as v } from "../../Reshape-DH5srBP0.js";
3
- import { f as w, p as P } from "../../index-BoWRt-10.js";
4
- import { e as S } from "../../axis_util-BzbKo31C.js";
1
+ import { m as b, s as I, r as k } from "../../RealDiv-D_q39E3A.js";
2
+ import { r as v } from "../../Reshape-Bh_jzKzV.js";
3
+ import { f as w, p as P } from "../../index-DdmHGZjq.js";
4
+ import { e as S } from "../../axis_util-Did9235A.js";
5
5
  class T {
6
6
  variableNames = ["logits", "maxLogits"];
7
7
  outputShape;