@genai-fi/nanogpt 1.6.0 → 1.7.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 (426) hide show
  1. package/dist/{binary_op_util-WY9YIl0q.js → Reshape-CqftURg0.js} +75 -60
  2. package/dist/TeachableLLM.d.ts +12 -12
  3. package/dist/api/beamer.d.ts +4 -4
  4. package/dist/api/responses.d.ts +4 -4
  5. package/dist/api/training.d.ts +9 -9
  6. package/dist/backend.d.ts +1 -1
  7. package/dist/backend_util-DZIc6pyV.js +1081 -0
  8. package/dist/checks/index.d.ts +11 -11
  9. package/dist/checks/weights.d.ts +1 -1
  10. package/dist/data/docx.d.ts +1 -1
  11. package/dist/data/pdf.d.ts +1 -1
  12. package/dist/data/stream.d.ts +1 -1
  13. package/dist/data/textLoader.d.ts +1 -1
  14. package/dist/data.d.ts +3 -3
  15. package/dist/device-CZPGtQBU.js +9 -0
  16. package/dist/device.d.ts +2 -0
  17. package/dist/{dist-DeVH1nGn.js → dist-DiszGjH-.js} +1833 -1844
  18. package/dist/{dist-CMMLi-qO.js → dist-JOPw9zTN.js} +69 -11
  19. package/dist/inference/Beamer.d.ts +3 -3
  20. package/dist/inference/Generator.d.ts +4 -4
  21. package/dist/inference/tokenisePrompt.d.ts +2 -2
  22. package/dist/inference/types.d.ts +1 -1
  23. package/dist/inference/utilities.d.ts +1 -1
  24. package/dist/layers/BaseLayer.d.ts +5 -4
  25. package/dist/layers/GQA.d.ts +24 -26
  26. package/dist/layers/HeadLayer.d.ts +2 -2
  27. package/dist/layers/LoRA.d.ts +1 -1
  28. package/dist/layers/MHA.d.ts +3 -4
  29. package/dist/layers/MLP.d.ts +2 -2
  30. package/dist/layers/PositionEmbedding.d.ts +3 -3
  31. package/dist/layers/RMSNorm.d.ts +2 -2
  32. package/dist/layers/RoPECache.d.ts +2 -1
  33. package/dist/layers/TiedEmbedding.d.ts +2 -2
  34. package/dist/layers/TransformerBlock.d.ts +9 -6
  35. package/dist/layers.d.ts +4 -4
  36. package/dist/loader/load.d.ts +1 -1
  37. package/dist/loader/loadHF.d.ts +3 -3
  38. package/dist/loader/loadTransformers.d.ts +2 -2
  39. package/dist/loader/loadZipMeta.d.ts +2 -2
  40. package/dist/loader/newZipLoad.d.ts +2 -2
  41. package/dist/loader/oldZipLoad.d.ts +4 -4
  42. package/dist/loader/save.d.ts +5 -5
  43. package/dist/loader/types.d.ts +23 -10
  44. package/dist/main.d.ts +40 -24
  45. package/dist/matMul16-CiMKJM8v.js +2610 -0
  46. package/dist/models/Llama.d.ts +2 -2
  47. package/dist/models/LoopNano.d.ts +16 -0
  48. package/dist/models/NanoGPTV1.d.ts +2 -2
  49. package/dist/models/NanoGPTV2.d.ts +2 -2
  50. package/dist/models/Qwen3.d.ts +2 -2
  51. package/dist/models/config.d.ts +11 -1
  52. package/dist/models/factory.d.ts +2 -2
  53. package/dist/models/model.d.ts +6 -6
  54. package/dist/models.d.ts +4 -4
  55. package/dist/nanogpt.js +37041 -0
  56. package/dist/ops/adamAdjust.d.ts +2 -0
  57. package/dist/ops/adamMoments.d.ts +2 -0
  58. package/dist/ops/adamW.d.ts +2 -0
  59. package/dist/ops/add16.d.ts +1 -0
  60. package/dist/ops/appendCache.d.ts +2 -0
  61. package/dist/ops/attentionMask.d.ts +11 -1
  62. package/dist/ops/dropout16.d.ts +2 -0
  63. package/dist/ops/gatherSub.d.ts +2 -0
  64. package/dist/ops/gelu.d.ts +3 -0
  65. package/dist/ops/log.d.ts +1 -0
  66. package/dist/ops/matMul16.d.ts +4 -0
  67. package/dist/ops/matMulGelu.d.ts +3 -0
  68. package/dist/ops/matMulMul.d.ts +2 -0
  69. package/dist/ops/mul16.d.ts +1 -0
  70. package/dist/ops/mulDrop.d.ts +2 -0
  71. package/dist/ops/normRMS.d.ts +3 -0
  72. package/dist/ops/pack16.d.ts +1 -0
  73. package/dist/ops/qkv.d.ts +13 -1
  74. package/dist/ops/rope.d.ts +4 -1
  75. package/dist/ops/scatterSub.d.ts +4 -1
  76. package/dist/ops/silu.d.ts +1 -0
  77. package/dist/ops/softmax16.d.ts +1 -0
  78. package/dist/ops/sparseCrossEntropy.d.ts +15 -0
  79. package/dist/ops/unpack16.d.ts +1 -0
  80. package/dist/ops/webgl/sparseCrossEntropy.d.ts +1 -0
  81. package/dist/ops/webgpu/adamW.d.ts +1 -0
  82. package/dist/ops/webgpu/concat16.d.ts +16 -0
  83. package/dist/ops/webgpu/index.d.ts +29 -0
  84. package/dist/ops/webgpu/normRMS16_program.d.ts +2 -2
  85. package/dist/ops/webgpu/normRMS32_program.d.ts +2 -2
  86. package/dist/ops/webgpu/pack16_program.d.ts +1 -1
  87. package/dist/ops/webgpu/softmax16_program.d.ts +16 -0
  88. package/dist/ops/webgpu/sparseCrossEntropy.d.ts +1 -0
  89. package/dist/ops/webgpu/utils/binary_op.d.ts +16 -0
  90. package/dist/ops/webgpu/utils/deviceInfo.d.ts +1 -1
  91. package/dist/ops/webgpu/utils/reductions.d.ts +1 -1
  92. package/dist/patches/webgpu_backend.d.ts +2 -1
  93. package/dist/patches/webgpu_base.d.ts +0 -1
  94. package/dist/patches/webgpu_program.d.ts +21 -0
  95. package/dist/{shared-BIDMUBCs.js → shared-BARkvvG4.js} +587 -505
  96. package/dist/tokenise.d.ts +4 -4
  97. package/dist/tokeniser/BaseTokeniser.d.ts +3 -3
  98. package/dist/tokeniser/CharTokeniser.d.ts +2 -2
  99. package/dist/tokeniser/bpe.d.ts +2 -2
  100. package/dist/tokeniser/type.d.ts +2 -2
  101. package/dist/training/AdamW.d.ts +19 -2
  102. package/dist/training/BasicTrainer.d.ts +5 -5
  103. package/dist/training/DatasetBuilder.d.ts +2 -2
  104. package/dist/training/Evaluator.d.ts +1 -1
  105. package/dist/training/LRScheduler.d.ts +1 -1
  106. package/dist/training/PreTrainer.d.ts +6 -6
  107. package/dist/training/SFTTrainer.d.ts +6 -6
  108. package/dist/training/configure.d.ts +2 -2
  109. package/dist/training/factory.d.ts +6 -5
  110. package/dist/training/prepareData.d.ts +6 -6
  111. package/dist/training/tasks/tokenStream.d.ts +3 -3
  112. package/dist/training/types.d.ts +6 -5
  113. package/dist/training/validateOptions.d.ts +1 -1
  114. package/dist/training/validation.d.ts +3 -3
  115. package/dist/utilities/datasetID.d.ts +1 -1
  116. package/dist/utilities/dummy.d.ts +1 -1
  117. package/dist/utilities/packed.d.ts +1 -1
  118. package/dist/utilities/parameters.d.ts +1 -1
  119. package/dist/utilities/sentences.d.ts +1 -1
  120. package/dist/utilities/waitForModel.d.ts +1 -1
  121. package/dist/webgpu-D4syGmzo.js +3221 -0
  122. package/dist/webgpu-wUCQopBN.js +1007 -0
  123. package/dist/{webgpu_program-DvkFqRlR.js → webgpu_backend-CzY9TzvA.js} +174 -223
  124. package/dist/{patches/webgpu_base.js → webgpu_base-Bjg7okYf.js} +6 -9
  125. package/package.json +12 -9
  126. package/dist/DatasetBuilder-DRDW8tcM.js +0 -731
  127. package/dist/Generator-BcR_14Cj.js +0 -316
  128. package/dist/RealDiv-Cl8k3YTx.js +0 -354
  129. package/dist/Reshape-CKxKPKqi.js +0 -91
  130. package/dist/Reshape-H5zZRgr9.js +0 -16
  131. package/dist/RoPECache-dYscFINl.js +0 -722
  132. package/dist/TeachableLLM.js +0 -220
  133. package/dist/api/beamer.js +0 -61
  134. package/dist/api/responses.js +0 -177
  135. package/dist/api/training.js +0 -215
  136. package/dist/axis_util-rF9RnwKE.js +0 -37
  137. package/dist/backend.js +0 -12
  138. package/dist/backend_util-Cpp0Gwlp.js +0 -394
  139. package/dist/broadcast_to-CGvLNiQ0.js +0 -20
  140. package/dist/checks/appendCache.js +0 -55
  141. package/dist/checks/attentionMask.js +0 -57
  142. package/dist/checks/check.js +0 -31
  143. package/dist/checks/gelu.js +0 -46
  144. package/dist/checks/index.js +0 -27
  145. package/dist/checks/matMulGelu.js +0 -84
  146. package/dist/checks/normRMS.js +0 -30
  147. package/dist/checks/normRMSGrad.js +0 -23
  148. package/dist/checks/packUnpack.js +0 -46
  149. package/dist/checks/qkv.js +0 -1
  150. package/dist/checks/rope.js +0 -30
  151. package/dist/checks/weights.js +0 -26
  152. package/dist/clip_by_value-D-UX9am5.js +0 -13
  153. package/dist/complex-Cl904TqN.js +0 -13
  154. package/dist/complex_util-BBlPAm-s.js +0 -59
  155. package/dist/concat-Oip5acVY.js +0 -14
  156. package/dist/concat_util-CY45Hf4F.js +0 -18
  157. package/dist/data/docx.js +0 -17
  158. package/dist/data/pdf.js +0 -14
  159. package/dist/data/stream.js +0 -1
  160. package/dist/data/textLoader.js +0 -575
  161. package/dist/data-CV_i_H6B.js +0 -11
  162. package/dist/data.js +0 -5
  163. package/dist/dist-DyL7qSLJ.js +0 -7809
  164. package/dist/dropout16-CA31Ud5a.js +0 -20
  165. package/dist/dropout_util-SiFMbFXz.js +0 -22
  166. package/dist/eventemitter3-wmfmOP_f.js +0 -90
  167. package/dist/expand_dims-Dh3Fulyn.js +0 -10
  168. package/dist/floor-BwjmUb7X.js +0 -8
  169. package/dist/gather-B5Z1RFt5.js +0 -14
  170. package/dist/gatherSub-CRUfUzBa.js +0 -22
  171. package/dist/gelu-Xx9-ohH9.js +0 -25
  172. package/dist/gpgpu_math-48m8q3jI.js +0 -1591
  173. package/dist/inference/Beamer.js +0 -215
  174. package/dist/inference/Generator.js +0 -1
  175. package/dist/inference/tokenisePrompt.js +0 -17
  176. package/dist/inference/types.js +0 -0
  177. package/dist/inference/utilities.js +0 -31
  178. package/dist/jszip.min-Btv48m44.js +0 -3037
  179. package/dist/kernel_funcs_utils-BYRpSfV_.js +0 -229
  180. package/dist/layers/BaseLayer.js +0 -75
  181. package/dist/layers/GQA.js +0 -102
  182. package/dist/layers/HeadLayer.js +0 -28
  183. package/dist/layers/LoRA.js +0 -45
  184. package/dist/layers/MHA.js +0 -102
  185. package/dist/layers/MLP.js +0 -47
  186. package/dist/layers/PositionEmbedding.js +0 -28
  187. package/dist/layers/RMSNorm.js +0 -25
  188. package/dist/layers/RoPECache.js +0 -1
  189. package/dist/layers/TiedEmbedding.js +0 -33
  190. package/dist/layers/TransformerBlock.js +0 -50
  191. package/dist/layers/WeightStore.js +0 -68
  192. package/dist/layers-CFqEip3s.js +0 -13
  193. package/dist/layers.js +0 -6
  194. package/dist/loader/load.js +0 -63
  195. package/dist/loader/loadHF.js +0 -17
  196. package/dist/loader/loadTransformers.js +0 -61
  197. package/dist/loader/loadZipMeta.js +0 -15
  198. package/dist/loader/newZipLoad.js +0 -24
  199. package/dist/loader/oldZipLoad.js +0 -36
  200. package/dist/loader/save.js +0 -89
  201. package/dist/loader/types.js +0 -0
  202. package/dist/main.js +0 -12145
  203. package/dist/matMul16-tE26fnhf.js +0 -87
  204. package/dist/matMulGelu-ASUWlKqu.js +0 -162
  205. package/dist/mat_mul-R9_DWmIT.js +0 -16
  206. package/dist/models/Llama.js +0 -88
  207. package/dist/models/NanoGPTV1.js +0 -94
  208. package/dist/models/NanoGPTV2.js +0 -85
  209. package/dist/models/Qwen3.js +0 -88
  210. package/dist/models/config.js +0 -32
  211. package/dist/models/factory.js +0 -16
  212. package/dist/models/model.js +0 -75
  213. package/dist/models-DyBpJJwM.js +0 -13
  214. package/dist/models.js +0 -6
  215. package/dist/mul16-C7sqgqik.js +0 -41
  216. package/dist/non_max_suppression_impl-B0H318rb.js +0 -72
  217. package/dist/not_equal-Bu3O8rh_.js +0 -67
  218. package/dist/one_hot-TEMPumJj.js +0 -14
  219. package/dist/ones-DpPXWa6A.js +0 -13
  220. package/dist/ops/adamAdjust.js +0 -17
  221. package/dist/ops/adamMoments.js +0 -15
  222. package/dist/ops/add16.js +0 -11
  223. package/dist/ops/appendCache.js +0 -26
  224. package/dist/ops/attentionMask.js +0 -19
  225. package/dist/ops/concat16.js +0 -8
  226. package/dist/ops/cpu/adamAdjust.js +0 -15
  227. package/dist/ops/cpu/adamMoments.js +0 -16
  228. package/dist/ops/cpu/appendCache.js +0 -65
  229. package/dist/ops/cpu/attentionMask.js +0 -20
  230. package/dist/ops/cpu/fusedSoftmax.js +0 -22
  231. package/dist/ops/cpu/gatherSub.js +0 -1
  232. package/dist/ops/cpu/gelu.js +0 -35
  233. package/dist/ops/cpu/matMul16.js +0 -14
  234. package/dist/ops/cpu/matMulGelu.js +0 -44
  235. package/dist/ops/cpu/matMulMul.js +0 -19
  236. package/dist/ops/cpu/mulDropout.js +0 -19
  237. package/dist/ops/cpu/normRMS.js +0 -34
  238. package/dist/ops/cpu/qkv.js +0 -74
  239. package/dist/ops/cpu/rope.js +0 -84
  240. package/dist/ops/cpu/scatterSub.js +0 -1
  241. package/dist/ops/dot16.js +0 -28
  242. package/dist/ops/dropout.js +0 -12
  243. package/dist/ops/dropout16.js +0 -1
  244. package/dist/ops/gatherSub.js +0 -12
  245. package/dist/ops/gelu.js +0 -1
  246. package/dist/ops/globalNorm.js +0 -19
  247. package/dist/ops/grads/add16.js +0 -26
  248. package/dist/ops/grads/attentionMask.js +0 -25
  249. package/dist/ops/grads/dropout16.js +0 -1
  250. package/dist/ops/grads/gelu.js +0 -1
  251. package/dist/ops/grads/matMul16.js +0 -1
  252. package/dist/ops/grads/matMulGelu.js +0 -21
  253. package/dist/ops/grads/mul16.js +0 -1
  254. package/dist/ops/grads/normRMS.js +0 -36
  255. package/dist/ops/grads/pack16.js +0 -1
  256. package/dist/ops/grads/qkv.js +0 -46
  257. package/dist/ops/grads/rope.js +0 -1
  258. package/dist/ops/grads/silu.js +0 -1
  259. package/dist/ops/grads/softmax16.js +0 -22
  260. package/dist/ops/grads/unpack16.js +0 -1
  261. package/dist/ops/grads/utils.js +0 -11
  262. package/dist/ops/log.js +0 -1
  263. package/dist/ops/matMul16.js +0 -1
  264. package/dist/ops/matMulGelu.js +0 -19
  265. package/dist/ops/matMulMul.js +0 -15
  266. package/dist/ops/mul16.js +0 -1
  267. package/dist/ops/mulDrop.js +0 -14
  268. package/dist/ops/normRMS.js +0 -21
  269. package/dist/ops/pack16.js +0 -1
  270. package/dist/ops/qkv.js +0 -15
  271. package/dist/ops/reshape16.js +0 -33
  272. package/dist/ops/rope.js +0 -1
  273. package/dist/ops/scatterSub.js +0 -12
  274. package/dist/ops/silu.js +0 -1
  275. package/dist/ops/slice16.js +0 -11
  276. package/dist/ops/softmax16.js +0 -8
  277. package/dist/ops/sub16.js +0 -10
  278. package/dist/ops/sum16.js +0 -13
  279. package/dist/ops/transpose16.js +0 -33
  280. package/dist/ops/unpack16.js +0 -1
  281. package/dist/ops/webgl/adamAdjust.js +0 -81
  282. package/dist/ops/webgl/adamMoments.js +0 -43
  283. package/dist/ops/webgl/appendCache.js +0 -52
  284. package/dist/ops/webgl/attentionMask.js +0 -63
  285. package/dist/ops/webgl/dropout16.js +0 -11
  286. package/dist/ops/webgl/fusedSoftmax.js +0 -70
  287. package/dist/ops/webgl/gatherSub.js +0 -27
  288. package/dist/ops/webgl/gelu.js +0 -47
  289. package/dist/ops/webgl/log.js +0 -14
  290. package/dist/ops/webgl/matMul16.js +0 -48
  291. package/dist/ops/webgl/matMulGelu.js +0 -1
  292. package/dist/ops/webgl/matMulMul.js +0 -23
  293. package/dist/ops/webgl/mulDropout.js +0 -31
  294. package/dist/ops/webgl/normRMS.js +0 -115
  295. package/dist/ops/webgl/qkv.js +0 -53
  296. package/dist/ops/webgl/rope.js +0 -73
  297. package/dist/ops/webgl/scatterSub.js +0 -27
  298. package/dist/ops/webgpu/adamAdjust.js +0 -76
  299. package/dist/ops/webgpu/adamMoments.js +0 -75
  300. package/dist/ops/webgpu/add16.js +0 -13
  301. package/dist/ops/webgpu/appendCache.js +0 -129
  302. package/dist/ops/webgpu/attentionMask.js +0 -41
  303. package/dist/ops/webgpu/attentionMask32_program.js +0 -61
  304. package/dist/ops/webgpu/clipScale.js +0 -44
  305. package/dist/ops/webgpu/concat16.js +0 -110
  306. package/dist/ops/webgpu/dropout16.js +0 -58
  307. package/dist/ops/webgpu/gatherSub.js +0 -51
  308. package/dist/ops/webgpu/gelu.js +0 -146
  309. package/dist/ops/webgpu/index.js +0 -27
  310. package/dist/ops/webgpu/matMul16.js +0 -91
  311. package/dist/ops/webgpu/matMul16_program.js +0 -311
  312. package/dist/ops/webgpu/mul16.js +0 -13
  313. package/dist/ops/webgpu/norm2.js +0 -45
  314. package/dist/ops/webgpu/normRMS.js +0 -25
  315. package/dist/ops/webgpu/normRMS16_program.js +0 -28
  316. package/dist/ops/webgpu/normRMS32_program.js +0 -28
  317. package/dist/ops/webgpu/normRMSGrad.js +0 -225
  318. package/dist/ops/webgpu/pack16.js +0 -20
  319. package/dist/ops/webgpu/pack16_program.js +0 -92
  320. package/dist/ops/webgpu/qkv.js +0 -63
  321. package/dist/ops/webgpu/rope.js +0 -227
  322. package/dist/ops/webgpu/scatterSub.js +0 -52
  323. package/dist/ops/webgpu/silu.js +0 -117
  324. package/dist/ops/webgpu/slice16.js +0 -73
  325. package/dist/ops/webgpu/softmax16.js +0 -18
  326. package/dist/ops/webgpu/softmax16_program.js +0 -88
  327. package/dist/ops/webgpu/softmax16_subgroup_program.js +0 -69
  328. package/dist/ops/webgpu/softmax16grad.js +0 -30
  329. package/dist/ops/webgpu/sub16.js +0 -13
  330. package/dist/ops/webgpu/sum16.js +0 -30
  331. package/dist/ops/webgpu/transpose16.js +0 -38
  332. package/dist/ops/webgpu/transpose16_program.js +0 -50
  333. package/dist/ops/webgpu/transpose16_shared_program.js +0 -78
  334. package/dist/ops/webgpu/unpack16.js +0 -59
  335. package/dist/ops/webgpu/utils/binary_op.js +0 -140
  336. package/dist/ops/webgpu/utils/deviceInfo.js +0 -10
  337. package/dist/ops/webgpu/utils/reductions.js +0 -264
  338. package/dist/ops-Be5ACU5R.js +0 -13
  339. package/dist/ops-C1UpdEYM.js +0 -509
  340. package/dist/pack16-BHO4t1-M.js +0 -36
  341. package/dist/pad-Dy-1IP3A.js +0 -13
  342. package/dist/patches/webgpu_backend.js +0 -42
  343. package/dist/patches/webgpu_program.js +0 -292
  344. package/dist/picomatch--TW6gyBJ.js +0 -999
  345. package/dist/qkv-BQfNPucX.js +0 -42
  346. package/dist/rand_util-_vCY93Uw.js +0 -44
  347. package/dist/random_normal-DUIT8kyC.js +0 -11
  348. package/dist/range-CYvQC3fW.js +0 -13
  349. package/dist/relu-C4XULT8A.js +0 -8
  350. package/dist/reshape-DJb1jgMt.js +0 -8
  351. package/dist/resize_nearest_neighbor-DAqcTYUe.js +0 -188
  352. package/dist/rope-JjBVufF_.js +0 -24
  353. package/dist/scatterSub-BOnqk-uY.js +0 -27
  354. package/dist/scatter_nd_util-BepMCpLY.js +0 -34
  355. package/dist/seedrandom-SHEGFK6H.js +0 -282
  356. package/dist/selu_util-DeOTf-sc.js +0 -27
  357. package/dist/shared-CX_iPI5K.js +0 -4
  358. package/dist/silu-DsAE2cJ5.js +0 -23
  359. package/dist/slice-Dlb1FlzG.js +0 -13
  360. package/dist/slice_util-BVgPRoij.js +0 -207
  361. package/dist/softmax-Dpav_dWw.js +0 -10
  362. package/dist/split-DYnT8chz.js +0 -11
  363. package/dist/squeeze-B3XYGAlg.js +0 -9
  364. package/dist/stack-Dbbt9mIk.js +0 -10
  365. package/dist/step-DA-5DNu9.js +0 -348
  366. package/dist/stream-BBe2apn4.js +0 -2280
  367. package/dist/sum-C8qNbFNp.js +0 -13
  368. package/dist/tensor-ALxWZfmz.js +0 -7
  369. package/dist/tensor1d-BHgkkhTE.js +0 -9
  370. package/dist/tensor2d-ARItvqVn.js +0 -10
  371. package/dist/tensor4d-D1zRBipJ.js +0 -10
  372. package/dist/tfjs_backend-CsXOum0h.js +0 -685
  373. package/dist/tile-DfyQ0KX-.js +0 -10
  374. package/dist/tokenise-DbS2Ea-T.js +0 -14
  375. package/dist/tokenise.js +0 -6
  376. package/dist/tokeniser/BaseTokeniser.js +0 -137
  377. package/dist/tokeniser/CharTokeniser.js +0 -85
  378. package/dist/tokeniser/bpe.js +0 -156
  379. package/dist/tokeniser/messages.js +0 -0
  380. package/dist/tokeniser/type.js +0 -0
  381. package/dist/topk-BrU2pkrR.js +0 -19
  382. package/dist/training/AdamW.js +0 -132
  383. package/dist/training/BasicTrainer.js +0 -274
  384. package/dist/training/DatasetBuilder.js +0 -1
  385. package/dist/training/Evaluator.js +0 -51
  386. package/dist/training/LRScheduler.js +0 -37
  387. package/dist/training/PreTrainer.js +0 -21
  388. package/dist/training/SFTTrainer.js +0 -23
  389. package/dist/training/configure.js +0 -33
  390. package/dist/training/factory.js +0 -7
  391. package/dist/training/loss.js +0 -18
  392. package/dist/training/orthoGrad.js +0 -9
  393. package/dist/training/prepareData.js +0 -51
  394. package/dist/training/sparseCrossEntropy.js +0 -53
  395. package/dist/training/tasks/TokenStore.js +0 -217
  396. package/dist/training/tasks/tokenStream.js +0 -45
  397. package/dist/training/types.js +0 -0
  398. package/dist/training/validateOptions.js +0 -18
  399. package/dist/training/validation.js +0 -30
  400. package/dist/transpose-BC-M_OoT.js +0 -34
  401. package/dist/unsorted_segment_sum-BelC7R-q.js +0 -408
  402. package/dist/utilities/arrayClose.js +0 -29
  403. package/dist/utilities/arrayShape.js +0 -7
  404. package/dist/utilities/datasetID.js +0 -17
  405. package/dist/utilities/dummy.js +0 -36
  406. package/dist/utilities/float16.js +0 -46
  407. package/dist/utilities/maxHeap.js +0 -54
  408. package/dist/utilities/multinomialCPU.js +0 -7
  409. package/dist/utilities/naming.js +0 -0
  410. package/dist/utilities/packed.js +0 -12
  411. package/dist/utilities/parameters.js +0 -53
  412. package/dist/utilities/performance.js +0 -15
  413. package/dist/utilities/profile.js +0 -32
  414. package/dist/utilities/random.js +0 -18
  415. package/dist/utilities/safetensors.js +0 -63
  416. package/dist/utilities/sentences.js +0 -35
  417. package/dist/utilities/tokenParse.js +0 -16
  418. package/dist/utilities/tokens.js +0 -39
  419. package/dist/utilities/topP.js +0 -25
  420. package/dist/utilities/waitForModel.js +0 -11
  421. package/dist/utilities/weights.js +0 -40
  422. package/dist/utilities/yielder.js +0 -6
  423. package/dist/v4-YCkfo8OR.js +0 -27
  424. package/dist/webgpu-BHX-uBym.js +0 -518
  425. package/dist/webgpu_util-5QTyovaf.js +0 -105
  426. package/dist/zeros-hxKGkRfl.js +0 -12
@@ -1,42 +0,0 @@
1
- import { H as e, J as t, X as n, et as r, xi as i } from "./dist-CMMLi-qO.js";
2
- import { t as a } from "./tensor2d-ARItvqVn.js";
3
- // node_modules/@tensorflow/tfjs-core/dist/ops/tensor3d.js
4
- function o(e, t, a) {
5
- if (i(e), t != null && t.length !== 3) throw Error("tensor3d() requires shape to have three numbers");
6
- let o = r(e, a);
7
- if (o.length !== 3 && o.length !== 1) throw Error("tensor3d() requires values to be number[][][] or flat/TypedArray");
8
- if (o.length === 1 && t == null) throw Error("tensor3d() requires shape to be provided when `values` are a flat array");
9
- return n(e, t, o, a);
10
- }
11
- // lib/checks/qkv.ts
12
- async function s(n) {
13
- await t(n);
14
- let r = o([[[.1, .2], [.3, .4]]], [
15
- 1,
16
- 2,
17
- 2
18
- ]), i = a([[
19
- .5,
20
- .6,
21
- .9,
22
- 1,
23
- 1.3,
24
- 1.4
25
- ], [
26
- .7,
27
- .8,
28
- 1.1,
29
- 1.2,
30
- 1.5,
31
- 1.6
32
- ]], [2, 6]), s = e().runKernel("QKV", {
33
- x: r,
34
- kernel: i
35
- }, { heads: 1 });
36
- return [
37
- await s[0].array(),
38
- await s[1].array(),
39
- await s[2].array()
40
- ];
41
- }
42
- export { s as t };
@@ -1,44 +0,0 @@
1
- import { i as e } from "./rolldown-runtime-CwxnZyOB.js";
2
- import { t } from "./seedrandom-SHEGFK6H.js";
3
- // node_modules/@tensorflow/tfjs-core/dist/ops/rand_util.js
4
- var n = /* @__PURE__ */ e(t()), r = class {
5
- constructor(e, t, r, i, a) {
6
- this.mean = e, this.stdDev = t, this.dtype = r, this.nextVal = NaN, this.truncated = i, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
7
- let o = a || Math.random();
8
- this.random = n.alea(o.toString());
9
- }
10
- nextValue() {
11
- if (!isNaN(this.nextVal)) {
12
- let e = this.nextVal;
13
- return this.nextVal = NaN, e;
14
- }
15
- let e, t, n = !1;
16
- for (; !n;) {
17
- let r, i, a;
18
- do
19
- r = 2 * this.random() - 1, i = 2 * this.random() - 1, a = r * r + i * i;
20
- while (a >= 1 || a === 0);
21
- let o = Math.sqrt(-2 * Math.log(a) / a);
22
- e = this.mean + this.stdDev * r * o, t = this.mean + this.stdDev * i * o, (!this.truncated || this.isValidTruncated(e)) && (n = !0);
23
- }
24
- return (!this.truncated || this.isValidTruncated(t)) && (this.nextVal = this.convertValue(t)), this.convertValue(e);
25
- }
26
- convertValue(e) {
27
- return this.dtype == null || this.dtype === "float32" ? e : Math.round(e);
28
- }
29
- isValidTruncated(e) {
30
- return e <= this.upper && e >= this.lower;
31
- }
32
- }, i = class {
33
- constructor(e = 0, t = 1, r, i) {
34
- if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = e, this.range = t - e, this.dtype = r, i ??= Math.random(), typeof i == "number" && (i = i.toString()), !this.canReturnFloat() && this.range <= 1) throw Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);
35
- this.random = n.alea(i);
36
- }
37
- convertValue(e) {
38
- return this.canReturnFloat() ? e : Math.round(e);
39
- }
40
- nextValue() {
41
- return this.convertValue(this.min + this.range * this.random());
42
- }
43
- };
44
- export { i as n, r as t };
@@ -1,11 +0,0 @@
1
- import { P as e, Z as t, bi as n } from "./dist-CMMLi-qO.js";
2
- import { t as r } from "./rand_util-_vCY93Uw.js";
3
- // node_modules/@tensorflow/tfjs-core/dist/ops/random_normal.js
4
- function i(t, i = 0, a = 1, o, s) {
5
- if (n(t), o != null && o === "bool") throw Error(`Unsupported data type ${o}`);
6
- let c = new r(i, a, o, !1, s), l = e(t, o);
7
- for (let e = 0; e < l.values.length; e++) l.values[e] = c.nextValue();
8
- return l.toTensor();
9
- }
10
- var a = /* @__PURE__ */ t({ randomNormal_: i });
11
- export { a as t };
@@ -1,13 +0,0 @@
1
- import { rt as e, yr as t } from "./dist-CMMLi-qO.js";
2
- // node_modules/@tensorflow/tfjs-core/dist/ops/range.js
3
- function n(n, r, i = 1, a = "float32") {
4
- if (i === 0) throw Error("Cannot have a step of zero");
5
- let o = {
6
- start: n,
7
- stop: r,
8
- step: i,
9
- dtype: a
10
- };
11
- return e.runKernel(t, {}, o);
12
- }
13
- export { n as t };
@@ -1,8 +0,0 @@
1
- import { Cr as e, Q as t, Z as n, rt as r } from "./dist-CMMLi-qO.js";
2
- // node_modules/@tensorflow/tfjs-core/dist/ops/relu.js
3
- function i(n) {
4
- let i = { x: t(n, "x", "relu") };
5
- return r.runKernel(e, i);
6
- }
7
- var a = /* @__PURE__ */ n({ relu_: i });
8
- export { a as t };
@@ -1,8 +0,0 @@
1
- import { Q as e, Tr as t, Z as n, rt as r } from "./dist-CMMLi-qO.js";
2
- // node_modules/@tensorflow/tfjs-core/dist/ops/reshape.js
3
- function i(n, i) {
4
- let a = { x: e(n, "x", "reshape", "string_or_numeric") }, o = { shape: i };
5
- return r.runKernel(t, a, o);
6
- }
7
- var a = /* @__PURE__ */ n({ reshape_: i });
8
- export { a as t };
@@ -1,188 +0,0 @@
1
- import { $r as e, C as t, D as n, Er as r, Hn as i, Kn as a, Mn as o, Mr as s, N as c, Or as l, Q as u, Ui as d, Vn as f, Wn as p, Z as m, b as h, jn as g, nr as _, pi as v, rt as y, st as b, v as x, x as S, y as C, yi as w } from "./dist-CMMLi-qO.js";
2
- import { t as T } from "./reshape-DJb1jgMt.js";
3
- import { o as E } from "./not_equal-Bu3O8rh_.js";
4
- import { a as D } from "./axis_util-rF9RnwKE.js";
5
- import { t as O } from "./sum-C8qNbFNp.js";
6
- // node_modules/@tensorflow/tfjs-core/dist/ops/min.js
7
- function k(e, t = null, n = !1) {
8
- let r = { x: u(e, "x", "min") }, i = {
9
- axis: t,
10
- keepDims: n
11
- };
12
- return y.runKernel("Min", r, i);
13
- }
14
- var A = /* @__PURE__ */ m({ min_: k });
15
- // node_modules/@tensorflow/tfjs-core/dist/ops/norm.js
16
- function j(e, t = "euclidean", n = null, r = !1) {
17
- e = u(e, "x", "norm");
18
- let i = M(e, t, n), a = i.shape;
19
- if (r) {
20
- let t = d(n, e.shape);
21
- a = D(i.shape, t);
22
- }
23
- return T(i, a);
24
- }
25
- function M(e, t, r = null) {
26
- if (e.rank === 0) return n(e);
27
- if (e.rank !== 1 && r === null) return M(T(e, [-1]), t, r);
28
- if (e.rank === 1 || typeof r == "number" || Array.isArray(r) && r.length === 1) {
29
- if (t === 1) return O(n(e), r);
30
- if (t === Infinity) return E(n(e), r);
31
- if (t === -Infinity) return A(n(e), r);
32
- if (t === "euclidean" || t === 2) return C(O(S(n(e), h(2, "int32")), r));
33
- throw Error(`Error in norm: invalid ord value: ${t}`);
34
- }
35
- if (Array.isArray(r) && r.length === 2) {
36
- if (t === 1) return E(O(n(e), r[0]), r[1] - 1);
37
- if (t === Infinity) return E(O(n(e), r[1]), r[0]);
38
- if (t === -Infinity) return A(O(n(e), r[1]), r[0]);
39
- if (t === "fro" || t === "euclidean") return C(O(x(e), r));
40
- throw Error(`Error in norm: invalid ord value: ${t}`);
41
- }
42
- throw Error(`Error in norm: invalid axis: ${r}`);
43
- }
44
- var N = /* @__PURE__ */ m({ norm_: j });
45
- // node_modules/@tensorflow/tfjs-core/dist/ops/greater.js
46
- function P(e, n) {
47
- let r = u(e, "a", "greater", "string_or_numeric"), i = u(n, "b", "greater", "string_or_numeric");
48
- [r, i] = b(r, i), t(r.shape, i.shape);
49
- let a = {
50
- a: r,
51
- b: i
52
- };
53
- return y.runKernel(g, a);
54
- }
55
- var F = /* @__PURE__ */ m({ greater_: P });
56
- // node_modules/@tensorflow/tfjs-core/dist/ops/greater_equal.js
57
- function I(e, n) {
58
- let r = u(e, "a", "greaterEqual", "string_or_numeric"), i = u(n, "b", "greaterEqual", "string_or_numeric");
59
- [r, i] = b(r, i), t(r.shape, i.shape);
60
- let a = {
61
- a: r,
62
- b: i
63
- };
64
- return y.runKernel(o, a);
65
- }
66
- var L = /* @__PURE__ */ m({ greaterEqual_: I });
67
- // node_modules/@tensorflow/tfjs-core/dist/ops/less.js
68
- function R(e, n) {
69
- let r = u(e, "a", "less", "string_or_numeric"), i = u(n, "b", "less", "string_or_numeric");
70
- [r, i] = b(r, i), t(r.shape, i.shape);
71
- let a = {
72
- a: r,
73
- b: i
74
- };
75
- return y.runKernel(f, a);
76
- }
77
- var ee = /* @__PURE__ */ m({ less_: R });
78
- // node_modules/@tensorflow/tfjs-core/dist/ops/less_equal.js
79
- function z(e, n) {
80
- let r = u(e, "a", "lessEqual", "string_or_numeric"), a = u(n, "b", "lessEqual", "string_or_numeric");
81
- [r, a] = b(r, a), t(r.shape, a.shape);
82
- let o = {
83
- a: r,
84
- b: a
85
- };
86
- return y.runKernel(i, o);
87
- }
88
- var B = /* @__PURE__ */ m({ lessEqual_: z });
89
- // node_modules/@tensorflow/tfjs-core/dist/ops/log1p.js
90
- function V(e) {
91
- let t = { x: u(e, "x", "log1p") };
92
- return y.runKernel(p, t);
93
- }
94
- var H = /* @__PURE__ */ m({ log1p_: V });
95
- // node_modules/@tensorflow/tfjs-core/dist/ops/logical_and.js
96
- function U(e, n) {
97
- let r = u(e, "a", "logicalAnd", "bool"), i = u(n, "b", "logicalAnd", "bool");
98
- t(r.shape, i.shape);
99
- let o = {
100
- a: r,
101
- b: i
102
- };
103
- return y.runKernel(a, o);
104
- }
105
- var W = /* @__PURE__ */ m({ logicalAnd_: U });
106
- // node_modules/@tensorflow/tfjs-core/dist/ops/minimum.js
107
- function G(e, n) {
108
- let r = u(e, "a", "minimum"), i = u(n, "b", "minimum");
109
- [r, i] = b(r, i), r.dtype === "bool" && (r = c(r, "int32"), i = c(i, "int32")), t(r.shape, i.shape);
110
- let a = {
111
- a: r,
112
- b: i
113
- };
114
- return y.runKernel(_, a);
115
- }
116
- var K = /* @__PURE__ */ m({ minimum_: G });
117
- // node_modules/@tensorflow/tfjs-core/dist/ops/round.js
118
- function q(e) {
119
- let t = { x: u(e, "x", "round") };
120
- return y.runKernel(s, t);
121
- }
122
- var J = /* @__PURE__ */ m({ round_: q });
123
- // node_modules/@tensorflow/tfjs-core/dist/ops/squared_difference.js
124
- function Y(n, r) {
125
- let i = u(n, "a", "squaredDifference"), a = u(r, "b", "squaredDifference");
126
- [i, a] = b(i, a), t(i.shape, a.shape);
127
- let o = {
128
- a: i,
129
- b: a
130
- };
131
- return y.runKernel(e, o, {});
132
- }
133
- var X = /* @__PURE__ */ m({ squaredDifference_: Y });
134
- // node_modules/@tensorflow/tfjs-core/dist/ops/unstack.js
135
- function Z(e, t = 0) {
136
- let n = u(e, "x", "unstack", "string_or_numeric");
137
- w(t >= -n.shape.length && t < n.shape.length, () => `Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);
138
- let r = { value: n }, i = { axis: t };
139
- return y.runKernel(v, r, i);
140
- }
141
- var Q = /* @__PURE__ */ m({ unstack_: Z });
142
- // node_modules/@tensorflow/tfjs-core/dist/ops/image/resize_bilinear.js
143
- function $(e, t, n = !1, i = !1) {
144
- let a = u(e, "images", "resizeBilinear");
145
- w(a.rank === 3 || a.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`), w(t.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${t}.`), w(i === !1 || n === !1, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
146
- let o = a, s = !1;
147
- a.rank === 3 && (s = !0, o = T(a, [
148
- 1,
149
- a.shape[0],
150
- a.shape[1],
151
- a.shape[2]
152
- ]));
153
- let [] = t, c = { images: o }, l = {
154
- alignCorners: n,
155
- halfPixelCenters: i,
156
- size: t
157
- }, d = y.runKernel(r, c, l);
158
- return s ? T(d, [
159
- d.shape[1],
160
- d.shape[2],
161
- d.shape[3]
162
- ]) : d;
163
- }
164
- var te = /* @__PURE__ */ m({ resizeBilinear_: $ });
165
- // node_modules/@tensorflow/tfjs-core/dist/ops/image/resize_nearest_neighbor.js
166
- function ne(e, t, n = !1, r = !1) {
167
- let i = u(e, "images", "resizeNearestNeighbor");
168
- w(i.rank === 3 || i.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${i.rank}.`), w(t.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`), w(i.dtype === "float32" || i.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), w(r === !1 || n === !1, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
169
- let a = i, o = !1;
170
- i.rank === 3 && (o = !0, a = T(i, [
171
- 1,
172
- i.shape[0],
173
- i.shape[1],
174
- i.shape[2]
175
- ]));
176
- let [] = t, s = { images: a }, c = {
177
- alignCorners: n,
178
- halfPixelCenters: r,
179
- size: t
180
- }, d = y.runKernel(l, s, c);
181
- return o ? T(d, [
182
- d.shape[1],
183
- d.shape[2],
184
- d.shape[3]
185
- ]) : d;
186
- }
187
- var re = /* @__PURE__ */ m({ resizeNearestNeighbor_: ne });
188
- export { J as a, H as c, L as d, F as f, X as i, B as l, A as m, te as n, K as o, N as p, Q as r, W as s, re as t, ee as u };
@@ -1,24 +0,0 @@
1
- import { H as e, bt as t } from "./dist-CMMLi-qO.js";
2
- import "./ops/cpu/rope.js";
3
- import "./ops/webgl/rope.js";
4
- // lib/ops/grads/rope.ts
5
- var n = {
6
- kernelName: "Rope",
7
- inputsToSave: [],
8
- outputsToSave: [],
9
- gradFunc: (e, t, n) => {
10
- let { ropeCache: i, interleaved: a } = n, o = r(e, i, 0, !0, a ?? !0);
11
- return { x: () => o };
12
- }
13
- };
14
- t(n);
15
- // lib/ops/rope.ts
16
- function r(t, n, r, i = !1, a = !0) {
17
- return n.ensureRopeCache(t.shape[2] + r), e().runKernel("Rope", { x: t }, {
18
- pastLen: r,
19
- negSin: i,
20
- ropeCache: n,
21
- interleaved: a
22
- });
23
- }
24
- export { n, r as t };
@@ -1,27 +0,0 @@
1
- import { O as e, Pr as t, Q as n, Z as r, bi as i, p as a, rt as o, xt as s } from "./dist-CMMLi-qO.js";
2
- import { t as c } from "./ones-DpPXWa6A.js";
3
- import { t as l } from "./range-CYvQC3fW.js";
4
- import { t as u } from "./stack-Dbbt9mIk.js";
5
- import { n as d } from "./scatter_nd_util-BepMCpLY.js";
6
- // node_modules/@tensorflow/tfjs-core/dist/ops/scatter_nd.js
7
- function f(e, r, a) {
8
- i(a);
9
- let s = n(e, "indices", "scatterND", "int32"), c = n(r, "updates", "scatterND");
10
- d(c, s, a);
11
- let l = {
12
- indices: s,
13
- updates: c
14
- }, u = { shape: a };
15
- return o.runKernel(t, l, u);
16
- }
17
- var p = /* @__PURE__ */ r({ scatterND_: f });
18
- // lib/ops/cpu/scatterSub.ts
19
- function m(t) {
20
- let { logits: n, labels: r, dy: i } = t.inputs, o = r.shape[0], s = n.shape[1], d = l(0, o, 1, "int32"), f = p(u([d, r], 1), c([o]), [o, s]), m = a(n, f), h = i.reshape([o, 1]);
21
- return e(m, h);
22
- }
23
- s({
24
- kernelName: "EfficientScatterSub",
25
- backendName: "cpu",
26
- kernelFunc: m
27
- });
@@ -1,34 +0,0 @@
1
- import { Ti as e, qi as t } from "./dist-CMMLi-qO.js";
2
- // node_modules/@tensorflow/tfjs-core/dist/ops/scatter_nd_util.js
3
- function n(e, t, n) {
4
- let r = t.rank > 1 ? t.shape[t.rank - 1] : 1, i = t.rank > 1 ? t.rank - 1 : 1, a = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${i}.`;
5
- if (n.rank < i) throw Error(a + ` update.rank < ${i}. `);
6
- if (e.length < r + (n.rank - i)) throw Error(a + ` Output shape length < ${r + (n.rank - i)}`);
7
- if (n.rank !== i + e.length - r) throw Error(a + ` update.rank != ${i + e.length - r}`);
8
- for (let e = 0; e < i; ++e) if (n.shape[e] !== t.shape[e]) throw Error(a + ` updates.shape[${e}] (${n.shape[e]}) != indices.shape[${e}] (${t.shape[e]}).`);
9
- for (let t = 0; t < n.rank - i; ++t) if (n.shape[t + i] !== e[t + r]) throw Error(a + ` updates.shape[${t + i}] (${n.shape[t + i]}) != shape[${t + i}] (${e[t + i]})`);
10
- }
11
- function r(e, t, r) {
12
- if (t.rank < 1) throw Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);
13
- if (e.rank < 1) throw Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);
14
- if (t.dtype !== "int32") throw Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);
15
- if (r.length < 1) throw Error(`Output rank must be greater or equal to 1, but got shape: ${r}`);
16
- if (r.length === 0) {
17
- if (t.size === 0) throw Error(`Indices specified for empty output. indices shape: ${t.shape}`);
18
- if (e.size === 0) throw Error(`Updates specified for empty output. updates shape: ${e.shape}`);
19
- }
20
- n(r, t, e);
21
- }
22
- function i(n, r, i) {
23
- let a = r.shape.length, o = a > 1 ? r.shape[a - 1] : 1, s = i.length, c = 1;
24
- for (let e = o; e < s; ++e) c *= i[e];
25
- let l = o < 1 ? 1 : o, u = t(r.shape) / l, d = [...e(i.slice(0, o)), 1], f = t(i);
26
- return {
27
- sliceRank: o,
28
- numUpdates: u,
29
- sliceSize: c,
30
- strides: d,
31
- outputSize: f
32
- };
33
- }
34
- export { r as n, n as r, i as t };