@genai-fi/nanogpt 0.20.7 → 0.21.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 (206) hide show
  1. package/dist/{BaseTokeniser-DSg9zcYq.js → BaseTokeniser-C9TSv4th.js} +1 -1
  2. package/dist/{DatasetBuilder-DgURD85T.js → DatasetBuilder-B9UGNQT5.js} +82 -88
  3. package/dist/Generator.js +1 -1
  4. package/dist/{RealDiv-DBu0FQqT.js → RealDiv-CNsvC4AU.js} +6 -6
  5. package/dist/{Reshape-DqO3r8BC.js → Reshape-CwxdaU8n.js} +1 -1
  6. package/dist/{Reshape-CABOPB9d.js → Reshape-dnm9bO3B.js} +2 -2
  7. package/dist/TeachableLLM.js +1 -1
  8. package/dist/Trainer.js +1 -1
  9. package/dist/backend.js +2 -2
  10. package/dist/{backend_util-Cg-roD1p.js → backend_util-DAV0I34P.js} +5 -5
  11. package/dist/checks/appendCache.js +1 -1
  12. package/dist/checks/attentionMask.js +1 -1
  13. package/dist/checks/gelu.js +1 -1
  14. package/dist/checks/matMulGelu.js +1 -1
  15. package/dist/checks/normRMS.js +1 -1
  16. package/dist/checks/normRMSGrad.js +1 -1
  17. package/dist/checks/packUnpack.js +1 -1
  18. package/dist/checks/qkv.js +1 -1
  19. package/dist/checks/rope.js +1 -1
  20. package/dist/{chunk-BPntVaq0.js → chunk-CWhphoD1.js} +5 -5
  21. package/dist/{concat_util-CWDZCBlA.js → concat_util-CWzvQQlK.js} +1 -1
  22. package/dist/data/docx.js +58 -59
  23. package/dist/data/pdf.js +1 -1
  24. package/dist/data/textLoader.js +1 -1
  25. package/dist/{dist-DVmq73nz.js → dist-9wGF4ci9.js} +10 -10
  26. package/dist/{dist-VEU5mfO0.js → dist-BqAU9-yi.js} +4 -4
  27. package/dist/{dist-BewPQWjc.js → dist-Da20xy8E.js} +1874 -3071
  28. package/dist/{gelu-Bf1HW1RY.js → gelu-B6637MKa.js} +1 -1
  29. package/dist/{gpgpu_math-DvLcCH6u.js → gpgpu_math-DBYEAAdI.js} +2 -2
  30. package/dist/{kernel_funcs_utils-HiXOOx3f.js → kernel_funcs_utils-D-mATnGR.js} +3 -3
  31. package/dist/layers/BaseLayer.js +1 -1
  32. package/dist/layers/CausalSelfAttention.js +4 -4
  33. package/dist/layers/LoRA.js +3 -3
  34. package/dist/layers/MLP.js +2 -2
  35. package/dist/layers/PositionEmbedding.js +2 -2
  36. package/dist/layers/RMSNorm.js +1 -1
  37. package/dist/layers/RoPECache.js +1 -1
  38. package/dist/layers/TiedEmbedding.js +3 -3
  39. package/dist/layers/TransformerBlock.js +1 -1
  40. package/dist/layers/WeightStore.js +3 -3
  41. package/dist/loader/load.js +1 -1
  42. package/dist/loader/loadHF.js +1 -1
  43. package/dist/loader/loadTransformers.js +1 -1
  44. package/dist/loader/loadZipMeta.js +1 -1
  45. package/dist/loader/newZipLoad.js +1 -1
  46. package/dist/loader/oldZipLoad.js +1 -1
  47. package/dist/loader/save.d.ts +1 -0
  48. package/dist/loader/save.js +1 -1
  49. package/dist/{main-BTmbwF1h.js → main-DdsoTJAW.js} +2009 -2014
  50. package/dist/main.js +1 -1
  51. package/dist/{matMul16-BNfZSnNM.js → matMul16-DGtlziMn.js} +3 -3
  52. package/dist/{matMulGelu-CPTntosE.js → matMulGelu-BAIgQaRx.js} +3 -3
  53. package/dist/models/NanoGPTV1.js +1 -1
  54. package/dist/models/NanoGPTV2.js +1 -1
  55. package/dist/models/factory.js +1 -1
  56. package/dist/models/model.js +1 -1
  57. package/dist/ops/adamAdjust.js +1 -1
  58. package/dist/ops/adamMoments.js +1 -1
  59. package/dist/ops/add16.js +1 -1
  60. package/dist/ops/appendCache.js +1 -1
  61. package/dist/ops/attentionMask.js +1 -1
  62. package/dist/ops/concat16.js +1 -1
  63. package/dist/ops/cpu/adamAdjust.js +1 -1
  64. package/dist/ops/cpu/adamMoments.js +1 -1
  65. package/dist/ops/cpu/appendCache.js +1 -1
  66. package/dist/ops/cpu/attentionMask.js +1 -1
  67. package/dist/ops/cpu/fusedSoftmax.js +1 -1
  68. package/dist/ops/cpu/gatherSub.js +1 -1
  69. package/dist/ops/cpu/gelu.js +1 -1
  70. package/dist/ops/cpu/matMul16.js +1 -1
  71. package/dist/ops/cpu/matMulGelu.js +2 -2
  72. package/dist/ops/cpu/matMulMul.js +1 -1
  73. package/dist/ops/cpu/mulDropout.js +1 -1
  74. package/dist/ops/cpu/normRMS.js +1 -1
  75. package/dist/ops/cpu/qkv.js +1 -1
  76. package/dist/ops/cpu/rope.js +1 -1
  77. package/dist/ops/cpu/scatterSub.js +1 -1
  78. package/dist/ops/dot16.js +2 -2
  79. package/dist/ops/dropout.js +1 -1
  80. package/dist/ops/dropout16.js +1 -1
  81. package/dist/ops/gatherSub.js +1 -1
  82. package/dist/ops/gelu.js +1 -1
  83. package/dist/ops/globalNorm.js +1 -1
  84. package/dist/ops/grads/add16.js +1 -1
  85. package/dist/ops/grads/attentionMask.js +2 -2
  86. package/dist/ops/grads/gelu.js +1 -1
  87. package/dist/ops/grads/matMul16.js +1 -1
  88. package/dist/ops/grads/matMulGelu.js +1 -1
  89. package/dist/ops/grads/normRMS.js +1 -1
  90. package/dist/ops/grads/pack16.js +1 -1
  91. package/dist/ops/grads/qkv.js +2 -2
  92. package/dist/ops/grads/rope.js +1 -1
  93. package/dist/ops/grads/softmax16.js +1 -1
  94. package/dist/ops/grads/unpack16.js +1 -1
  95. package/dist/ops/matMul16.js +1 -1
  96. package/dist/ops/matMulGelu.js +2 -2
  97. package/dist/ops/matMulMul.js +1 -1
  98. package/dist/ops/mul16.js +1 -1
  99. package/dist/ops/mulDrop.js +1 -1
  100. package/dist/ops/normRMS.js +1 -1
  101. package/dist/ops/pack16.js +1 -1
  102. package/dist/ops/qkv.js +1 -1
  103. package/dist/ops/reshape16.js +1 -1
  104. package/dist/ops/rope.js +1 -1
  105. package/dist/ops/scatterSub.js +1 -1
  106. package/dist/ops/slice16.js +1 -1
  107. package/dist/ops/softmax16.js +1 -1
  108. package/dist/ops/sub16.js +1 -1
  109. package/dist/ops/sum16.js +1 -1
  110. package/dist/ops/transpose16.js +1 -1
  111. package/dist/ops/unpack16.js +1 -1
  112. package/dist/ops/webgl/adamAdjust.js +2 -2
  113. package/dist/ops/webgl/adamMoments.js +1 -1
  114. package/dist/ops/webgl/appendCache.js +1 -1
  115. package/dist/ops/webgl/attentionMask.js +1 -1
  116. package/dist/ops/webgl/dropout16.js +1 -1
  117. package/dist/ops/webgl/fusedSoftmax.js +3 -3
  118. package/dist/ops/webgl/gatherSub.js +1 -1
  119. package/dist/ops/webgl/gelu.js +2 -2
  120. package/dist/ops/webgl/log.js +3 -3
  121. package/dist/ops/webgl/matMul16.js +1 -1
  122. package/dist/ops/webgl/matMulGelu.js +1 -1
  123. package/dist/ops/webgl/matMulMul.js +2 -2
  124. package/dist/ops/webgl/mulDropout.js +1 -1
  125. package/dist/ops/webgl/normRMS.js +1 -1
  126. package/dist/ops/webgl/qkv.js +1 -1
  127. package/dist/ops/webgl/rope.js +1 -1
  128. package/dist/ops/webgl/scatterSub.js +1 -1
  129. package/dist/ops/webgpu/adamAdjust.js +3 -3
  130. package/dist/ops/webgpu/adamMoments.js +3 -3
  131. package/dist/ops/webgpu/add16.js +1 -1
  132. package/dist/ops/webgpu/appendCache.js +3 -3
  133. package/dist/ops/webgpu/attentionMask.js +2 -2
  134. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  135. package/dist/ops/webgpu/clipScale.js +1 -1
  136. package/dist/ops/webgpu/concat16.js +5 -5
  137. package/dist/ops/webgpu/dropout16.js +3 -3
  138. package/dist/ops/webgpu/gatherSub.js +3 -3
  139. package/dist/ops/webgpu/gelu.js +3 -3
  140. package/dist/ops/webgpu/matMul16.js +1 -1
  141. package/dist/ops/webgpu/matMul16_program.js +7 -7
  142. package/dist/ops/webgpu/mul16.js +1 -1
  143. package/dist/ops/webgpu/norm2.js +1 -1
  144. package/dist/ops/webgpu/normRMS.js +2 -2
  145. package/dist/ops/webgpu/normRMSGrad.js +4 -4
  146. package/dist/ops/webgpu/pack16.js +1 -1
  147. package/dist/ops/webgpu/pack16_program.js +2 -2
  148. package/dist/ops/webgpu/qkv.js +2 -2
  149. package/dist/ops/webgpu/rope.js +3 -3
  150. package/dist/ops/webgpu/scatterSub.js +3 -3
  151. package/dist/ops/webgpu/slice16.js +4 -4
  152. package/dist/ops/webgpu/softmax16.js +1 -1
  153. package/dist/ops/webgpu/softmax16_program.js +2 -2
  154. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  155. package/dist/ops/webgpu/softmax16grad.js +1 -1
  156. package/dist/ops/webgpu/sub16.js +1 -1
  157. package/dist/ops/webgpu/sum16.js +15 -15
  158. package/dist/ops/webgpu/transpose16.js +1 -1
  159. package/dist/ops/webgpu/transpose16_program.js +2 -2
  160. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  161. package/dist/ops/webgpu/unpack16.js +3 -3
  162. package/dist/ops/webgpu/utils/binary_op.js +3 -3
  163. package/dist/ops/webgpu/utils/reductions.js +3 -3
  164. package/dist/{pack16-Ck-spx_F.js → pack16-BhuXNUS7.js} +1 -1
  165. package/dist/patches/webgpu_backend.js +3 -3
  166. package/dist/patches/webgpu_base.js +1 -1
  167. package/dist/patches/webgpu_program.js +4 -4
  168. package/dist/{pdf-UoDqCYzz.js → pdf-CdmW8ikl.js} +1159 -1160
  169. package/dist/{picomatch-3tUnMMbd.js → picomatch-BO4HbNfo.js} +125 -127
  170. package/dist/{rope-CbeGlsV8.js → rope-C8EAiSGY.js} +1 -1
  171. package/dist/{selu_util-zkAx5doH.js → selu_util-B_AFEfoz.js} +1 -1
  172. package/dist/{shared-D1coEFea.js → shared-24EoeHJl.js} +4 -4
  173. package/dist/{shared-DOgWaqvL.js → shared-CfTzpULd.js} +1 -1
  174. package/dist/{slice_util-Dgb3ANWI.js → slice_util-Dve4TkDn.js} +2 -2
  175. package/dist/{tfjs_backend-BjuQ5FqB.js → tfjs_backend-CydPRQTc.js} +2 -2
  176. package/dist/tokeniser/BaseTokeniser.js +1 -1
  177. package/dist/tokeniser/CharTokeniser.js +1 -1
  178. package/dist/tokeniser/bpe.js +1 -1
  179. package/dist/training/AdamW.js +1 -1
  180. package/dist/training/BasicTrainer.js +1 -1
  181. package/dist/training/DatasetBuilder.d.ts +0 -1
  182. package/dist/training/DatasetBuilder.js +2 -2
  183. package/dist/training/Evaluator.js +1 -1
  184. package/dist/training/PreTrainer.js +1 -1
  185. package/dist/training/SFTTrainer.js +1 -1
  186. package/dist/training/loss.js +2 -2
  187. package/dist/training/orthoGrad.js +1 -1
  188. package/dist/training/sparseCrossEntropy.js +1 -1
  189. package/dist/training/tasks/ConversationTask.js +1 -1
  190. package/dist/training/validation.js +1 -1
  191. package/dist/utilities/dummy.js +1 -1
  192. package/dist/utilities/float16.d.ts +3 -0
  193. package/dist/utilities/float16.js +46 -0
  194. package/dist/utilities/multinomialCPU.js +1 -1
  195. package/dist/utilities/packed.js +1 -1
  196. package/dist/utilities/performance.js +1 -1
  197. package/dist/utilities/profile.js +1 -1
  198. package/dist/utilities/safetensors.d.ts +3 -1
  199. package/dist/utilities/safetensors.js +46 -36
  200. package/dist/utilities/sentences.js +1 -1
  201. package/dist/utilities/weights.js +1 -1
  202. package/dist/{webgpu-Dt7BMzWz.js → webgpu-B19Tw8Nd.js} +3 -3
  203. package/dist/{webgpu_program-WOyIVMlZ.js → webgpu_program-B0PokuRJ.js} +1 -1
  204. package/dist/{webgpu_util-B_F3SShA.js → webgpu_util-DfODg6XI.js} +1 -1
  205. package/package.json +5 -5
  206. package/dist/dist-DXwIvKxl.js +0 -896
@@ -1,4 +1,4 @@
1
- import { a as e, t } from "./chunk-BPntVaq0.js";
1
+ import { i as e, t } from "./chunk-CWhphoD1.js";
2
2
  var n = (/* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
3
3
  var n = Object.prototype.hasOwnProperty, r = "~";
4
4
  function i() {}
@@ -1,8 +1,7 @@
1
- import { a as e } from "./chunk-BPntVaq0.js";
2
- import { Mi as t, Ms as n, Ps as r, V as i, Zr as a, bi as o, di as s, fi as c, ji as l, mt as ee, ni as u, wi as d, yi as f } from "./dist-BewPQWjc.js";
3
- import { n as p } from "./dist-DXwIvKxl.js";
1
+ import { i as e } from "./chunk-CWhphoD1.js";
2
+ import { Mi as t, Ms as n, Ps as r, V as i, Zr as a, bi as o, di as s, fi as c, ji as l, mt as u, ni as d, wi as f, yi as p } from "./dist-Da20xy8E.js";
4
3
  //#region node_modules/@tensorflow/tfjs-data/dist/util/deep_map.js
5
- var m = /* @__PURE__ */ e(ee());
4
+ var m = /* @__PURE__ */ e(u());
6
5
  function h(e, t) {
7
6
  return g(e, t);
8
7
  }
@@ -56,10 +55,10 @@ function b(e) {
56
55
  let { StringDecoder: n } = a();
57
56
  t = e instanceof n;
58
57
  }
59
- return e != null && !ArrayBuffer.isView(e) && (Array.isArray(e) || typeof e == "object" && !(e instanceof d) && !(e instanceof Promise) && !t);
58
+ return e != null && !ArrayBuffer.isView(e) && (Array.isArray(e) || typeof e == "object" && !(e instanceof f) && !(e instanceof Promise) && !t);
60
59
  }
61
60
  function x(e) {
62
- return e == null || S(e) || Array.isArray(e) || typeof e == "object" && e instanceof d || l(e);
61
+ return e == null || S(e) || Array.isArray(e) || typeof e == "object" && e instanceof f || l(e);
63
62
  }
64
63
  function S(e) {
65
64
  return e === null || typeof e != "object" && typeof e != "function";
@@ -70,7 +69,7 @@ function C(e) {
70
69
  return h(e, w);
71
70
  }
72
71
  function w(e) {
73
- return e instanceof d ? {
72
+ return e instanceof f ? {
74
73
  value: e.clone(),
75
74
  recurse: !1
76
75
  } : b(e) ? {
@@ -160,16 +159,16 @@ var T = class {
160
159
  E.INITIAL_CAPACITY = 32;
161
160
  //#endregion
162
161
  //#region node_modules/@tensorflow/tfjs-data/dist/iterators/lazy_iterator.js
162
+ function ee(e) {
163
+ return new A(e);
164
+ }
163
165
  function D(e) {
164
166
  return new j(e);
165
167
  }
166
- function O(e) {
167
- return new M(e);
168
- }
169
- function k(e, t) {
170
- return new U(e, t);
168
+ function O(e, t) {
169
+ return new H(e, t);
171
170
  }
172
- var A = class {
171
+ var k = class {
173
172
  async toArray() {
174
173
  let e = [], t = await this.next();
175
174
  for (; !t.done;) e.push(t.value), t = await this.next();
@@ -189,22 +188,22 @@ var A = class {
189
188
  for (; !t.done && n;) t = await this.next(), n = e(t.value);
190
189
  }
191
190
  handleErrors(e) {
192
- return new z(this, e);
191
+ return new R(this, e);
193
192
  }
194
193
  filter(e) {
195
- return new L(this, e);
194
+ return new I(this, e);
196
195
  }
197
196
  map(e) {
198
- return new R(this, e);
197
+ return new L(this, e);
199
198
  }
200
199
  mapAsync(e) {
201
- return new B(this, e);
200
+ return new z(this, e);
202
201
  }
203
202
  serialMapAsync(e) {
204
- return new B(this, e).serial();
203
+ return new z(this, e).serial();
205
204
  }
206
205
  flatmap(e) {
207
- return new H(this, e);
206
+ return new V(this, e);
208
207
  }
209
208
  async forEachAsync(e) {
210
209
  return this.map(e).resolveFully();
@@ -213,30 +212,30 @@ var A = class {
213
212
  return this.serialMapAsync(e).resolveWhile((e) => e === !0);
214
213
  }
215
214
  rowMajorBatch(e, t = !0) {
216
- return new I(this, e, t);
215
+ return new F(this, e, t);
217
216
  }
218
217
  columnMajorBatch(e, t = !0, n = y) {
219
218
  return this.rowMajorBatch(e, t).map((e) => _(e, n));
220
219
  }
221
220
  concatenate(e, t) {
222
- return new U(D([this, e]), t);
221
+ return new H(ee([this, e]), t);
223
222
  }
224
223
  take(e) {
225
- return e < 0 || e == null ? this : new F(this, e);
224
+ return e < 0 || e == null ? this : new P(this, e);
226
225
  }
227
226
  skip(e) {
228
- return e < 0 || e == null ? this : new P(this, e);
227
+ return e < 0 || e == null ? this : new N(this, e);
229
228
  }
230
229
  prefetch(e) {
231
- return new G(this, e);
230
+ return new W(this, e);
232
231
  }
233
232
  shuffle(e, t) {
234
- return new K(this, e, t);
233
+ return new G(this, e, t);
235
234
  }
236
235
  serial() {
237
- return new N(this);
236
+ return new M(this);
238
237
  }
239
- }, j = class extends A {
238
+ }, A = class extends k {
240
239
  constructor(e) {
241
240
  super(), this.items = e, this.trav = 0;
242
241
  }
@@ -254,7 +253,7 @@ var A = class {
254
253
  done: !1
255
254
  };
256
255
  }
257
- }, M = class extends A {
256
+ }, j = class extends k {
258
257
  constructor(e) {
259
258
  super(), this.nextFn = e;
260
259
  }
@@ -268,7 +267,7 @@ var A = class {
268
267
  throw e.message = `Error thrown while iterating through a dataset: ${e.message}`, e;
269
268
  }
270
269
  }
271
- }, N = class extends A {
270
+ }, M = class extends k {
272
271
  constructor(e) {
273
272
  super(), this.upstream = e, this.lastRead = Promise.resolve({
274
273
  value: null,
@@ -284,7 +283,7 @@ var A = class {
284
283
  async serialNext() {
285
284
  return this.upstream.next();
286
285
  }
287
- }, P = class extends A {
286
+ }, N = class extends k {
288
287
  constructor(e, t) {
289
288
  super(), this.upstream = e, this.maxCount = t, this.count = 0, this.lastRead = Promise.resolve({
290
289
  value: null,
@@ -301,11 +300,11 @@ var A = class {
301
300
  for (; this.count++ < this.maxCount;) {
302
301
  let e = await this.upstream.next();
303
302
  if (e.done) return e;
304
- u(e.value);
303
+ d(e.value);
305
304
  }
306
305
  return this.upstream.next();
307
306
  }
308
- }, F = class extends A {
307
+ }, P = class extends k {
309
308
  constructor(e, t) {
310
309
  super(), this.upstream = e, this.maxCount = t, this.count = 0;
311
310
  }
@@ -318,7 +317,7 @@ var A = class {
318
317
  done: !0
319
318
  } : this.upstream.next();
320
319
  }
321
- }, I = class extends A {
320
+ }, F = class extends k {
322
321
  constructor(e, t, n = !0) {
323
322
  super(), this.upstream = e, this.batchSize = t, this.enableSmallLastBatch = n, this.lastRead = Promise.resolve({
324
323
  value: null,
@@ -349,7 +348,7 @@ var A = class {
349
348
  done: !1
350
349
  };
351
350
  }
352
- }, L = class extends A {
351
+ }, I = class extends k {
353
352
  constructor(e, t) {
354
353
  super(), this.upstream = e, this.predicate = t, this.lastRead = Promise.resolve({
355
354
  value: null,
@@ -366,10 +365,10 @@ var A = class {
366
365
  for (;;) {
367
366
  let e = await this.upstream.next();
368
367
  if (e.done || this.predicate(e.value)) return e;
369
- u(e.value);
368
+ d(e.value);
370
369
  }
371
370
  }
372
- }, R = class extends A {
371
+ }, L = class extends k {
373
372
  constructor(e, t) {
374
373
  super(), this.upstream = e, this.transform = t;
375
374
  }
@@ -382,14 +381,14 @@ var A = class {
382
381
  value: null,
383
382
  done: !0
384
383
  };
385
- let t = f(e.value), n = this.transform(e.value), r = f(n);
384
+ let t = p(e.value), n = this.transform(e.value), r = p(n);
386
385
  for (let e of t) o(e, r) || e.dispose();
387
386
  return {
388
387
  value: n,
389
388
  done: !1
390
389
  };
391
390
  }
392
- }, z = class extends A {
391
+ }, R = class extends k {
393
392
  constructor(e, t) {
394
393
  super(), this.upstream = e, this.handler = t, this.count = 0, this.lastRead = Promise.resolve({
395
394
  value: null,
@@ -412,7 +411,7 @@ var A = class {
412
411
  };
413
412
  }
414
413
  }
415
- }, B = class extends A {
414
+ }, z = class extends k {
416
415
  constructor(e, t) {
417
416
  super(), this.upstream = e, this.transform = t;
418
417
  }
@@ -425,14 +424,14 @@ var A = class {
425
424
  value: null,
426
425
  done: !0
427
426
  };
428
- let t = f(e.value), n = await this.transform(e.value), r = f(n);
427
+ let t = p(e.value), n = await this.transform(e.value), r = p(n);
429
428
  for (let e of t) o(e, r) || e.dispose();
430
429
  return {
431
430
  value: n,
432
431
  done: !1
433
432
  };
434
433
  }
435
- }, V = class extends A {
434
+ }, B = class extends k {
436
435
  constructor() {
437
436
  super(), this.outputQueue = new E(), this.lastRead = Promise.resolve({
438
437
  value: null,
@@ -452,7 +451,7 @@ var A = class {
452
451
  done: !1
453
452
  };
454
453
  }
455
- }, H = class extends V {
454
+ }, V = class extends B {
456
455
  constructor(e, t) {
457
456
  super(), this.upstream = e, this.transform = t;
458
457
  }
@@ -462,12 +461,12 @@ var A = class {
462
461
  async pump() {
463
462
  let e = await this.upstream.next();
464
463
  if (e.done) return !1;
465
- let t = f(e.value), n = this.transform(e.value), r = f(n);
464
+ let t = p(e.value), n = this.transform(e.value), r = p(n);
466
465
  this.outputQueue.pushAll(n);
467
466
  for (let e of t) o(e, r) || e.dispose();
468
467
  return !0;
469
468
  }
470
- }, U = class extends A {
469
+ }, H = class extends k {
471
470
  constructor(e, t) {
472
471
  super(), this.baseErrorHandler = t, this.lastRead = null, this.iterator = null, this.moreIterators = e;
473
472
  }
@@ -489,11 +488,11 @@ var A = class {
489
488
  let t = await this.iterator.next();
490
489
  return t.done ? (this.iterator = null, this.readFromChain(e)) : t;
491
490
  }
492
- }, W;
491
+ }, U;
493
492
  (function(e) {
494
493
  e[e.FAIL = 0] = "FAIL", e[e.SHORTEST = 1] = "SHORTEST", e[e.LONGEST = 2] = "LONGEST";
495
- })(W ||= {});
496
- var G = class extends A {
494
+ })(U ||= {});
495
+ var W = class extends k {
497
496
  constructor(e, t) {
498
497
  super(), this.upstream = e, this.bufferSize = t, this.buffer = new T(t);
499
498
  }
@@ -509,7 +508,7 @@ var G = class extends A {
509
508
  next() {
510
509
  return this.refill(), this.buffer.shift();
511
510
  }
512
- }, K = class extends G {
511
+ }, G = class extends W {
513
512
  constructor(e, n, r) {
514
513
  super(e, n), this.upstream = e, this.windowSize = n, this.upstreamExhausted = !1, this.random = m.alea(r || t().toString()), this.lastRead = Promise.resolve({
515
514
  value: null,
@@ -536,7 +535,7 @@ var G = class extends A {
536
535
  done: !0
537
536
  };
538
537
  }
539
- }, q = class {
538
+ }, K = class {
540
539
  constructor() {
541
540
  this.size = null;
542
541
  }
@@ -545,54 +544,54 @@ var G = class extends A {
545
544
  r(e > 0, () => `batchSize needs to be positive, but it is
546
545
  ${e}`);
547
546
  let i;
548
- return i = this.size === Infinity || this.size == null ? this.size : t ? Math.ceil(this.size / e) : Math.floor(this.size / e), J(async () => (await n.iterator()).columnMajorBatch(e, t, Y), i);
547
+ return i = this.size === Infinity || this.size == null ? this.size : t ? Math.ceil(this.size / e) : Math.floor(this.size / e), q(async () => (await n.iterator()).columnMajorBatch(e, t, J), i);
549
548
  }
550
549
  concatenate(e) {
551
550
  let t = this, n;
552
- return n = this.size === Infinity || e.size === Infinity ? Infinity : this.size != null && e.size != null ? this.size + e.size : null, J(async () => (await t.iterator()).concatenate(await e.iterator()), n);
551
+ return n = this.size === Infinity || e.size === Infinity ? Infinity : this.size != null && e.size != null ? this.size + e.size : null, q(async () => (await t.iterator()).concatenate(await e.iterator()), n);
553
552
  }
554
553
  filter(e) {
555
554
  let t = this, n;
556
- return n = this.size === Infinity ? Infinity : null, J(async () => (await t.iterator()).filter((t) => s(() => e(t))), n);
555
+ return n = this.size === Infinity ? Infinity : null, q(async () => (await t.iterator()).filter((t) => s(() => e(t))), n);
557
556
  }
558
557
  async forEachAsync(e) {
559
558
  return (await this.iterator()).forEachAsync(e);
560
559
  }
561
560
  map(e) {
562
561
  let t = this;
563
- return J(async () => (await t.iterator()).map((t) => s(() => e(t))), this.size);
562
+ return q(async () => (await t.iterator()).map((t) => s(() => e(t))), this.size);
564
563
  }
565
564
  mapAsync(e) {
566
565
  let t = this;
567
- return J(async () => (await t.iterator()).mapAsync(e), this.size);
566
+ return q(async () => (await t.iterator()).mapAsync(e), this.size);
568
567
  }
569
568
  prefetch(e) {
570
569
  if (e == null) throw RangeError("`Dataset.prefetch()` requires bufferSize to be specified.");
571
570
  let t = this;
572
- return J(async () => (await t.iterator()).prefetch(e), this.size);
571
+ return q(async () => (await t.iterator()).prefetch(e), this.size);
573
572
  }
574
573
  repeat(e) {
575
574
  let t = this, n;
576
- return n = this.size != null && e > 0 ? this.size * e : e === 0 ? 0 : this.size != null && (e === void 0 || e < 0) ? Infinity : null, J(async () => k(O(async () => ({
575
+ return n = this.size != null && e > 0 ? this.size * e : e === 0 ? 0 : this.size != null && (e === void 0 || e < 0) ? Infinity : null, q(async () => O(D(async () => ({
577
576
  value: await t.iterator(),
578
577
  done: !1
579
578
  })).take(e)), n);
580
579
  }
581
580
  skip(e) {
582
581
  let t = this, n;
583
- return n = this.size != null && e >= 0 && this.size >= e ? this.size - e : this.size != null && (this.size < e || e === void 0 || e < 0) ? 0 : null, J(async () => (await t.iterator()).skip(e), n);
582
+ return n = this.size != null && e >= 0 && this.size >= e ? this.size - e : this.size != null && (this.size < e || e === void 0 || e < 0) ? 0 : null, q(async () => (await t.iterator()).skip(e), n);
584
583
  }
585
584
  shuffle(e, n, r = !0) {
586
585
  if (e == null || e < 0) throw this.size == null ? RangeError("`Dataset.shuffle()` requires bufferSize to be specified.") : RangeError(`\`Dataset.shuffle()\` requires bufferSize to be specified. If your data fits in main memory (for regular JS objects), and/or GPU memory (for \`tf.Tensor\`s), consider setting bufferSize to the dataset size (${this.size} elements)`);
587
586
  let i = this, a = m.alea(n || t().toString());
588
- return J(async () => {
587
+ return q(async () => {
589
588
  let t = a.int32();
590
589
  return r && (t += a.int32()), (await i.iterator()).shuffle(e, t.toString());
591
590
  }, this.size);
592
591
  }
593
592
  take(e) {
594
593
  let t = this, n;
595
- return n = this.size != null && this.size > e ? e : this.size != null && this.size <= e ? this.size : null, J(async () => (await t.iterator()).take(e), n);
594
+ return n = this.size != null && this.size > e ? e : this.size != null && this.size <= e ? this.size : null, q(async () => (await t.iterator()).take(e), n);
596
595
  }
597
596
  async toArray() {
598
597
  if (this.size === Infinity) throw Error("Can not convert infinite data stream to array.");
@@ -603,9 +602,9 @@ var G = class extends A {
603
602
  return (await this.iterator()).toArrayForTest();
604
603
  }
605
604
  };
606
- q.MAX_BUFFER_SIZE = 1e4;
607
- function J(e, t = null) {
608
- return new class extends q {
605
+ K.MAX_BUFFER_SIZE = 1e4;
606
+ function q(e, t = null) {
607
+ return new class extends K {
609
608
  constructor() {
610
609
  super(...arguments), this.size = t;
611
610
  }
@@ -614,40 +613,36 @@ function J(e, t = null) {
614
613
  }
615
614
  }();
616
615
  }
617
- function Y(e) {
616
+ function J(e) {
618
617
  if (e === null) return null;
619
618
  let t = e[0];
620
619
  return x(t) ? {
621
- value: X(e),
620
+ value: Y(e),
622
621
  recurse: !1
623
622
  } : {
624
623
  value: null,
625
624
  recurse: !0
626
625
  };
627
626
  }
628
- function X(e) {
627
+ function Y(e) {
629
628
  if (e.length === 0) throw Error("Can't make a batch of zero elements.");
630
- return e[0] instanceof d ? i(e) : c(e);
629
+ return e[0] instanceof f ? i(e) : c(e);
631
630
  }
632
631
  //#endregion
633
- //#region node_modules/@tensorflow/tfjs-data/dist/iterators/string_iterator.js
634
- p();
635
- //#endregion
636
632
  //#region node_modules/@tensorflow/tfjs-data/dist/readers.js
637
- function Z(e) {
638
- return J(async () => {
633
+ function X(e) {
634
+ return q(async () => {
639
635
  let t = await e();
640
- return O(() => t.next());
636
+ return D(() => t.next());
641
637
  });
642
638
  }
643
639
  //#endregion
644
640
  //#region lib/training/DatasetBuilder.ts
645
- var Q = 8;
646
- function te(e, t) {
641
+ function Z(e, t) {
647
642
  let n = e.map((e) => t.encodeConversation(e)).flat();
648
643
  return new Uint16Array(n);
649
644
  }
650
- function ne(e, t) {
645
+ function Q(e, t) {
651
646
  let n = e.map((e) => t.encodeConversation(e, !1, !0));
652
647
  console.log("Tokenised Texts with Mask:", n);
653
648
  let r = n.map((e) => e.tokens).flat(), i = n.map((e) => e.mask).flat();
@@ -663,7 +658,7 @@ function $(e) {
663
658
  }
664
659
  return e;
665
660
  }
666
- var re = class {
661
+ var te = class {
667
662
  tokenizer;
668
663
  blockSize;
669
664
  constructor(e, t = 128) {
@@ -671,22 +666,21 @@ var re = class {
671
666
  }
672
667
  async createTextDataset(e, t = 32, n, r, i = 65535) {
673
668
  if (e.length < this.blockSize + 1) throw Error(`Not enough tokens (${e.length}) for block size ${this.blockSize}`);
674
- let a = {
675
- shuffledIndexes: new Uint32Array(e.length),
669
+ let a = Math.ceil(e.length / this.blockSize), o = {
670
+ shuffledIndexes: new Uint32Array(a),
676
671
  step: 0
677
672
  };
678
- if (n) a.shuffledIndexes = n;
673
+ if (n) o.shuffledIndexes = n;
679
674
  else {
680
- a.shuffledIndexes = new Uint32Array(e.length);
681
- for (let t = 0; t < e.length; t++) a.shuffledIndexes[t] = t;
682
- $(a.shuffledIndexes);
675
+ o.shuffledIndexes = new Uint32Array(a);
676
+ for (let e = 0; e < a; e++) o.shuffledIndexes[e] = e;
683
677
  }
684
678
  return {
685
- dataset: Z(function* () {
679
+ dataset: X(function* () {
686
680
  for (;;) {
687
- let t = a.shuffledIndexes[a.step++];
688
- if (a.step >= a.shuffledIndexes.length && (a.step = 0, $(a.shuffledIndexes)), t + this.blockSize + 1 > e.length) continue;
689
- let n = new Int32Array(e.subarray(t, t + this.blockSize)), o = e.subarray(t + 1, t + this.blockSize + 1), s = new Int32Array(o);
681
+ let t = o.shuffledIndexes[o.step++] * this.blockSize;
682
+ if (o.step >= o.shuffledIndexes.length && (o.step = 0, $(o.shuffledIndexes)), t + this.blockSize + 1 > e.length) continue;
683
+ let n = new Int32Array(e.subarray(t, t + this.blockSize)), a = e.subarray(t + 1, t + this.blockSize + 1), s = new Int32Array(a);
690
684
  if (r) {
691
685
  let e = 0;
692
686
  for (let n = 0; n < s.length; n++) r[t + 1 + n] === 0 && (s[n] = i, e++);
@@ -704,9 +698,9 @@ var re = class {
704
698
  ys: t.ys.cast("int32")
705
699
  }));
706
700
  }).prefetch(2),
707
- state: a
701
+ state: o
708
702
  };
709
703
  }
710
704
  };
711
705
  //#endregion
712
- export { $ as a, ne as i, Q as n, te as r, re as t };
706
+ export { $ as i, Z as n, Q as r, te as t };
package/dist/Generator.js CHANGED
@@ -1,2 +1,2 @@
1
- import { c as e, s as t } from "./main-BTmbwF1h.js";
1
+ import { c as e, s as t } from "./main-DdsoTJAW.js";
2
2
  export { t as default, e as isConversation };
@@ -1,9 +1,9 @@
1
- import { Dn as e, En as t, Io as n, Ks as r, Ms as i, Si as a, Tn as o, nc as s, oc as c, wn as l, xn as u } from "./dist-BewPQWjc.js";
2
- import { L as d } from "./backend_util-Cg-roD1p.js";
3
- import { o as f } from "./gpgpu_math-DvLcCH6u.js";
4
- import { J as p, b as m } from "./shared-DOgWaqvL.js";
5
- import { S as h, n as g } from "./kernel_funcs_utils-HiXOOx3f.js";
6
- import { t as _ } from "./Reshape-CABOPB9d.js";
1
+ import { Dn as e, En as t, Io as n, Ks as r, Ms as i, Si as a, Tn as o, nc as s, oc as c, wn as l, xn as u } from "./dist-Da20xy8E.js";
2
+ import { L as d } from "./backend_util-DAV0I34P.js";
3
+ import { o as f } from "./gpgpu_math-DBYEAAdI.js";
4
+ import { J as p, b as m } from "./shared-CfTzpULd.js";
5
+ import { S as h, n as g } from "./kernel_funcs_utils-D-mATnGR.js";
6
+ import { t as _ } from "./Reshape-dnm9bO3B.js";
7
7
  //#region node_modules/@tensorflow/tfjs-backend-webgl/dist/mean_gpu.js
8
8
  var v = class {
9
9
  constructor(e, t) {
@@ -1,4 +1,4 @@
1
- import { Bo as e, Gs as t, Ps as n, oc as r } from "./dist-BewPQWjc.js";
1
+ import { Bo as e, Gs as t, Ps as n, oc as r } from "./dist-Da20xy8E.js";
2
2
  //#region node_modules/@tensorflow/tfjs-backend-webgpu/dist/kernels/Reshape.js
3
3
  function i(e) {
4
4
  let { inputs: i, attrs: a } = e, { x: o } = i, { shape: s } = a, c = r(o.shape), l = t(s, c), u = r(l);
@@ -1,5 +1,5 @@
1
- import { Bo as e, Gs as t, Ps as n, oc as r } from "./dist-BewPQWjc.js";
2
- import { E as i, a, c as o, d as s, j as c, l, u, z as d } from "./gpgpu_math-DvLcCH6u.js";
1
+ import { Bo as e, Gs as t, Ps as n, oc as r } from "./dist-Da20xy8E.js";
2
+ import { E as i, a, c as o, d as s, j as c, l, u, z as d } from "./gpgpu_math-DBYEAAdI.js";
3
3
  //#region node_modules/@tensorflow/tfjs-backend-webgl/dist/reshape_packed_gpu.js
4
4
  var f = class {
5
5
  constructor(e, t) {
@@ -1,2 +1,2 @@
1
- import { i as e } from "./main-BTmbwF1h.js";
1
+ import { i as e } from "./main-DdsoTJAW.js";
2
2
  export { e as default };
package/dist/Trainer.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e } from "./main-BTmbwF1h.js";
1
+ import { a as e } from "./main-DdsoTJAW.js";
2
2
  export { e as default };
package/dist/backend.js CHANGED
@@ -1,10 +1,10 @@
1
- import { ai as e, ci as t, ui as n } from "./dist-BewPQWjc.js";
1
+ import { ai as e, ci as t, ui as n } from "./dist-Da20xy8E.js";
2
2
  //#region lib/backend.ts
3
3
  async function r(r, i) {
4
4
  if (e() !== r) {
5
5
  if (r === "webgpu") {
6
6
  let { registerWebGPUBackend: e } = await import("./patches/webgpu_base.js");
7
- e(i), await import("./dist-DVmq73nz.js"), await import("./ops/webgpu/index.js");
7
+ e(i), await import("./dist-9wGF4ci9.js"), await import("./ops/webgpu/index.js");
8
8
  }
9
9
  await n(r), await t(), console.log(`Backend set to ${r}`);
10
10
  }
@@ -1,8 +1,8 @@
1
- import { r as e } from "./chunk-BPntVaq0.js";
2
- import { Ar as t, Ci as n, Cn as r, Cr as i, Dn as a, Dr as o, En as s, Er as c, In as l, Li as u, Ln as d, M as ee, N as te, Oi as ne, On as re, Or as ie, Ps as f, Ri as ae, Rn as oe, Rs as se, Sn as ce, Sr as le, Tn as ue, Tr as de, ec as p, j as fe, jr as pe, ki as me, kr as he, oc as m, wn as ge, wr as _e, xn as ve, xr as ye } from "./dist-BewPQWjc.js";
3
- import { a as be, i as xe, n as Se, o as Ce, r as we, t as Te } from "./selu_util-zkAx5doH.js";
4
- import { s as Ee } from "./slice_util-Dgb3ANWI.js";
5
- import { n as De, t as Oe } from "./concat_util-CWDZCBlA.js";
1
+ import { n as e } from "./chunk-CWhphoD1.js";
2
+ import { Ar as t, Ci as n, Cn as r, Cr as i, Dn as a, Dr as o, En as s, Er as c, In as l, Li as u, Ln as d, M as ee, N as te, Oi as ne, On as re, Or as ie, Ps as f, Ri as ae, Rn as oe, Rs as se, Sn as ce, Sr as le, Tn as ue, Tr as de, ec as p, j as fe, jr as pe, ki as me, kr as he, oc as m, wn as ge, wr as _e, xn as ve, xr as ye } from "./dist-Da20xy8E.js";
3
+ import { a as be, i as xe, n as Se, o as Ce, r as we, t as Te } from "./selu_util-B_AFEfoz.js";
4
+ import { s as Ee } from "./slice_util-Dve4TkDn.js";
5
+ import { n as De, t as Oe } from "./concat_util-CWzvQQlK.js";
6
6
  import { a as ke, c as Ae, i as je, n as Me, o as Ne, r as Pe, s as Fe, t as Ie } from "./complex_util-CkazZsaH.js";
7
7
  //#region node_modules/@tensorflow/tfjs-core/dist/ops/gather_nd_util.js
8
8
  function h(e, t) {
@@ -1,4 +1,4 @@
1
- import { P as e, ii as t, ui as n } from "../dist-BewPQWjc.js";
1
+ import { P as e, ii as t, ui as n } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/appendCache.ts
3
3
  async function r(r) {
4
4
  await n(r);
@@ -1,4 +1,4 @@
1
- import { I as e, P as t, ii as n, ui as r } from "../dist-BewPQWjc.js";
1
+ import { I as e, P as t, ii as n, ui as r } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/attentionMask.ts
3
3
  async function i(i) {
4
4
  await r(i);
@@ -1,4 +1,4 @@
1
- import { I as e, ii as t, ui as n } from "../dist-BewPQWjc.js";
1
+ import { I as e, ii as t, ui as n } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/gelu.ts
3
3
  async function r(r) {
4
4
  await n(r);
@@ -1,4 +1,4 @@
1
- import { I as e, ii as t, ui as n } from "../dist-BewPQWjc.js";
1
+ import { I as e, ii as t, ui as n } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/matMulGelu.ts
3
3
  async function r(r) {
4
4
  await n(r);
@@ -1,4 +1,4 @@
1
- import { Kt as e, L as t, fi as n, ii as r, m as i, ui as a } from "../dist-BewPQWjc.js";
1
+ import { Kt as e, L as t, fi as n, ii as r, m as i, ui as a } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/normRMS.ts
3
3
  var o = Array.from({ length: 2048 * 192 }, () => Math.random()), s = Array.from({ length: 192 }, () => Math.random()), c = Array.from({ length: 2048 * 192 }, () => Math.random());
4
4
  async function l(l) {
@@ -1,4 +1,4 @@
1
- import { L as e, fi as t, ii as n, ui as r } from "../dist-BewPQWjc.js";
1
+ import { L as e, fi as t, ii as n, ui as r } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/normRMSGrad.ts
3
3
  var i = Array.from({ length: 2048 * 192 }, () => Math.random()), a = Array.from({ length: 192 }, () => Math.random()), o = Array.from({ length: 2048 * 192 }, () => Math.random());
4
4
  async function s(s) {
@@ -1,4 +1,4 @@
1
- import { I as e, ii as t, ui as n } from "../dist-BewPQWjc.js";
1
+ import { I as e, ii as t, ui as n } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/packUnpack.ts
3
3
  async function r(r) {
4
4
  await n(r);
@@ -1,4 +1,4 @@
1
- import { F as e, I as t, ii as n, ui as r } from "../dist-BewPQWjc.js";
1
+ import { F as e, I as t, ii as n, ui as r } from "../dist-Da20xy8E.js";
2
2
  //#region lib/checks/qkv.ts
3
3
  async function i(i) {
4
4
  await r(i);
@@ -1,4 +1,4 @@
1
- import { P as e, ii as t, ui as n } from "../dist-BewPQWjc.js";
1
+ import { P as e, ii as t, ui as n } from "../dist-Da20xy8E.js";
2
2
  import r from "../layers/RoPECache.js";
3
3
  //#region lib/checks/rope.ts
4
4
  async function i(i) {
@@ -1,23 +1,23 @@
1
1
  //#region \0rolldown/runtime.js
2
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (e && (t = e(e = 0)), t), s = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), c = (e, n) => {
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
3
3
  let r = {};
4
4
  for (var i in e) t(r, i, {
5
5
  get: e[i],
6
6
  enumerable: !0
7
7
  });
8
8
  return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
9
- }, l = (e, i, o, s) => {
9
+ }, c = (e, i, o, s) => {
10
10
  if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
11
11
  get: ((e) => i[e]).bind(null, d),
12
12
  enumerable: !(s = n(i, d)) || s.enumerable
13
13
  });
14
14
  return e;
15
- }, u = (n, r, a) => (a = n == null ? {} : e(i(n)), l(r || !n || !n.__esModule ? t(a, "default", {
15
+ }, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
16
16
  value: n,
17
17
  enumerable: !0
18
- }) : a, n)), d = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
18
+ }) : a, n)), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
19
19
  if (typeof require < "u") return require.apply(this, arguments);
20
20
  throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
21
21
  });
22
22
  //#endregion
23
- export { u as a, d as i, o as n, c as r, s as t };
23
+ export { l as i, s as n, u as r, o as t };
@@ -1,4 +1,4 @@
1
- import { Ps as e } from "./dist-BewPQWjc.js";
1
+ import { Ps as e } from "./dist-Da20xy8E.js";
2
2
  //#region node_modules/@tensorflow/tfjs-core/dist/ops/concat_util.js
3
3
  function t(t, n) {
4
4
  let r = t[0].length;