@genai-fi/nanogpt 0.10.3 → 0.11.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 (225) hide show
  1. package/dist/Generator.d.ts +10 -5
  2. package/dist/Generator.js +1789 -1765
  3. package/dist/{RealDiv-KAPDe8zB.js → RealDiv-Ds-jvL09.js} +22 -22
  4. package/dist/{Reshape-BYkmUnAv.js → Reshape-Cd6e-Otn.js} +1 -1
  5. package/dist/{Reshape-Zt6eb7yh.js → Reshape-Ct266DEk.js} +9 -9
  6. package/dist/TeachableLLM.d.ts +4 -3
  7. package/dist/TeachableLLM.js +14 -14
  8. package/dist/Trainer.d.ts +2 -2
  9. package/dist/Trainer.js +6 -6
  10. package/dist/{axis_util-BaG7mf5A.js → axis_util-DofAuy0p.js} +3 -3
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-RCe-rHaj.js → backend_util-C7NWHpv7.js} +7 -7
  13. package/dist/{backend_webgpu-DE3ACOLx.js → backend_webgpu-B0Vls736.js} +10 -10
  14. package/dist/{broadcast_to-B3eYlZm7.js → broadcast_to-DDaNMbX7.js} +2 -2
  15. package/dist/checks/appendCache.js +2 -2
  16. package/dist/checks/attentionMask.js +3 -3
  17. package/dist/checks/gelu.js +2 -2
  18. package/dist/checks/matMulGelu.js +2 -2
  19. package/dist/checks/normRMS.js +4 -4
  20. package/dist/checks/normRMSGrad.js +3 -3
  21. package/dist/checks/packUnpack.js +2 -2
  22. package/dist/checks/qkv.js +4 -4
  23. package/dist/checks/rope.js +2 -2
  24. package/dist/{clip_by_value-BnO7-a88.js → clip_by_value-Dn5tzexi.js} +4 -4
  25. package/dist/complex-DClmWqJt.js +11 -0
  26. package/dist/{concat-BV8bt5H-.js → concat-C6X3AAlQ.js} +1 -1
  27. package/dist/{concat_util-DpW8mL_l.js → concat_util-CHsJFZJJ.js} +1 -1
  28. package/dist/{dataset-BcwmTGYc.js → dataset-DcjWqUVQ.js} +7 -7
  29. package/dist/{dropout-BcvN9JYi.js → dropout-OxuaJz6z.js} +11 -11
  30. package/dist/{expand_dims-DT4tEPwA.js → expand_dims-BzfJK2uc.js} +3 -3
  31. package/dist/{exports_initializers-Hta_rEnm.js → exports_initializers-eS9QJ6ut.js} +1 -1
  32. package/dist/{floor-D5QdR_le.js → floor-DIb-lN_u.js} +1 -1
  33. package/dist/gather-BcO5UQNJ.js +9 -0
  34. package/dist/{gelu-CjNPL4OH.js → gelu-DqTbCx5x.js} +1 -1
  35. package/dist/{gpgpu_math-DAOmgtXR.js → gpgpu_math-CJcbnKPC.js} +2 -2
  36. package/dist/{index-DOvlwCh-.js → index-D0RBWjq8.js} +52 -52
  37. package/dist/{index-BwexR4lA.js → index-Dj5TkmPY.js} +89 -89
  38. package/dist/{kernel_funcs_utils-CCzYdUZg.js → kernel_funcs_utils-CSaumNDs.js} +11 -11
  39. package/dist/layers/BaseLayer.js +2 -2
  40. package/dist/layers/CausalSelfAttention.js +6 -6
  41. package/dist/layers/MLP.js +4 -4
  42. package/dist/layers/PositionEmbedding.js +5 -5
  43. package/dist/layers/RMSNorm.js +3 -3
  44. package/dist/layers/RoPECache.js +4 -4
  45. package/dist/layers/TiedEmbedding.js +6 -6
  46. package/dist/layers/TransformerBlock.js +1 -1
  47. package/dist/loader/loadTransformers.js +1 -1
  48. package/dist/loader/oldZipLoad.js +17 -17
  49. package/dist/log_sum_exp-VLZgbFAH.js +39 -0
  50. package/dist/main.d.ts +1 -1
  51. package/dist/main.js +9 -9
  52. package/dist/{matMul16-BWRSOCWB.js → matMul16-cDxwemKj.js} +7 -7
  53. package/dist/{matMulGelu-CzfgT6Wq.js → matMulGelu-B2s_80-H.js} +18 -18
  54. package/dist/{mat_mul-SjpJRLyL.js → mat_mul-DxpNTCRz.js} +3 -3
  55. package/dist/{mod-AnXEvvpo.js → mod-PrOKlFxH.js} +1 -1
  56. package/dist/models/NanoGPTV1.js +2 -2
  57. package/dist/models/model.js +9 -9
  58. package/dist/{ones-D2rT0xk2.js → ones-BX_wEgzB.js} +3 -3
  59. package/dist/ops/adamAdjust.js +1 -1
  60. package/dist/ops/adamMoments.js +1 -1
  61. package/dist/ops/add16.js +1 -1
  62. package/dist/ops/appendCache.js +3 -3
  63. package/dist/ops/attentionMask.js +1 -1
  64. package/dist/ops/concat16.js +2 -2
  65. package/dist/ops/cpu/adamAdjust.js +6 -6
  66. package/dist/ops/cpu/adamMoments.js +2 -2
  67. package/dist/ops/cpu/appendCache.js +5 -5
  68. package/dist/ops/cpu/attentionMask.js +10 -10
  69. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  70. package/dist/ops/cpu/gatherSub.js +6 -6
  71. package/dist/ops/cpu/gelu.js +9 -9
  72. package/dist/ops/cpu/matMul16.js +2 -2
  73. package/dist/ops/cpu/matMulGelu.js +3 -3
  74. package/dist/ops/cpu/matMulMul.js +1 -1
  75. package/dist/ops/cpu/mulDropout.js +1 -1
  76. package/dist/ops/cpu/normRMS.js +3 -3
  77. package/dist/ops/cpu/qkv.js +3 -3
  78. package/dist/ops/cpu/rope.js +9 -9
  79. package/dist/ops/cpu/scatterSub.js +11 -11
  80. package/dist/ops/dot16.js +2 -2
  81. package/dist/ops/gatherSub.js +1 -1
  82. package/dist/ops/gelu.js +2 -2
  83. package/dist/ops/grads/add16.js +4 -4
  84. package/dist/ops/grads/attentionMask.js +2 -2
  85. package/dist/ops/grads/gelu.js +2 -2
  86. package/dist/ops/grads/matMul16.js +3 -3
  87. package/dist/ops/grads/matMulGelu.js +3 -3
  88. package/dist/ops/grads/normRMS.js +7 -7
  89. package/dist/ops/grads/pack16.js +3 -3
  90. package/dist/ops/grads/qkv.js +6 -6
  91. package/dist/ops/grads/rope.js +2 -2
  92. package/dist/ops/grads/softmax16.js +1 -1
  93. package/dist/ops/grads/unpack16.js +2 -2
  94. package/dist/ops/matMul16.js +3 -3
  95. package/dist/ops/matMulGelu.js +2 -2
  96. package/dist/ops/matMulMul.js +1 -1
  97. package/dist/ops/mul16.js +1 -1
  98. package/dist/ops/mulDrop.js +1 -1
  99. package/dist/ops/normRMS.js +1 -1
  100. package/dist/ops/pack16.js +2 -2
  101. package/dist/ops/qkv.js +1 -1
  102. package/dist/ops/reshape16.js +6 -6
  103. package/dist/ops/rope.js +2 -2
  104. package/dist/ops/scatterSub.js +1 -1
  105. package/dist/ops/slice16.js +2 -2
  106. package/dist/ops/softmax16.js +1 -1
  107. package/dist/ops/sub16.js +1 -1
  108. package/dist/ops/sum16.js +2 -2
  109. package/dist/ops/transpose16.js +3 -3
  110. package/dist/ops/unpack16.js +2 -2
  111. package/dist/ops/webgl/adamAdjust.js +2 -2
  112. package/dist/ops/webgl/adamMoments.js +1 -1
  113. package/dist/ops/webgl/appendCache.js +1 -1
  114. package/dist/ops/webgl/attentionMask.js +4 -4
  115. package/dist/ops/webgl/fusedSoftmax.js +6 -6
  116. package/dist/ops/webgl/gatherSub.js +1 -1
  117. package/dist/ops/webgl/gelu.js +2 -2
  118. package/dist/ops/webgl/log.js +3 -3
  119. package/dist/ops/webgl/matMul16.js +11 -11
  120. package/dist/ops/webgl/matMulGelu.js +4 -4
  121. package/dist/ops/webgl/matMulMul.js +7 -7
  122. package/dist/ops/webgl/mulDropout.js +1 -1
  123. package/dist/ops/webgl/normRMS.js +7 -7
  124. package/dist/ops/webgl/qkv.js +1 -1
  125. package/dist/ops/webgl/rope.js +4 -4
  126. package/dist/ops/webgl/scatterSub.js +1 -1
  127. package/dist/ops/webgpu/adamAdjust.js +3 -3
  128. package/dist/ops/webgpu/adamMoments.js +3 -3
  129. package/dist/ops/webgpu/add16.js +1 -1
  130. package/dist/ops/webgpu/appendCache.js +3 -3
  131. package/dist/ops/webgpu/attentionMask.js +5 -5
  132. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  133. package/dist/ops/webgpu/concat16.js +5 -5
  134. package/dist/ops/webgpu/gatherSub.js +5 -5
  135. package/dist/ops/webgpu/gelu.js +3 -3
  136. package/dist/ops/webgpu/matMul16.js +18 -18
  137. package/dist/ops/webgpu/matMul16_program.js +2 -2
  138. package/dist/ops/webgpu/mul16.js +4 -4
  139. package/dist/ops/webgpu/normRMS.js +6 -6
  140. package/dist/ops/webgpu/normRMSGrad.js +4 -4
  141. package/dist/ops/webgpu/pack16.js +1 -1
  142. package/dist/ops/webgpu/pack16_program.js +2 -2
  143. package/dist/ops/webgpu/qkv.js +6 -6
  144. package/dist/ops/webgpu/rope.js +3 -3
  145. package/dist/ops/webgpu/scatterSub.js +3 -3
  146. package/dist/ops/webgpu/slice16.js +4 -4
  147. package/dist/ops/webgpu/softmax16.js +2 -2
  148. package/dist/ops/webgpu/softmax16_program.js +2 -2
  149. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  150. package/dist/ops/webgpu/softmax16grad.js +1 -1
  151. package/dist/ops/webgpu/sub16.js +4 -4
  152. package/dist/ops/webgpu/sum16.js +6 -6
  153. package/dist/ops/webgpu/transpose16.js +2 -2
  154. package/dist/ops/webgpu/transpose16_program.js +2 -2
  155. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  156. package/dist/ops/webgpu/unpack16.js +3 -3
  157. package/dist/ops/webgpu/utils/binary_op.js +3 -3
  158. package/dist/ops/webgpu/utils/reductions.js +4 -4
  159. package/dist/{ops-B5yanEdW.js → ops-FJapAPfm.js} +56 -56
  160. package/dist/{pack16-nQ6JaLo-.js → pack16-k4jq6aMX.js} +7 -7
  161. package/dist/patches/webgpu_backend.js +7 -7
  162. package/dist/patches/webgpu_base.js +1 -1
  163. package/dist/patches/webgpu_program.js +8 -8
  164. package/dist/{random_width-or-CEftb.js → random_width-UGQn4OWb.js} +33 -33
  165. package/dist/range-CuGvVN2c.js +10 -0
  166. package/dist/{relu-CP0ZcxWO.js → relu-Cf80uA2p.js} +1 -1
  167. package/dist/{reshape-ByE68wS9.js → reshape-CkjKPPqB.js} +1 -1
  168. package/dist/{resize_nearest_neighbor-B19mCEg2.js → resize_nearest_neighbor-DB8k9KN_.js} +43 -43
  169. package/dist/{rope-Ir4mTyD1.js → rope-BmZmp9uP.js} +1 -1
  170. package/dist/{scatter_nd_util-lvSiX8q4.js → scatter_nd_util-BY22Cc-C.js} +1 -1
  171. package/dist/{selu_util-kbhpTdYD.js → selu_util-BuLbmbrl.js} +5 -5
  172. package/dist/{shared-DT1TkE6w.js → shared-B7USJZgw.js} +1 -1
  173. package/dist/{shared-dntlHIDQ.js → shared-BQboIImQ.js} +86 -86
  174. package/dist/{slice-BfEGSH82.js → slice-Aqy7KbJh.js} +3 -3
  175. package/dist/{slice_util-uTKwiEpW.js → slice_util-D8CQRenR.js} +7 -7
  176. package/dist/{softmax-CA5jFsLR.js → softmax-faLoUZVT.js} +1 -1
  177. package/dist/{split-CVLc0w--.js → split-BNz5jcGc.js} +3 -3
  178. package/dist/{squeeze-C7Z2srUo.js → squeeze--YMgaAAf.js} +2 -2
  179. package/dist/{stack-Cf4n9h0N.js → stack-WJK22CFn.js} +1 -1
  180. package/dist/{step-CINUs5QB.js → step-dXR33iOg.js} +32 -32
  181. package/dist/sum-BdplSvq_.js +11 -0
  182. package/dist/tensor-BQqrDvpx.js +8 -0
  183. package/dist/tensor1d-LxP9asMm.js +11 -0
  184. package/dist/{tensor2d-Bs9wZRc7.js → tensor2d-BN1sSfQO.js} +3 -3
  185. package/dist/{tensor4d-BARPdTaS.js → tensor4d-DVwr7pLF.js} +1 -1
  186. package/dist/{tfjs_backend-y1cvNhLA.js → tfjs_backend-Vi4JfLzT.js} +28 -28
  187. package/dist/{tile-mbfagpsB.js → tile-CvN_LyVr.js} +4 -4
  188. package/dist/tokeniser/BaseTokeniser.d.ts +27 -0
  189. package/dist/tokeniser/BaseTokeniser.js +94 -0
  190. package/dist/tokeniser/CharTokeniser.d.ts +4 -3
  191. package/dist/tokeniser/CharTokeniser.js +46 -32
  192. package/dist/tokeniser/bpe.d.ts +4 -3
  193. package/dist/tokeniser/bpe.js +60 -45
  194. package/dist/tokeniser/type.d.ts +11 -0
  195. package/dist/training/Adam.js +2 -2
  196. package/dist/training/AdamExt.js +1 -1
  197. package/dist/training/DatasetBuilder.d.ts +2 -2
  198. package/dist/training/DatasetBuilder.js +32 -36
  199. package/dist/training/FullTrainer.js +1 -1
  200. package/dist/training/Trainer.d.ts +3 -3
  201. package/dist/training/Trainer.js +2 -2
  202. package/dist/training/sparseCrossEntropy.js +3 -3
  203. package/dist/{transpose-ClWiBS_b.js → transpose-JawVKyZy.js} +5 -5
  204. package/dist/{unsorted_segment_sum-BDDhB_E6.js → unsorted_segment_sum-LAbmE9G4.js} +78 -78
  205. package/dist/utilities/dummy.js +3 -3
  206. package/dist/utilities/multinomialCPU.js +2 -2
  207. package/dist/utilities/packed.js +1 -1
  208. package/dist/utilities/performance.js +1 -1
  209. package/dist/utilities/profile.js +1 -1
  210. package/dist/utilities/safetensors.js +2 -2
  211. package/dist/utilities/sentences.js +5 -5
  212. package/dist/utilities/weights.js +2 -2
  213. package/dist/{variable-WawDEaAb.js → variable-DQ9yYgEU.js} +1 -1
  214. package/dist/{webgpu_program-DuOXPQol.js → webgpu_program-CAE4RICo.js} +3 -3
  215. package/dist/{webgpu_util-RxEF33Rj.js → webgpu_util-BdovYhXr.js} +1 -1
  216. package/dist/{zeros-KnWaWf-X.js → zeros-DeiE2zTa.js} +2 -2
  217. package/dist/{zeros_like-DvE73F4e.js → zeros_like-BAz3iKru.js} +77 -77
  218. package/package.json +1 -1
  219. package/dist/complex-DjxcVmoX.js +0 -11
  220. package/dist/gather-D3JcZUaI.js +0 -9
  221. package/dist/log_sum_exp-ngO0-4pK.js +0 -39
  222. package/dist/range-BklejeeW.js +0 -10
  223. package/dist/sum-DWAtNGez.js +0 -11
  224. package/dist/tensor-DJoc7gJU.js +0 -8
  225. package/dist/tensor1d-D11P_7Dp.js +0 -11
@@ -1,38 +1,38 @@
1
- import { A as u, B as h, E as d, c9 as st, ca as rt, cb as nt, cc as et, cd as it, ce as pt, L as B, cf as at, cg as ht, b_ as ut, l as D, ch as ct, ci as ft, w as H, a7 as C, b$ as lt, cj as dt, ck as mt, cl as Dt, aG as yt, cm as It, a6 as wt, m as A, a3 as F, cn as xt, co as gt, X as $, c3 as $t, cp as bt, cq as kt, cr as vt, cs as Nt, b as _t, ct as Tt, cu as Et, cv as St, cw as qt, cx as r, aZ as zt, x as Kt, a8 as W, cy as Pt, cz as Ct, z as At, y as Mt, b0 as Ot, c as Bt } from "./index-DOvlwCh-.js";
2
- import { e as j, a as R, l as X, b as G, d as V, m as Z, f 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 Jt, u as Lt, v as Qt, w as Yt, 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-BDDhB_E6.js";
3
- import { r as l } from "./reshape-ByE68wS9.js";
4
- import { b as uo } from "./broadcast_to-B3eYlZm7.js";
5
- import { c as co } from "./clip_by_value-BnO7-a88.js";
6
- import { c as _ } from "./concat-BV8bt5H-.js";
7
- import { w as J, n as L, b as S, c as fo, g as lo, l as mo, a as Do, f as yo, d as Io, j as wo, m as xo, e as go, i as $o, h as bo, r as ko, s as vo, u as No } from "./resize_nearest_neighbor-B19mCEg2.js";
8
- import { m as v } from "./mat_mul-SjpJRLyL.js";
9
- import { s as Q, k as _o, h as To, e as Eo, l as So, p as qo, r as zo, a as Ko } from "./step-CINUs5QB.js";
10
- import { e as Po, l as Co, a as Ao, m as Mo } from "./log_sum_exp-ngO0-4pK.js";
11
- import { e as Oo } from "./expand_dims-DT4tEPwA.js";
12
- import { f as Bo } from "./floor-D5QdR_le.js";
13
- import { g as Ho } from "./gather-D3JcZUaI.js";
14
- import { c as q } from "./complex-DjxcVmoX.js";
15
- import { n as N, r as z, i as Y, t as Fo } from "./transpose-ClWiBS_b.js";
16
- import { s as T } from "./slice-BfEGSH82.js";
17
- import { m as Wo } from "./mod-AnXEvvpo.js";
18
- import { r as jo } from "./relu-CP0ZcxWO.js";
19
- import { s as K } from "./split-CVLc0w--.js";
20
- import { z as Ro } from "./zeros-KnWaWf-X.js";
21
- import { s as Xo } from "./softmax-CA5jFsLR.js";
22
- import { s as Go } from "./squeeze-C7Z2srUo.js";
23
- import { s as Vo } from "./stack-Cf4n9h0N.js";
24
- import { s as Zo } from "./sum-DWAtNGez.js";
25
- import { t as Uo } from "./tile-mbfagpsB.js";
1
+ import { q as u, u as h, E as d, c9 as st, ca as rt, cb as nt, cc as et, cd as it, ce as pt, D as B, cf as at, cg as ht, b_ as ut, y as D, ch as ct, ci as ft, l as H, a3 as C, b$ as lt, cj as dt, ck as mt, cl as Dt, aG as yt, cm as It, a2 as wt, m as M, $ as F, cn as xt, co as gt, N as $, c3 as $t, cp as bt, cq as kt, cr as vt, cs as Nt, b as _t, ct as Tt, cu as Et, cv as St, cw as qt, cx as r, aZ as Kt, n as zt, a4 as W, cy as Pt, cz as Ct, p as Mt, o as Ot, b0 as At, c as Bt } from "./index-D0RBWjq8.js";
2
+ import { e as j, a as R, l as G, b as X, d as V, m as Z, f as U, r as E, g as Ht, h as Ft, i as Wt, j as jt, k as Rt, n as Gt, o as Xt, c as Vt, p as Zt, q as Ut, t as Jt, u as Qt, v as Yt, 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-LAbmE9G4.js";
3
+ import { r as l } from "./reshape-CkjKPPqB.js";
4
+ import { b as uo } from "./broadcast_to-DDaNMbX7.js";
5
+ import { c as co } from "./clip_by_value-Dn5tzexi.js";
6
+ import { c as _ } from "./concat-C6X3AAlQ.js";
7
+ import { w as J, n as Q, b as S, c as fo, g as lo, l as mo, a as Do, f as yo, d as Io, j as wo, m as xo, e as go, i as $o, h as bo, r as ko, s as vo, u as No } from "./resize_nearest_neighbor-DB8k9KN_.js";
8
+ import { m as v } from "./mat_mul-DxpNTCRz.js";
9
+ import { s as Y, k as _o, h as To, e as Eo, l as So, p as qo, r as Ko, a as zo } from "./step-dXR33iOg.js";
10
+ import { e as Po, l as Co, a as Mo, m as Oo } from "./log_sum_exp-VLZgbFAH.js";
11
+ import { e as Ao } from "./expand_dims-BzfJK2uc.js";
12
+ import { f as Bo } from "./floor-DIb-lN_u.js";
13
+ import { g as Ho } from "./gather-BcO5UQNJ.js";
14
+ import { c as q } from "./complex-DClmWqJt.js";
15
+ import { n as N, r as K, i as L, t as Fo } from "./transpose-JawVKyZy.js";
16
+ import { s as T } from "./slice-Aqy7KbJh.js";
17
+ import { m as Wo } from "./mod-PrOKlFxH.js";
18
+ import { r as jo } from "./relu-Cf80uA2p.js";
19
+ import { s as z } from "./split-BNz5jcGc.js";
20
+ import { z as Ro } from "./zeros-DeiE2zTa.js";
21
+ import { s as Go } from "./softmax-faLoUZVT.js";
22
+ import { s as Xo } from "./squeeze--YMgaAAf.js";
23
+ import { s as Vo } from "./stack-WJK22CFn.js";
24
+ import { s as Zo } from "./sum-BdplSvq_.js";
25
+ import { t as Uo } from "./tile-CvN_LyVr.js";
26
26
  function Jo(t) {
27
27
  const s = { x: h(t, "x", "acos") };
28
28
  return d.runKernel(st, s);
29
29
  }
30
- const Lo = /* @__PURE__ */ u({ acos_: Jo });
31
- function Qo(t) {
30
+ const Qo = /* @__PURE__ */ u({ acos_: Jo });
31
+ function Yo(t) {
32
32
  const s = { x: h(t, "x", "acosh") };
33
33
  return d.runKernel(rt, s);
34
34
  }
35
- const Yo = /* @__PURE__ */ u({ acosh_: Qo });
35
+ const Lo = /* @__PURE__ */ u({ acosh_: Yo });
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);
@@ -117,7 +117,7 @@ function xs(t, o) {
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
123
  function ks(t) {
@@ -140,7 +140,7 @@ function Ss(t) {
140
140
  return d.runKernel(Dt, s);
141
141
  }
142
142
  const qs = /* @__PURE__ */ u({ isNaN_: Ss });
143
- function zs(t, o = 5, s = 1, n = 1, e = 0.5) {
143
+ function Ks(t, o = 5, s = 1, n = 1, e = 0.5) {
144
144
  const i = h(t, "x", "localResponseNormalization");
145
145
  D(i.rank === 4 || i.rank === 3, () => `Error in localResponseNormalization: x must be rank 3 or 4 but got
146
146
  rank ${i.rank}.`), D(yt(o), () => `Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${o}.`);
@@ -149,24 +149,24 @@ function zs(t, o = 5, s = 1, n = 1, e = 0.5) {
149
149
  const f = { x: p }, y = { depthRadius: o, bias: s, alpha: n, beta: e }, c = d.runKernel(It, f, y);
150
150
  return a ? l(c, [c.shape[1], c.shape[2], c.shape[3]]) : c;
151
151
  }
152
- const Ks = /* @__PURE__ */ u({ localResponseNormalization_: zs });
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) => A(p, Q(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
- function As(t, o) {
158
+ function Ms(t, o) {
159
159
  const s = h(t, "a", "logicalOr", "bool"), n = h(o, "b", "logicalOr", "bool");
160
160
  F(s.shape, n.shape);
161
161
  const e = { a: s, b: n };
162
162
  return d.runKernel(xt, e);
163
163
  }
164
- const tt = /* @__PURE__ */ u({ logicalOr_: As });
165
- function Ms(t, o) {
164
+ const tt = /* @__PURE__ */ u({ logicalOr_: Ms });
165
+ function Os(t, o) {
166
166
  const s = h(t, "a", "logicalXor", "bool"), n = h(o, "b", "logicalXor", "bool");
167
- return F(s.shape, n.shape), S(tt(t, o), X(S(t, o)));
167
+ return F(s.shape, n.shape), S(tt(t, o), G(S(t, o)));
168
168
  }
169
- const Os = /* @__PURE__ */ u({ logicalXor_: Ms });
169
+ const As = /* @__PURE__ */ u({ logicalXor_: Os });
170
170
  function Bs(t, o, s) {
171
171
  D(s === "reflect" || s === "symmetric", () => `Invalid mode. Mode must be either reflect or symmetric. Got ${s}.`);
172
172
  const n = h(t, "x", "mirrorPad");
@@ -188,7 +188,7 @@ function Fs(t, o, s, n, e, i, p) {
188
188
  const c = To(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", M = w ? f : G(f, m, x), O = (s === "avg" ? () => V(M, o, i, b, p) : () => Z(M, o, i, b, p))(), k = w ? O : U(O, m, g);
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 : X(f, m, x), A = (s === "avg" ? () => V(O, o, i, b, p) : () => Z(O, o, i, b, p))(), k = w ? A : U(A, m, g);
192
192
  return y ? l(k, [k.shape[1], k.shape[2], k.shape[3]]) : k;
193
193
  }
194
194
  function Ws(t, o, s) {
@@ -200,13 +200,13 @@ function js(t, o) {
200
200
  return n.map((p, a) => [e[a], i[a]]);
201
201
  }
202
202
  const Rs = /* @__PURE__ */ u({ pool_: Fs });
203
- function Xs(t, o = null, s = !1) {
203
+ function Gs(t, o = null, s = !1) {
204
204
  let n = h(t, "x", "prod");
205
205
  n.dtype === "bool" && (n = $(n, "int32"));
206
206
  const e = { x: n }, i = { axis: o, keepDims: s };
207
207
  return d.runKernel($t, e, i);
208
208
  }
209
- const Gs = /* @__PURE__ */ u({ prod_: Xs });
209
+ const Xs = /* @__PURE__ */ u({ prod_: Gs });
210
210
  function Vs(t) {
211
211
  const s = { x: h(t, "x", "reciprocal") };
212
212
  return d.runKernel(bt, s);
@@ -217,35 +217,35 @@ function Us(t) {
217
217
  return d.runKernel(kt, s);
218
218
  }
219
219
  const Js = /* @__PURE__ */ u({ sign_: Us });
220
- function Ls(t) {
220
+ function Qs(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
223
  return d.runKernel(vt, o);
224
224
  }
225
- const ot = /* @__PURE__ */ u({ fft_: Ls });
226
- function Qs(t) {
225
+ const ot = /* @__PURE__ */ u({ fft_: Qs });
226
+ function Ys(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_: Qs });
232
- function Ys(t) {
231
+ const P = /* @__PURE__ */ u({ ifft_: Ys });
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(z(t), [s, o]), p = l(Y(t), [s, o]), a = E(T(i, [0, 1], [s, o - 2]), 1), f = A(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
- if (n = z(n), t.rank === 3 && t.shape[0] !== 0) {
242
+ if (n = K(n), t.rank === 3 && t.shape[0] !== 0) {
243
243
  const e = n, i = t.shape[0];
244
244
  n = l(n, [i, n.shape[0] / i, n.shape[1]]), e.dispose();
245
245
  }
246
246
  return n;
247
247
  }
248
- const tr = /* @__PURE__ */ u({ irfft_: Ys });
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 = z(a), c = Y(a), m = K(y, [f, s - f], y.shape.length - 1), I = K(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 });
@@ -303,16 +303,16 @@ function hr(t, o = 0) {
303
303
  }
304
304
  const ur = /* @__PURE__ */ u({ unique_: hr });
305
305
  r().prototype.abs = function() {
306
- return this.throwIfDisposed(), zt(this);
306
+ return this.throwIfDisposed(), Kt(this);
307
307
  };
308
308
  r().prototype.acos = function() {
309
- return this.throwIfDisposed(), Lo(this);
309
+ return this.throwIfDisposed(), Qo(this);
310
310
  };
311
311
  r().prototype.acosh = function() {
312
- return this.throwIfDisposed(), Yo(this);
312
+ return this.throwIfDisposed(), Lo(this);
313
313
  };
314
314
  r().prototype.add = function(t) {
315
- return this.throwIfDisposed(), Kt(this, t);
315
+ return this.throwIfDisposed(), zt(this, t);
316
316
  };
317
317
  r().prototype.all = function(t, o) {
318
318
  return this.throwIfDisposed(), Ht(this, t, o);
@@ -390,10 +390,10 @@ r().prototype.conv1d = function(t, o, s, n, e, i) {
390
390
  return this.throwIfDisposed(), Rt(this, t, o, s, n, e, i);
391
391
  };
392
392
  r().prototype.conv2dTranspose = function(t, o, s, n, e) {
393
- return this.throwIfDisposed(), Xt(this, t, o, s, n, e);
393
+ return this.throwIfDisposed(), Gt(this, t, o, s, n, e);
394
394
  };
395
395
  r().prototype.conv2d = function(t, o, s, n, e, i) {
396
- return this.throwIfDisposed(), Gt(this, t, o, s, n, e, i);
396
+ return this.throwIfDisposed(), Xt(this, t, o, s, n, e, i);
397
397
  };
398
398
  r().prototype.cos = function() {
399
399
  return this.throwIfDisposed(), Vt(this);
@@ -411,7 +411,7 @@ 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(), Lt(this, t, o, s, n, e, i);
414
+ return this.throwIfDisposed(), Qt(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(), Qt(this);
435
+ return this.throwIfDisposed(), Yt(this);
436
436
  };
437
437
  r().prototype.euclideanNorm = function(t, o) {
438
438
  return this.throwIfDisposed(), bs(this, t, o);
@@ -441,7 +441,7 @@ r().prototype.exp = function() {
441
441
  return this.throwIfDisposed(), Po(this);
442
442
  };
443
443
  r().prototype.expandDims = function(t) {
444
- return this.throwIfDisposed(), Oo(this, t);
444
+ return this.throwIfDisposed(), Ao(this, t);
445
445
  };
446
446
  r().prototype.expm1 = function() {
447
447
  return this.throwIfDisposed(), vs(this);
@@ -492,19 +492,19 @@ r().prototype.less = function(t) {
492
492
  return this.throwIfDisposed(), Do(this, t);
493
493
  };
494
494
  r().prototype.localResponseNormalization = function(t, o, s, n) {
495
- return this.throwIfDisposed(), Ks(this, t, o, s, n);
495
+ return this.throwIfDisposed(), zs(this, t, o, s, n);
496
496
  };
497
497
  r().prototype.logSigmoid = function() {
498
498
  return this.throwIfDisposed(), Cs(this);
499
499
  };
500
500
  r().prototype.logSoftmax = function(t) {
501
- return this.throwIfDisposed(), Yt(this, t);
501
+ return this.throwIfDisposed(), Lt(this, t);
502
502
  };
503
503
  r().prototype.logSumExp = function(t, o) {
504
504
  return this.throwIfDisposed(), Co(this, t, o);
505
505
  };
506
506
  r().prototype.log = function() {
507
- return this.throwIfDisposed(), Ao(this);
507
+ return this.throwIfDisposed(), Mo(this);
508
508
  };
509
509
  r().prototype.log1p = function() {
510
510
  return this.throwIfDisposed(), yo(this);
@@ -513,13 +513,13 @@ r().prototype.logicalAnd = function(t) {
513
513
  return this.throwIfDisposed(), S(this, t);
514
514
  };
515
515
  r().prototype.logicalNot = function() {
516
- return this.throwIfDisposed(), X(this);
516
+ return this.throwIfDisposed(), G(this);
517
517
  };
518
518
  r().prototype.logicalOr = function(t) {
519
519
  return this.throwIfDisposed(), tt(this, t);
520
520
  };
521
521
  r().prototype.logicalXor = function(t) {
522
- return this.throwIfDisposed(), Os(this, t);
522
+ return this.throwIfDisposed(), As(this, t);
523
523
  };
524
524
  r().prototype.matMul = function(t, o, s) {
525
525
  return this.throwIfDisposed(), v(this, t, o, s);
@@ -528,7 +528,7 @@ r().prototype.maxPool = function(t, o, s, n) {
528
528
  return this.throwIfDisposed(), Z(this, t, o, s, n);
529
529
  };
530
530
  r().prototype.max = function(t, o) {
531
- return this.throwIfDisposed(), Mo(this, t, o);
531
+ return this.throwIfDisposed(), Oo(this, t, o);
532
532
  };
533
533
  r().prototype.maximum = function(t) {
534
534
  return this.throwIfDisposed(), Ct(this, t);
@@ -549,13 +549,13 @@ r().prototype.mod = function(t) {
549
549
  return this.throwIfDisposed(), Wo(this, t);
550
550
  };
551
551
  r().prototype.mul = function(t) {
552
- return this.throwIfDisposed(), A(this, t);
552
+ return this.throwIfDisposed(), M(this, t);
553
553
  };
554
554
  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(), go(this, t);
@@ -573,13 +573,13 @@ r().prototype.pool = function(t, o, s, n, e, i) {
573
573
  return this.throwIfDisposed(), Rs(this, t, o, s, n, e, i);
574
574
  };
575
575
  r().prototype.pow = function(t) {
576
- return this.throwIfDisposed(), At(this, t);
576
+ return this.throwIfDisposed(), Mt(this, t);
577
577
  };
578
578
  r().prototype.prelu = function(t) {
579
579
  return this.throwIfDisposed(), qo(this, t);
580
580
  };
581
581
  r().prototype.prod = function(t, o) {
582
- return this.throwIfDisposed(), Gs(this, t, o);
582
+ return this.throwIfDisposed(), Xs(this, t, o);
583
583
  };
584
584
  r().prototype.reciprocal = function() {
585
585
  return this.throwIfDisposed(), Zs(this);
@@ -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(), zo(this);
591
+ return this.throwIfDisposed(), Ko(this);
592
592
  };
593
593
  r().prototype.reshapeAs = function(t) {
594
594
  return this.throwIfDisposed(), l(this, t.shape);
@@ -621,7 +621,7 @@ 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(), Q(this);
624
+ return this.throwIfDisposed(), Y(this);
625
625
  };
626
626
  r().prototype.sign = function() {
627
627
  return this.throwIfDisposed(), Js(this);
@@ -636,28 +636,28 @@ r().prototype.slice = function(t, o) {
636
636
  return this.throwIfDisposed(), T(this, t, o);
637
637
  };
638
638
  r().prototype.softmax = function(t) {
639
- return this.throwIfDisposed(), Xo(this, t);
639
+ return this.throwIfDisposed(), Go(this, t);
640
640
  };
641
641
  r().prototype.softplus = function() {
642
642
  return this.throwIfDisposed(), R(this);
643
643
  };
644
644
  r().prototype.spaceToBatchND = function(t, o) {
645
- return this.throwIfDisposed(), G(this, t, o);
645
+ return this.throwIfDisposed(), X(this, t, o);
646
646
  };
647
647
  r().prototype.split = function(t, o) {
648
- return this.throwIfDisposed(), K(this, t, o);
648
+ return this.throwIfDisposed(), z(this, t, o);
649
649
  };
650
650
  r().prototype.sqrt = function() {
651
- return this.throwIfDisposed(), Mt(this);
651
+ return this.throwIfDisposed(), Ot(this);
652
652
  };
653
653
  r().prototype.square = function() {
654
- return this.throwIfDisposed(), Ot(this);
654
+ return this.throwIfDisposed(), At(this);
655
655
  };
656
656
  r().prototype.squaredDifference = function(t) {
657
657
  return this.throwIfDisposed(), vo(this, t);
658
658
  };
659
659
  r().prototype.squeeze = function(t) {
660
- return this.throwIfDisposed(), Go(this, t);
660
+ return this.throwIfDisposed(), Xo(this, t);
661
661
  };
662
662
  r().prototype.stack = function(t, o) {
663
663
  this.throwIfDisposed();
@@ -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(), Ko(this, t);
668
+ return this.throwIfDisposed(), zo(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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genai-fi/nanogpt",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -1,11 +0,0 @@
1
- import { A as t, B as s, ab as n, E as m, ac as r } from "./index-DOvlwCh-.js";
2
- function l(o, c) {
3
- const a = s(o, "real", "complex"), e = s(c, "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 p = { real: a, imag: e };
6
- return m.runKernel(r, p);
7
- }
8
- const i = /* @__PURE__ */ t({ complex_: l });
9
- export {
10
- i as c
11
- };
@@ -1,9 +0,0 @@
1
- import { A as g, B as t, E as h, K as p } from "./index-DOvlwCh-.js";
2
- function u(n, s, r = 0, e = 0) {
3
- const o = t(n, "x", "gather"), a = t(s, "indices", "gather", "int32"), c = { x: o, indices: a }, i = { axis: r, batchDims: e };
4
- return h.runKernel(p, c, i);
5
- }
6
- const d = /* @__PURE__ */ g({ gather_: u });
7
- export {
8
- d as g
9
- };
@@ -1,39 +0,0 @@
1
- import { A as r, B as x, E as p, am as E, an as $, ao as d, af as h, c as S, x as K } from "./index-DOvlwCh-.js";
2
- import { e as _ } from "./axis_util-BaG7mf5A.js";
3
- import { r as m } from "./reshape-ByE68wS9.js";
4
- import { s as T } from "./sum-DWAtNGez.js";
5
- function b(s, o = null, n = !1) {
6
- const a = { x: x(s, "x", "max") }, e = { reductionIndices: o, keepDims: n };
7
- return p.runKernel(E, a, e);
8
- }
9
- const A = /* @__PURE__ */ r({ max_: b });
10
- function I(s) {
11
- const n = { x: x(s, "x", "exp") };
12
- return p.runKernel($, n);
13
- }
14
- const M = /* @__PURE__ */ r({ exp_: I });
15
- function N(s) {
16
- const n = { x: x(s, "x", "log", "float32") };
17
- return p.runKernel(d, n);
18
- }
19
- const v = /* @__PURE__ */ r({ log_: N });
20
- function w(s, o = null, n = !1) {
21
- const t = x(s, "x", "logSumExp"), a = h(o, t.shape), e = A(
22
- t,
23
- a,
24
- !0
25
- /* keepDims */
26
- ), l = S(t, e), i = M(l), f = T(i, a), u = v(f), c = K(m(e, u.shape), u);
27
- if (n) {
28
- const g = _(c.shape, a);
29
- return m(c, g);
30
- }
31
- return c;
32
- }
33
- const P = /* @__PURE__ */ r({ logSumExp_: w });
34
- export {
35
- v as a,
36
- M as e,
37
- P as l,
38
- A as m
39
- };
@@ -1,10 +0,0 @@
1
- import { E as e, a2 as f } from "./index-DOvlwCh-.js";
2
- function E(a, n, r = 1, o = "float32") {
3
- if (r === 0)
4
- throw new Error("Cannot have a step of zero");
5
- const t = { start: a, stop: n, step: r, dtype: o };
6
- return e.runKernel(f, {}, t);
7
- }
8
- export {
9
- E as r
10
- };
@@ -1,11 +0,0 @@
1
- import { A as e, B as u, X as c, E as l, Y as m } from "./index-DOvlwCh-.js";
2
- function i(t, n = null, o = !1) {
3
- let s = u(t, "x", "sum");
4
- s.dtype === "bool" && (s = c(s, "int32"));
5
- const r = { x: s }, a = { axis: n, keepDims: o };
6
- return l.runKernel(m, r, a);
7
- }
8
- const f = /* @__PURE__ */ e({ sum_: i });
9
- export {
10
- f as s
11
- };
@@ -1,8 +0,0 @@
1
- import { a0 as o, a1 as t } from "./index-DOvlwCh-.js";
2
- function f(r, n, e) {
3
- const a = o(r, e);
4
- return t(r, n, a, e);
5
- }
6
- export {
7
- f as t
8
- };
@@ -1,11 +0,0 @@
1
- import { $ as n, a0 as o, a1 as s } from "./index-DOvlwCh-.js";
2
- function h(r, e) {
3
- n(r);
4
- const a = o(r, e);
5
- if (a.length !== 1)
6
- throw new Error("tensor1d() requires values to be a flat/TypedArray");
7
- return s(r, null, a, e);
8
- }
9
- export {
10
- h as t
11
- };