@genai-fi/nanogpt 0.17.4 → 0.18.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 (258) hide show
  1. package/dist/Generator.d.ts +2 -15
  2. package/dist/Generator.js +45 -34
  3. package/dist/{RealDiv-CGwv0liw.js → RealDiv-ioj6Z-ox.js} +9 -9
  4. package/dist/{Reshape-BW__R4mZ.js → Reshape-BZC-ebeR.js} +7 -7
  5. package/dist/{Reshape-CPBkTIH2.js → Reshape-pwprEaej.js} +1 -1
  6. package/dist/TeachableLLM.d.ts +3 -8
  7. package/dist/TeachableLLM.js +61 -44
  8. package/dist/Trainer.d.ts +6 -4
  9. package/dist/Trainer.js +107 -92
  10. package/dist/{axis_util-GTVlo58H.js → axis_util-QWWgLjut.js} +1 -1
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-GaFarB78.js → backend_util-qwSFfxYx.js} +21 -21
  13. package/dist/{backend_webgpu-BqASlsbV.js → backend_webgpu-DI2wXEC2.js} +8 -8
  14. package/dist/{broadcast_to-eS93CCN_.js → broadcast_to-C_EJTVTZ.js} +2 -2
  15. package/dist/checks/appendCache.js +2 -2
  16. package/dist/checks/attentionMask.js +5 -5
  17. package/dist/checks/gelu.js +2 -2
  18. package/dist/checks/matMulGelu.js +2 -2
  19. package/dist/checks/normRMS.js +6 -6
  20. package/dist/checks/normRMSGrad.js +3 -3
  21. package/dist/checks/packUnpack.js +6 -6
  22. package/dist/checks/qkv.js +2 -2
  23. package/dist/checks/rope.js +2 -2
  24. package/dist/{clip_by_value-DDA7rrcT.js → clip_by_value-CLAD4h_I.js} +1 -1
  25. package/dist/complex-3DpPEG9B.js +11 -0
  26. package/dist/{concat-CAQpCret.js → concat-Dqk7Xk7h.js} +5 -5
  27. package/dist/{concat_util-D18dJ4fD.js → concat_util-C1Mxe27t.js} +1 -1
  28. package/dist/{dataset-CGGp1z9P.js → dataset-DlqAN81i.js} +3 -3
  29. package/dist/{dropout_util--NxWuYg2.js → dropout_util-N0z8Os-K.js} +1 -1
  30. package/dist/{expand_dims-Bkd1YD5x.js → expand_dims-D0rBtgT1.js} +4 -4
  31. package/dist/{exports_initializers-CYzKLjN7.js → exports_initializers-DIOZQt_L.js} +1 -1
  32. package/dist/{floor-BQtb-Azg.js → floor-CymuCmTO.js} +1 -1
  33. package/dist/{gather-qIqEqaGn.js → gather-DEyjXNb1.js} +1 -1
  34. package/dist/{gelu-B220X1Go.js → gelu-DpTCC3eB.js} +1 -1
  35. package/dist/{gpgpu_math-BwvV12df.js → gpgpu_math-3bCb5ooU.js} +25 -25
  36. package/dist/{index-CjOWnMXP.js → index-BQvB7LCC.js} +15 -15
  37. package/dist/{index-CUXkjxiT.js → index-DSGwv2Yx.js} +33 -33
  38. package/dist/inference/types.d.ts +16 -0
  39. package/dist/inference/types.js +1 -0
  40. package/dist/{kernel_funcs_utils-pq0CK9co.js → kernel_funcs_utils-DGqzNlHT.js} +6 -6
  41. package/dist/layers/BaseLayer.js +4 -4
  42. package/dist/layers/CausalSelfAttention.js +6 -6
  43. package/dist/layers/LoRA.js +4 -4
  44. package/dist/layers/MLP.js +4 -4
  45. package/dist/layers/PositionEmbedding.js +5 -5
  46. package/dist/layers/RMSNorm.js +3 -3
  47. package/dist/layers/RoPECache.js +4 -4
  48. package/dist/layers/TiedEmbedding.js +6 -6
  49. package/dist/layers/TransformerBlock.js +1 -1
  50. package/dist/layers/WeightStore.js +2 -2
  51. package/dist/loader/load.d.ts +2 -8
  52. package/dist/loader/loadTransformers.d.ts +2 -8
  53. package/dist/loader/loadTransformers.js +13 -11
  54. package/dist/loader/newZipLoad.d.ts +2 -8
  55. package/dist/loader/newZipLoad.js +25 -10
  56. package/dist/loader/oldZipLoad.js +13 -13
  57. package/dist/loader/save.d.ts +9 -2
  58. package/dist/loader/save.js +64 -55
  59. package/dist/loader/types.d.ts +29 -1
  60. package/dist/main.d.ts +2 -0
  61. package/dist/main.js +45 -43
  62. package/dist/{matMul16-BcVC_E62.js → matMul16-BIT70Vya.js} +3 -3
  63. package/dist/{matMulGelu-JNLZqKQp.js → matMulGelu-CsZnh18H.js} +18 -18
  64. package/dist/mat_mul-DP86qZtZ.js +11 -0
  65. package/dist/mod-BXjLYwvM.js +11 -0
  66. package/dist/models/NanoGPTV1.js +2 -2
  67. package/dist/models/NanoGPTV2.js +2 -2
  68. package/dist/models/model.d.ts +3 -2
  69. package/dist/models/model.js +13 -13
  70. package/dist/{not_equal-hurPF26l.js → not_equal-CkQKkKZy.js} +15 -15
  71. package/dist/{ones-BytntneX.js → ones-DbVB5N58.js} +3 -3
  72. package/dist/ops/adamAdjust.js +3 -3
  73. package/dist/ops/adamMoments.js +3 -3
  74. package/dist/ops/add16.js +1 -1
  75. package/dist/ops/appendCache.js +6 -6
  76. package/dist/ops/attentionMask.js +3 -3
  77. package/dist/ops/concat16.js +3 -3
  78. package/dist/ops/cpu/adamAdjust.js +9 -9
  79. package/dist/ops/cpu/adamMoments.js +5 -5
  80. package/dist/ops/cpu/appendCache.js +2 -2
  81. package/dist/ops/cpu/attentionMask.js +6 -6
  82. package/dist/ops/cpu/fusedSoftmax.js +4 -4
  83. package/dist/ops/cpu/gatherSub.js +5 -5
  84. package/dist/ops/cpu/gelu.js +4 -4
  85. package/dist/ops/cpu/matMul16.js +2 -2
  86. package/dist/ops/cpu/matMulGelu.js +7 -7
  87. package/dist/ops/cpu/matMulMul.js +2 -2
  88. package/dist/ops/cpu/mulDropout.js +5 -5
  89. package/dist/ops/cpu/normRMS.js +1 -1
  90. package/dist/ops/cpu/qkv.js +3 -3
  91. package/dist/ops/cpu/rope.js +5 -5
  92. package/dist/ops/cpu/scatterSub.js +5 -5
  93. package/dist/ops/dot16.js +2 -2
  94. package/dist/ops/dropout.js +6 -6
  95. package/dist/ops/dropout16.js +1 -1
  96. package/dist/ops/gatherSub.js +1 -1
  97. package/dist/ops/gelu.js +2 -2
  98. package/dist/ops/globalNorm.js +7 -7
  99. package/dist/ops/grads/add16.js +1 -1
  100. package/dist/ops/grads/attentionMask.js +2 -2
  101. package/dist/ops/grads/dropout16.js +1 -1
  102. package/dist/ops/grads/gelu.js +2 -2
  103. package/dist/ops/grads/matMul16.js +3 -3
  104. package/dist/ops/grads/matMulGelu.js +1 -1
  105. package/dist/ops/grads/mul16.js +1 -1
  106. package/dist/ops/grads/normRMS.js +7 -7
  107. package/dist/ops/grads/pack16.js +3 -3
  108. package/dist/ops/grads/qkv.js +11 -11
  109. package/dist/ops/grads/rope.js +2 -2
  110. package/dist/ops/grads/softmax16.js +1 -1
  111. package/dist/ops/grads/unpack16.js +2 -2
  112. package/dist/ops/matMul16.js +3 -3
  113. package/dist/ops/matMulGelu.js +6 -6
  114. package/dist/ops/matMulMul.js +3 -3
  115. package/dist/ops/mul16.js +1 -1
  116. package/dist/ops/mulDrop.js +3 -3
  117. package/dist/ops/normRMS.js +4 -4
  118. package/dist/ops/pack16.js +2 -2
  119. package/dist/ops/qkv.js +3 -3
  120. package/dist/ops/reshape16.js +6 -6
  121. package/dist/ops/rope.js +2 -2
  122. package/dist/ops/scatterSub.js +1 -1
  123. package/dist/ops/slice16.js +2 -2
  124. package/dist/ops/softmax16.js +1 -1
  125. package/dist/ops/sub16.js +1 -1
  126. package/dist/ops/sum16.js +6 -6
  127. package/dist/ops/transpose16.js +3 -3
  128. package/dist/ops/unpack16.js +2 -2
  129. package/dist/ops/webgl/adamAdjust.js +2 -2
  130. package/dist/ops/webgl/adamMoments.js +1 -1
  131. package/dist/ops/webgl/appendCache.js +1 -1
  132. package/dist/ops/webgl/attentionMask.js +1 -1
  133. package/dist/ops/webgl/dropout16.js +1 -1
  134. package/dist/ops/webgl/fusedSoftmax.js +7 -7
  135. package/dist/ops/webgl/gatherSub.js +3 -3
  136. package/dist/ops/webgl/gelu.js +2 -2
  137. package/dist/ops/webgl/log.js +3 -3
  138. package/dist/ops/webgl/matMul16.js +13 -13
  139. package/dist/ops/webgl/matMulGelu.js +4 -4
  140. package/dist/ops/webgl/matMulMul.js +2 -2
  141. package/dist/ops/webgl/mulDropout.js +1 -1
  142. package/dist/ops/webgl/normRMS.js +2 -2
  143. package/dist/ops/webgl/qkv.js +1 -1
  144. package/dist/ops/webgl/rope.js +1 -1
  145. package/dist/ops/webgl/scatterSub.js +2 -2
  146. package/dist/ops/webgpu/adamAdjust.js +3 -3
  147. package/dist/ops/webgpu/adamMoments.js +3 -3
  148. package/dist/ops/webgpu/add16.js +6 -6
  149. package/dist/ops/webgpu/appendCache.js +3 -3
  150. package/dist/ops/webgpu/attentionMask.js +2 -2
  151. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  152. package/dist/ops/webgpu/clipScale.js +7 -7
  153. package/dist/ops/webgpu/concat16.js +5 -5
  154. package/dist/ops/webgpu/dropout16.js +6 -6
  155. package/dist/ops/webgpu/gatherSub.js +3 -3
  156. package/dist/ops/webgpu/gelu.js +8 -8
  157. package/dist/ops/webgpu/matMul16.js +16 -16
  158. package/dist/ops/webgpu/matMul16_program.js +2 -2
  159. package/dist/ops/webgpu/mul16.js +5 -5
  160. package/dist/ops/webgpu/norm2.js +1 -1
  161. package/dist/ops/webgpu/normRMS.js +2 -2
  162. package/dist/ops/webgpu/normRMSGrad.js +4 -4
  163. package/dist/ops/webgpu/pack16.js +4 -4
  164. package/dist/ops/webgpu/pack16_program.js +2 -2
  165. package/dist/ops/webgpu/qkv.js +2 -2
  166. package/dist/ops/webgpu/rope.js +3 -3
  167. package/dist/ops/webgpu/scatterSub.js +3 -3
  168. package/dist/ops/webgpu/slice16.js +4 -4
  169. package/dist/ops/webgpu/softmax16.js +4 -4
  170. package/dist/ops/webgpu/softmax16_program.js +2 -2
  171. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  172. package/dist/ops/webgpu/softmax16grad.js +4 -4
  173. package/dist/ops/webgpu/sub16.js +6 -6
  174. package/dist/ops/webgpu/sum16.js +3 -3
  175. package/dist/ops/webgpu/transpose16.js +8 -8
  176. package/dist/ops/webgpu/transpose16_program.js +2 -2
  177. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  178. package/dist/ops/webgpu/unpack16.js +3 -3
  179. package/dist/ops/webgpu/utils/binary_op.js +3 -3
  180. package/dist/ops/webgpu/utils/reductions.js +5 -5
  181. package/dist/{ops-CsXeTq1P.js → ops-CURIZSVt.js} +100 -100
  182. package/dist/{pack16-bqltoUlR.js → pack16-WlOSOuZA.js} +2 -2
  183. package/dist/patches/webgpu_backend.js +6 -6
  184. package/dist/patches/webgpu_base.js +1 -1
  185. package/dist/patches/webgpu_program.js +2 -2
  186. package/dist/{random_normal-IBRrha8a.js → random_normal-CIm8lk2-.js} +1 -1
  187. package/dist/{random_width-DN5ZtQkM.js → random_width-B_fVXhGx.js} +131 -131
  188. package/dist/{range-C-CjF-LI.js → range-BDxO73mk.js} +1 -1
  189. package/dist/{readers-iz5u3HBo.js → readers-17HLdxVM.js} +2 -2
  190. package/dist/relu-DTvZKBsZ.js +9 -0
  191. package/dist/{reshape-BDOuCSNW.js → reshape-BIN71H3p.js} +1 -1
  192. package/dist/{resize_nearest_neighbor-BojqlfRe.js → resize_nearest_neighbor-C6_0dAnK.js} +41 -41
  193. package/dist/{rope-0j_f1TPm.js → rope-CC5RjmKU.js} +4 -4
  194. package/dist/{scatter_nd_util-ByNJaL6I.js → scatter_nd_util-C-x73Cj6.js} +1 -1
  195. package/dist/{segment_util-Dasb2Zaf.js → segment_util-4zuHV5IG.js} +2 -2
  196. package/dist/{selu_util-BLhIqRkw.js → selu_util-BXdhy_W6.js} +5 -5
  197. package/dist/{shared-CagdqkLh.js → shared-DRWDyk9w.js} +6 -6
  198. package/dist/{shared-3agzAqQ_.js → shared-zTaJ5siv.js} +1 -1
  199. package/dist/slice-BvItlgXu.js +12 -0
  200. package/dist/{slice_util-CC35pLmT.js → slice_util-DPY56GzQ.js} +5 -5
  201. package/dist/{softmax-D4q1LJN7.js → softmax-BLGJqdwx.js} +1 -1
  202. package/dist/split-BN9LkEgS.js +9 -0
  203. package/dist/{squeeze-ho4wLUek.js → squeeze-O_YWJpw_.js} +2 -2
  204. package/dist/{stack-DudVrtmG.js → stack-z6QE7kmP.js} +1 -1
  205. package/dist/{step-BTxPtq1r.js → step-DQY6_ABw.js} +4 -4
  206. package/dist/{sum-BpiwSWvg.js → sum-D39FeU5h.js} +3 -3
  207. package/dist/{tensor-BWFldCso.js → tensor-D8e0Gd7c.js} +1 -1
  208. package/dist/{tensor1d-LMGMIUlr.js → tensor1d-BMl0eZYV.js} +1 -1
  209. package/dist/{tensor2d-BnXMKScO.js → tensor2d-DTtQ1QcT.js} +1 -1
  210. package/dist/{tensor4d-C6UCG_u8.js → tensor4d-Dj4rDssL.js} +1 -1
  211. package/dist/{tfjs_backend-BGnG-ppu.js → tfjs_backend-Bk3PmK91.js} +65 -65
  212. package/dist/{tile-CFy-xTO6.js → tile-CsWlVKKz.js} +1 -1
  213. package/dist/tokeniser/BaseTokeniser.d.ts +4 -1
  214. package/dist/tokeniser/BaseTokeniser.js +21 -5
  215. package/dist/tokeniser/CharTokeniser.d.ts +1 -1
  216. package/dist/tokeniser/CharTokeniser.js +62 -50
  217. package/dist/tokeniser/bpe.d.ts +1 -1
  218. package/dist/tokeniser/bpe.js +41 -35
  219. package/dist/tokeniser/type.d.ts +3 -1
  220. package/dist/training/AdamW.d.ts +3 -0
  221. package/dist/training/AdamW.js +59 -30
  222. package/dist/training/BasicTrainer.d.ts +1 -0
  223. package/dist/training/BasicTrainer.js +112 -92
  224. package/dist/training/DatasetBuilder.js +3 -3
  225. package/dist/training/Evaluator.js +2 -2
  226. package/dist/training/LRScheduler.d.ts +1 -0
  227. package/dist/training/LRScheduler.js +18 -12
  228. package/dist/training/PreTrainer.js +3 -3
  229. package/dist/training/SFTDatasetBuilder.js +3 -3
  230. package/dist/training/SFTTrainer.js +1 -1
  231. package/dist/training/orthoGrad.js +1 -1
  232. package/dist/training/sparseCrossEntropy.js +30 -30
  233. package/dist/training/types.d.ts +5 -3
  234. package/dist/training/validation.js +13 -13
  235. package/dist/{transpose-9kRxIXWR.js → transpose-Qxz-4os3.js} +7 -7
  236. package/dist/{unsorted_segment_sum-DJvk5xnh.js → unsorted_segment_sum-BfFVV9Zm.js} +20 -20
  237. package/dist/utilities/datasetID.d.ts +2 -0
  238. package/dist/utilities/datasetID.js +21 -0
  239. package/dist/utilities/dummy.js +6 -6
  240. package/dist/utilities/multinomialCPU.js +2 -2
  241. package/dist/utilities/packed.js +1 -1
  242. package/dist/utilities/performance.js +1 -1
  243. package/dist/utilities/profile.js +1 -1
  244. package/dist/utilities/safetensors.js +2 -2
  245. package/dist/utilities/sentences.js +5 -5
  246. package/dist/utilities/weights.js +2 -2
  247. package/dist/{variable-Ck482e3n.js → variable-SSATClyt.js} +1 -1
  248. package/dist/{webgpu_program-B4HmApL1.js → webgpu_program-CbjdYLYk.js} +1 -1
  249. package/dist/{webgpu_util-DYlGSwOJ.js → webgpu_util-DuofJBMo.js} +7 -7
  250. package/dist/{zeros-DvZpK8s6.js → zeros-Bw0puq_w.js} +2 -2
  251. package/dist/{zeros_like-CWjDdwr-.js → zeros_like-rOHr54NY.js} +69 -69
  252. package/package.json +3 -3
  253. package/dist/complex-DI35Q-gW.js +0 -11
  254. package/dist/mat_mul-DhG0Newp.js +0 -11
  255. package/dist/mod-CSdCpRjf.js +0 -11
  256. package/dist/relu-J_X6MUzx.js +0 -9
  257. package/dist/slice-BzS11Qh0.js +0 -12
  258. package/dist/split-C2Sj255c.js +0 -9
@@ -1,38 +1,38 @@
1
- import { o as u, q as h, E as d, c7 as st, c8 as rt, c9 as nt, ca as et, cb as it, cc as pt, B, cd as at, ce as ht, bY as ut, x as D, cf as ct, cg as ft, i as H, a3 as C, bZ as lt, ch as dt, ci as mt, cj as Dt, aE as yt, ck as It, a2 as wt, m as M, _ as F, cl as xt, cm as gt, L as $, c1 as $t, cn as bt, co as kt, cp as vt, cq as Nt, a as _t, cr as Tt, cs as Et, ct as St, cu as qt, cv as r, a_ as Kt, j as zt, ag as W, cw as Pt, cx as Ct, p as Mt, l as Ot, n as At, a1 as Bt } from "./index-CUXkjxiT.js";
2
- import { e as j, a as R, l as X, b as G, d as V, f as Z, m as U, r as E, g as Ht, h as Ft, i as Wt, j as jt, k as Rt, n as Xt, o as Gt, c as Vt, p as Zt, q as Ut, t as Yt, u as Jt, v as Lt, w as Qt, x as to, y as oo, z as so, A as ro, B as no, C as eo, s as io, D as po, E as ao, F as ho } from "./unsorted_segment_sum-DJvk5xnh.js";
3
- import { r as l } from "./reshape-BDOuCSNW.js";
4
- import { b as uo } from "./broadcast_to-eS93CCN_.js";
5
- import { c as co } from "./clip_by_value-DDA7rrcT.js";
6
- import { c as _ } from "./concat-CAQpCret.js";
7
- import { w as Y, e as fo, l as lo, b as mo, m as Do, a as yo, n as Io } from "./not_equal-hurPF26l.js";
8
- import { m as v } from "./mat_mul-DhG0Newp.js";
9
- import { s as J, k as wo, h as xo, e as go, l as $o, p as bo, r as ko, a as vo } from "./step-BTxPtq1r.js";
10
- import { n as L, b as S, c as No, g as _o, l as To, a as Eo, d as So, h as qo, m as Ko, f as zo, e as Po, r as Co, s as Mo, u as Oo } from "./resize_nearest_neighbor-BojqlfRe.js";
11
- import { e as Ao } from "./expand_dims-Bkd1YD5x.js";
12
- import { f as Bo } from "./floor-BQtb-Azg.js";
13
- import { g as Ho } from "./gather-qIqEqaGn.js";
14
- import { c as q } from "./complex-DI35Q-gW.js";
15
- import { n as N, r as K, i as Q, t as Fo } from "./transpose-9kRxIXWR.js";
16
- import { s as T } from "./slice-BzS11Qh0.js";
17
- import { m as Wo } from "./mod-CSdCpRjf.js";
18
- import { r as jo } from "./relu-J_X6MUzx.js";
19
- import { s as z } from "./split-C2Sj255c.js";
20
- import { z as Ro } from "./zeros-DvZpK8s6.js";
21
- import { s as Xo } from "./softmax-D4q1LJN7.js";
22
- import { s as Go } from "./squeeze-ho4wLUek.js";
23
- import { s as Vo } from "./stack-DudVrtmG.js";
24
- import { s as Zo } from "./sum-BpiwSWvg.js";
25
- import { t as Uo } from "./tile-CFy-xTO6.js";
26
- function Yo(t) {
1
+ import { o as u, n as h, E as d, c7 as st, c8 as rt, c9 as nt, ca as et, cb as it, cc as pt, z as B, cd as at, ce as ht, bY as ut, v as D, cf as ct, cg as ft, d as H, a3 as C, bZ as lt, ch as dt, ci as mt, cj as Dt, aE as yt, ck as It, a2 as wt, m as M, _ as F, cl as xt, cm as gt, J as $, c1 as $t, cn as bt, co as vt, cp as kt, cq as Nt, b as _t, cr as Tt, cs as Et, ct as St, cu as qt, cv as r, a_ as Kt, h as zt, ag as W, cw as Pt, cx as Ct, p as Mt, i as Ot, j as At, a1 as Bt } from "./index-DSGwv2Yx.js";
2
+ import { e as j, a as R, l as X, b as G, d as V, f as Z, m as J, r as E, g as Ht, h as Ft, i as Wt, j as jt, k as Rt, n as Xt, o as Gt, c as Vt, p as Zt, q as Jt, t as Ut, u as Yt, v as Qt, w as Lt, x as to, y as oo, z as so, A as ro, B as no, C as eo, s as io, D as po, E as ao, F as ho } from "./unsorted_segment_sum-BfFVV9Zm.js";
3
+ import { r as l } from "./reshape-BIN71H3p.js";
4
+ import { b as uo } from "./broadcast_to-C_EJTVTZ.js";
5
+ import { c as co } from "./clip_by_value-CLAD4h_I.js";
6
+ import { c as _ } from "./concat-Dqk7Xk7h.js";
7
+ import { w as U, e as fo, l as lo, b as mo, m as Do, a as yo, n as Io } from "./not_equal-CkQKkKZy.js";
8
+ import { m as k } from "./mat_mul-DP86qZtZ.js";
9
+ import { s as Y, k as wo, h as xo, e as go, l as $o, p as bo, r as vo, a as ko } from "./step-DQY6_ABw.js";
10
+ import { n as Q, b as S, c as No, g as _o, l as To, a as Eo, d as So, h as qo, m as Ko, f as zo, e as Po, r as Co, s as Mo, u as Oo } from "./resize_nearest_neighbor-C6_0dAnK.js";
11
+ import { e as Ao } from "./expand_dims-D0rBtgT1.js";
12
+ import { f as Bo } from "./floor-CymuCmTO.js";
13
+ import { g as Ho } from "./gather-DEyjXNb1.js";
14
+ import { c as q } from "./complex-3DpPEG9B.js";
15
+ import { n as N, r as K, i as L, t as Fo } from "./transpose-Qxz-4os3.js";
16
+ import { s as T } from "./slice-BvItlgXu.js";
17
+ import { m as Wo } from "./mod-BXjLYwvM.js";
18
+ import { r as jo } from "./relu-DTvZKBsZ.js";
19
+ import { s as z } from "./split-BN9LkEgS.js";
20
+ import { z as Ro } from "./zeros-Bw0puq_w.js";
21
+ import { s as Xo } from "./softmax-BLGJqdwx.js";
22
+ import { s as Go } from "./squeeze-O_YWJpw_.js";
23
+ import { s as Vo } from "./stack-z6QE7kmP.js";
24
+ import { s as Zo } from "./sum-D39FeU5h.js";
25
+ import { t as Jo } from "./tile-CsWlVKKz.js";
26
+ function Uo(t) {
27
27
  const s = { x: h(t, "x", "acos") };
28
28
  return d.runKernel(st, s);
29
29
  }
30
- const Jo = /* @__PURE__ */ u({ acos_: Yo });
31
- function Lo(t) {
30
+ const Yo = /* @__PURE__ */ u({ acos_: Uo });
31
+ function Qo(t) {
32
32
  const s = { x: h(t, "x", "acosh") };
33
33
  return d.runKernel(rt, s);
34
34
  }
35
- const Qo = /* @__PURE__ */ u({ acosh_: Lo });
35
+ const Lo = /* @__PURE__ */ u({ acosh_: Qo });
36
36
  function ts(t, o = 0) {
37
37
  const n = { x: h(t, "x", "argMin") }, e = { axis: o };
38
38
  return d.runKernel(nt, n, e);
@@ -94,7 +94,7 @@ function Is(t, o) {
94
94
  let s = h(t, "a", "div"), n = h(o, "b", "div");
95
95
  [s, n] = B(s, n);
96
96
  const e = H(s, n), i = C(e), p = j(n, i);
97
- return Y(p, i, e);
97
+ return U(p, i, e);
98
98
  }
99
99
  const ws = /* @__PURE__ */ u({ divNoNan_: Is });
100
100
  function xs(t, o) {
@@ -102,29 +102,29 @@ function xs(t, o) {
102
102
  D((s.rank === 1 || s.rank === 2) && (n.rank === 1 || n.rank === 2), () => `Error in dot: inputs must all be rank 1 or 2, but got ranks ${s.rank} and ${n.rank}.`);
103
103
  const e = s.rank === 1 ? s.size : s.shape[1], i = n.rank === 1 ? n.size : n.shape[0];
104
104
  if (D(e === i, () => `Error in dot: inner dimensions of inputs must match, but got ${e} and ${i}.`), s.rank === 1 && n.rank === 1) {
105
- const p = l(s, [1, -1]), a = l(n, [-1, 1]), f = v(p, a);
105
+ const p = l(s, [1, -1]), a = l(n, [-1, 1]), f = k(p, a);
106
106
  return l(f, []);
107
107
  } else if (s.rank === 1 && n.rank === 2) {
108
- const p = l(s, [1, -1]), a = l(n, [n.shape[0], n.shape[1]]), f = v(p, a);
108
+ const p = l(s, [1, -1]), a = l(n, [n.shape[0], n.shape[1]]), f = k(p, a);
109
109
  return l(f, [f.size]);
110
110
  } else if (s.rank === 2 && n.rank === 1) {
111
- const p = l(n, [-1, 1]), a = v(s, p);
111
+ const p = l(n, [-1, 1]), a = k(s, p);
112
112
  return l(a, [a.size]);
113
113
  } else {
114
114
  const p = l(n, [n.shape[0], n.shape[1]]);
115
- return v(s, p);
115
+ return k(s, p);
116
116
  }
117
117
  }
118
118
  const gs = /* @__PURE__ */ u({ dot_: xs });
119
119
  function $s(t, o = null, s = !1) {
120
- return L(t, "euclidean", o, s);
120
+ return Q(t, "euclidean", o, s);
121
121
  }
122
122
  const bs = /* @__PURE__ */ u({ euclideanNorm_: $s });
123
- function ks(t) {
123
+ function vs(t) {
124
124
  const s = { x: h(t, "x", "expm1") };
125
125
  return d.runKernel(lt, s);
126
126
  }
127
- const vs = /* @__PURE__ */ u({ expm1_: ks });
127
+ const ks = /* @__PURE__ */ u({ expm1_: vs });
128
128
  function Ns(t) {
129
129
  const s = { x: h(t, "x", "isFinite") };
130
130
  return d.runKernel(dt, s);
@@ -152,7 +152,7 @@ function Ks(t, o = 5, s = 1, n = 1, e = 0.5) {
152
152
  const zs = /* @__PURE__ */ u({ localResponseNormalization_: Ks });
153
153
  function Ps(t) {
154
154
  const o = h(t, "x", "logSigmoid");
155
- return wt((n) => ({ value: N(R(N(n))), gradFunc: (p) => M(p, J(N(n))) }))(o);
155
+ return wt((n) => ({ value: N(R(N(n))), gradFunc: (p) => M(p, Y(N(n))) }))(o);
156
156
  }
157
157
  const Cs = /* @__PURE__ */ u({ logSigmoid_: Ps });
158
158
  function Ms(t, o) {
@@ -188,8 +188,8 @@ function Fs(t, o, s, n, e, i, p) {
188
188
  const c = xo(f.shape, o, i, e, n), m = [c.dilationHeight, c.dilationWidth];
189
189
  let I;
190
190
  n === "same" ? I = js([c.filterHeight, c.filterWidth], m) : I = [[0, 0], [0, 0]];
191
- const w = m[0] === 1 && m[1] === 1, [x, g] = Ws([c.inHeight, c.inWidth], m, I), b = w ? n : "valid", O = w ? f : G(f, m, x), A = (s === "avg" ? () => Z(O, o, i, b, p) : () => U(O, o, i, b, p))(), k = w ? A : V(A, m, g);
192
- return y ? l(k, [k.shape[1], k.shape[2], k.shape[3]]) : k;
191
+ const w = m[0] === 1 && m[1] === 1, [x, g] = Ws([c.inHeight, c.inWidth], m, I), b = w ? n : "valid", O = w ? f : G(f, m, x), A = (s === "avg" ? () => Z(O, o, i, b, p) : () => J(O, o, i, b, p))(), v = w ? A : V(A, m, g);
192
+ return y ? l(v, [v.shape[1], v.shape[2], v.shape[3]]) : v;
193
193
  }
194
194
  function Ws(t, o, s) {
195
195
  const n = s.map((c) => c[0]), e = s.map((c) => c[1]), i = t.concat(n, e), p = o.map((c, m) => (c - i[m] % c) % c), a = e.map((c, m) => c + p[m]), f = o.map((c, m) => [n[m], a[m]]), y = o.map((c, m) => [0, p[m]]);
@@ -212,31 +212,31 @@ function Vs(t) {
212
212
  return d.runKernel(bt, s);
213
213
  }
214
214
  const Zs = /* @__PURE__ */ u({ reciprocal_: Vs });
215
- function Us(t) {
215
+ function Js(t) {
216
216
  const s = { x: h(t, "x", "sign") };
217
- return d.runKernel(kt, s);
217
+ return d.runKernel(vt, s);
218
218
  }
219
- const Ys = /* @__PURE__ */ u({ sign_: Us });
220
- function Js(t) {
219
+ const Us = /* @__PURE__ */ u({ sign_: Js });
220
+ function Ys(t) {
221
221
  D(t.dtype === "complex64", () => `The dtype for tf.spectral.fft() must be complex64 but got ${t.dtype}.`);
222
222
  const o = { input: t };
223
- return d.runKernel(vt, o);
223
+ return d.runKernel(kt, o);
224
224
  }
225
- const ot = /* @__PURE__ */ u({ fft_: Js });
226
- function Ls(t) {
225
+ const ot = /* @__PURE__ */ u({ fft_: Ys });
226
+ function Qs(t) {
227
227
  D(t.dtype === "complex64", () => `The dtype for tf.spectral.ifft() must be complex64 but got ${t.dtype}.`);
228
228
  const o = { input: t };
229
229
  return d.runKernel(Nt, o);
230
230
  }
231
- const P = /* @__PURE__ */ u({ ifft_: Ls });
232
- function Qs(t) {
231
+ const P = /* @__PURE__ */ u({ ifft_: Qs });
232
+ function Ls(t) {
233
233
  const o = t.shape[t.shape.length - 1], s = t.size / o;
234
234
  let n;
235
235
  if (o <= 2) {
236
236
  const e = l(t, [s, o]);
237
237
  n = P(e);
238
238
  } else {
239
- const e = [s, 2 * (o - 1)], i = l(K(t), [s, o]), p = l(Q(t), [s, o]), a = E(T(i, [0, 1], [s, o - 2]), 1), f = M(E(T(p, [0, 1], [s, o - 2]), 1), _t(-1)), y = _([i, a], 1), c = _([p, f], 1), m = l(q(y, c), [e[0], e[1]]);
239
+ const e = [s, 2 * (o - 1)], i = l(K(t), [s, o]), p = l(L(t), [s, o]), a = E(T(i, [0, 1], [s, o - 2]), 1), f = M(E(T(p, [0, 1], [s, o - 2]), 1), _t(-1)), y = _([i, a], 1), c = _([p, f], 1), m = l(q(y, c), [e[0], e[1]]);
240
240
  n = P(m);
241
241
  }
242
242
  if (n = K(n), t.rank === 3 && t.shape[0] !== 0) {
@@ -245,7 +245,7 @@ function Qs(t) {
245
245
  }
246
246
  return n;
247
247
  }
248
- const tr = /* @__PURE__ */ u({ irfft_: Qs });
248
+ const tr = /* @__PURE__ */ u({ irfft_: Ls });
249
249
  function or(t, o) {
250
250
  D(t.dtype === "float32", () => `The dtype for rfft() must be real value but got ${t.dtype}`);
251
251
  let s = t.shape[t.shape.length - 1];
@@ -259,7 +259,7 @@ function or(t, o) {
259
259
  x[t.shape.length - 1] = o - s, e = _([t, Ro(x)], t.shape.length - 1), s = o;
260
260
  } else
261
261
  e = t;
262
- const i = C(e), p = l(q(e, i), [n, s]), a = ot(p), f = Math.floor(s / 2) + 1, y = K(a), c = Q(a), m = z(y, [f, s - f], y.shape.length - 1), I = z(c, [f, s - f], c.shape.length - 1), w = e.shape.slice();
262
+ const i = C(e), p = l(q(e, i), [n, s]), a = ot(p), f = Math.floor(s / 2) + 1, y = K(a), c = L(a), m = z(y, [f, s - f], y.shape.length - 1), I = z(c, [f, s - f], c.shape.length - 1), w = e.shape.slice();
263
263
  return w[e.shape.length - 1] = f, l(q(m[0], I[0]), w);
264
264
  }
265
265
  const sr = /* @__PURE__ */ u({ rfft_: or });
@@ -306,10 +306,10 @@ r().prototype.abs = function() {
306
306
  return this.throwIfDisposed(), Kt(this);
307
307
  };
308
308
  r().prototype.acos = function() {
309
- return this.throwIfDisposed(), Jo(this);
309
+ return this.throwIfDisposed(), Yo(this);
310
310
  };
311
311
  r().prototype.acosh = function() {
312
- return this.throwIfDisposed(), Qo(this);
312
+ return this.throwIfDisposed(), Lo(this);
313
313
  };
314
314
  r().prototype.add = function(t) {
315
315
  return this.throwIfDisposed(), zt(this, t);
@@ -402,16 +402,16 @@ r().prototype.cosh = function() {
402
402
  return this.throwIfDisposed(), Zt(this);
403
403
  };
404
404
  r().prototype.cumprod = function(t, o, s) {
405
- return this.throwIfDisposed(), Ut(this, t, o, s);
405
+ return this.throwIfDisposed(), Jt(this, t, o, s);
406
406
  };
407
407
  r().prototype.cumsum = function(t, o, s) {
408
- return this.throwIfDisposed(), Yt(this, t, o, s);
408
+ return this.throwIfDisposed(), Ut(this, t, o, s);
409
409
  };
410
410
  r().prototype.depthToSpace = function(t, o) {
411
411
  return this.throwIfDisposed(), ms(this, t, o);
412
412
  };
413
413
  r().prototype.depthwiseConv2d = function(t, o, s, n, e, i) {
414
- return this.throwIfDisposed(), Jt(this, t, o, s, n, e, i);
414
+ return this.throwIfDisposed(), Yt(this, t, o, s, n, e, i);
415
415
  };
416
416
  r().prototype.dilation2d = function(t, o, s, n, e) {
417
417
  return this.throwIfDisposed(), ys(this, t, o, s, n, e);
@@ -432,7 +432,7 @@ r().prototype.equal = function(t) {
432
432
  return this.throwIfDisposed(), j(this, t);
433
433
  };
434
434
  r().prototype.erf = function() {
435
- return this.throwIfDisposed(), Lt(this);
435
+ return this.throwIfDisposed(), Qt(this);
436
436
  };
437
437
  r().prototype.euclideanNorm = function(t, o) {
438
438
  return this.throwIfDisposed(), bs(this, t, o);
@@ -444,7 +444,7 @@ r().prototype.expandDims = function(t) {
444
444
  return this.throwIfDisposed(), Ao(this, t);
445
445
  };
446
446
  r().prototype.expm1 = function() {
447
- return this.throwIfDisposed(), vs(this);
447
+ return this.throwIfDisposed(), ks(this);
448
448
  };
449
449
  r().prototype.fft = function() {
450
450
  return this.throwIfDisposed(), ot(this);
@@ -498,7 +498,7 @@ r().prototype.logSigmoid = function() {
498
498
  return this.throwIfDisposed(), Cs(this);
499
499
  };
500
500
  r().prototype.logSoftmax = function(t) {
501
- return this.throwIfDisposed(), Qt(this, t);
501
+ return this.throwIfDisposed(), Lt(this, t);
502
502
  };
503
503
  r().prototype.logSumExp = function(t, o) {
504
504
  return this.throwIfDisposed(), lo(this, t, o);
@@ -522,10 +522,10 @@ r().prototype.logicalXor = function(t) {
522
522
  return this.throwIfDisposed(), As(this, t);
523
523
  };
524
524
  r().prototype.matMul = function(t, o, s) {
525
- return this.throwIfDisposed(), v(this, t, o, s);
525
+ return this.throwIfDisposed(), k(this, t, o, s);
526
526
  };
527
527
  r().prototype.maxPool = function(t, o, s, n) {
528
- return this.throwIfDisposed(), U(this, t, o, s, n);
528
+ return this.throwIfDisposed(), J(this, t, o, s, n);
529
529
  };
530
530
  r().prototype.max = function(t, o) {
531
531
  return this.throwIfDisposed(), Do(this, t, o);
@@ -555,7 +555,7 @@ r().prototype.neg = function() {
555
555
  return this.throwIfDisposed(), N(this);
556
556
  };
557
557
  r().prototype.norm = function(t, o, s) {
558
- return this.throwIfDisposed(), L(this, t, o, s);
558
+ return this.throwIfDisposed(), Q(this, t, o, s);
559
559
  };
560
560
  r().prototype.notEqual = function(t) {
561
561
  return this.throwIfDisposed(), Io(this, t);
@@ -588,7 +588,7 @@ r().prototype.relu = function() {
588
588
  return this.throwIfDisposed(), jo(this);
589
589
  };
590
590
  r().prototype.relu6 = function() {
591
- return this.throwIfDisposed(), ko(this);
591
+ return this.throwIfDisposed(), vo(this);
592
592
  };
593
593
  r().prototype.reshapeAs = function(t) {
594
594
  return this.throwIfDisposed(), l(this, t.shape);
@@ -621,10 +621,10 @@ r().prototype.separableConv2d = function(t, o, s, n, e, i) {
621
621
  return this.throwIfDisposed(), eo(this, t, o, s, n, e, i);
622
622
  };
623
623
  r().prototype.sigmoid = function() {
624
- return this.throwIfDisposed(), J(this);
624
+ return this.throwIfDisposed(), Y(this);
625
625
  };
626
626
  r().prototype.sign = function() {
627
- return this.throwIfDisposed(), Ys(this);
627
+ return this.throwIfDisposed(), Us(this);
628
628
  };
629
629
  r().prototype.sin = function() {
630
630
  return this.throwIfDisposed(), io(this);
@@ -665,7 +665,7 @@ r().prototype.stack = function(t, o) {
665
665
  return Vo(s, o);
666
666
  };
667
667
  r().prototype.step = function(t) {
668
- return this.throwIfDisposed(), vo(this, t);
668
+ return this.throwIfDisposed(), ko(this, t);
669
669
  };
670
670
  r().prototype.stridedSlice = function(t, o, s, n, e, i, p, a) {
671
671
  return this.throwIfDisposed(), nr(this, t, o, s, n, e, i, p, a);
@@ -683,7 +683,7 @@ r().prototype.tanh = function() {
683
683
  return this.throwIfDisposed(), ao(this);
684
684
  };
685
685
  r().prototype.tile = function(t) {
686
- return this.throwIfDisposed(), Uo(this, t);
686
+ return this.throwIfDisposed(), Jo(this, t);
687
687
  };
688
688
  r().prototype.toBool = function() {
689
689
  return this.throwIfDisposed(), $(this, "bool");
@@ -710,7 +710,7 @@ r().prototype.unstack = function(t) {
710
710
  return this.throwIfDisposed(), Oo(this, t);
711
711
  };
712
712
  r().prototype.where = function(t, o) {
713
- return this.throwIfDisposed(), Y(t, this, o);
713
+ return this.throwIfDisposed(), U(t, this, o);
714
714
  };
715
715
  r().prototype.zerosLike = function() {
716
716
  return this.throwIfDisposed(), C(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/nanogpt",
3
- "version": "0.17.4",
3
+ "version": "0.18.0",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -33,7 +33,7 @@
33
33
  "@types/papaparse": "^5.3.16",
34
34
  "@types/picomatch": "^4.0.2",
35
35
  "@types/yargs": "^17.0.33",
36
- "@vitest/coverage-v8": "^3.2.4",
36
+ "@vitest/coverage-v8": "^4.1.8",
37
37
  "chalk": "^5.4.1",
38
38
  "dayjs": "^1.11.13",
39
39
  "eslint": "^9.32.0",
@@ -45,7 +45,7 @@
45
45
  "vite": "^7.3.0",
46
46
  "vite-plugin-dts": "^4.5.4",
47
47
  "vite-plugin-node-polyfills": "^0.26.0",
48
- "vitest": "^3.2.4",
48
+ "vitest": "^4.1.8",
49
49
  "webgpu": "^0.3.8",
50
50
  "yargs": "^18.0.0"
51
51
  },
@@ -1,11 +0,0 @@
1
- import { o as c, q as s, a6 as n, E as m, a7 as r } from "./index-CUXkjxiT.js";
2
- function l(o, p) {
3
- const a = s(o, "real", "complex"), e = s(p, "imag", "complex");
4
- n(a.shape, e.shape, `real and imag shapes, ${a.shape} and ${e.shape}, must match in call to tf.complex().`);
5
- const t = { real: a, imag: e };
6
- return m.runKernel(r, t);
7
- }
8
- const i = /* @__PURE__ */ c({ complex_: l });
9
- export {
10
- i as c
11
- };
@@ -1,11 +0,0 @@
1
- import { o as m, q as s, B as c, E as M, D as p } from "./index-CUXkjxiT.js";
2
- function f(e, o, n = !1, l = !1) {
3
- let a = s(e, "a", "matMul"), t = s(o, "b", "matMul");
4
- [a, t] = c(a, t);
5
- const r = { a, b: t }, u = { transposeA: n, transposeB: l };
6
- return M.runKernel(p, r, u);
7
- }
8
- const i = /* @__PURE__ */ m({ matMul_: f });
9
- export {
10
- i as m
11
- };
@@ -1,11 +0,0 @@
1
- import { o as r, q as s, B as m, E as c, M as d } from "./index-CUXkjxiT.js";
2
- function p(t, e) {
3
- let o = s(t, "a", "mod"), a = s(e, "b", "mod");
4
- [o, a] = m(o, a);
5
- const n = { a: o, b: a };
6
- return c.runKernel(d, n);
7
- }
8
- const b = /* @__PURE__ */ r({ mod_: p });
9
- export {
10
- b as m
11
- };
@@ -1,9 +0,0 @@
1
- import { o as n, q as e, E as s, H as t } from "./index-CUXkjxiT.js";
2
- function u(r) {
3
- const o = { x: e(r, "x", "relu") };
4
- return s.runKernel(t, o);
5
- }
6
- const l = /* @__PURE__ */ n({ relu_: u });
7
- export {
8
- l as r
9
- };
@@ -1,12 +0,0 @@
1
- import { o as c, q as e, E as a, S as l } from "./index-CUXkjxiT.js";
2
- function p(r, n, o) {
3
- const s = e(r, "x", "slice", "string_or_numeric");
4
- if (s.rank === 0)
5
- throw new Error("Slicing scalar is not possible");
6
- const t = { x: s }, i = { begin: n, size: o };
7
- return a.runKernel(l, t, i);
8
- }
9
- const x = /* @__PURE__ */ c({ slice_: p });
10
- export {
11
- x as s
12
- };
@@ -1,9 +0,0 @@
1
- import { o as p, q as i, E as a, J as c } from "./index-CUXkjxiT.js";
2
- function e(t, s, o = 0) {
3
- const n = { x: i(t, "x", "split") }, r = { numOrSizeSplits: s, axis: o };
4
- return a.runKernel(c, n, r);
5
- }
6
- const u = /* @__PURE__ */ p({ split_: e });
7
- export {
8
- u as s
9
- };