@genai-fi/nanogpt 1.6.1 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) 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 +10 -10
  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 +37052 -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 +16 -9
  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 +7 -7
  111. package/dist/training/tasks/TokenStore.d.ts +4 -4
  112. package/dist/training/tasks/tokenStream.d.ts +3 -3
  113. package/dist/training/types.d.ts +8 -7
  114. package/dist/training/validateOptions.d.ts +1 -1
  115. package/dist/training/validation.d.ts +5 -5
  116. package/dist/utilities/datasetID.d.ts +1 -1
  117. package/dist/utilities/dummy.d.ts +1 -1
  118. package/dist/utilities/packed.d.ts +1 -1
  119. package/dist/utilities/parameters.d.ts +1 -1
  120. package/dist/utilities/sentences.d.ts +1 -1
  121. package/dist/utilities/waitForModel.d.ts +1 -1
  122. package/dist/webgpu-D4syGmzo.js +3221 -0
  123. package/dist/webgpu-wUCQopBN.js +1007 -0
  124. package/dist/{webgpu_program-DvkFqRlR.js → webgpu_backend-CzY9TzvA.js} +174 -223
  125. package/dist/{patches/webgpu_base.js → webgpu_base-Bjg7okYf.js} +6 -9
  126. package/package.json +12 -9
  127. package/dist/DatasetBuilder-DRDW8tcM.js +0 -731
  128. package/dist/Generator-8IK28IWR.js +0 -316
  129. package/dist/RealDiv-Cl8k3YTx.js +0 -354
  130. package/dist/Reshape-CKxKPKqi.js +0 -91
  131. package/dist/Reshape-H5zZRgr9.js +0 -16
  132. package/dist/RoPECache-dYscFINl.js +0 -722
  133. package/dist/TeachableLLM.js +0 -220
  134. package/dist/api/beamer.js +0 -61
  135. package/dist/api/responses.js +0 -177
  136. package/dist/api/training.js +0 -215
  137. package/dist/axis_util-rF9RnwKE.js +0 -37
  138. package/dist/backend.js +0 -12
  139. package/dist/backend_util-Cpp0Gwlp.js +0 -394
  140. package/dist/broadcast_to-CGvLNiQ0.js +0 -20
  141. package/dist/checks/appendCache.js +0 -55
  142. package/dist/checks/attentionMask.js +0 -57
  143. package/dist/checks/check.js +0 -31
  144. package/dist/checks/gelu.js +0 -46
  145. package/dist/checks/index.js +0 -27
  146. package/dist/checks/matMulGelu.js +0 -84
  147. package/dist/checks/normRMS.js +0 -30
  148. package/dist/checks/normRMSGrad.js +0 -23
  149. package/dist/checks/packUnpack.js +0 -46
  150. package/dist/checks/qkv.js +0 -1
  151. package/dist/checks/rope.js +0 -30
  152. package/dist/checks/weights.js +0 -26
  153. package/dist/clip_by_value-D-UX9am5.js +0 -13
  154. package/dist/complex-Cl904TqN.js +0 -13
  155. package/dist/complex_util-BBlPAm-s.js +0 -59
  156. package/dist/concat-Oip5acVY.js +0 -14
  157. package/dist/concat_util-CY45Hf4F.js +0 -18
  158. package/dist/data/docx.js +0 -17
  159. package/dist/data/pdf.js +0 -14
  160. package/dist/data/stream.js +0 -1
  161. package/dist/data/textLoader.js +0 -575
  162. package/dist/data-CV_i_H6B.js +0 -11
  163. package/dist/data.js +0 -5
  164. package/dist/dist-DyL7qSLJ.js +0 -7809
  165. package/dist/dropout16-CA31Ud5a.js +0 -20
  166. package/dist/dropout_util-SiFMbFXz.js +0 -22
  167. package/dist/eventemitter3-wmfmOP_f.js +0 -90
  168. package/dist/expand_dims-Dh3Fulyn.js +0 -10
  169. package/dist/floor-BwjmUb7X.js +0 -8
  170. package/dist/gather-B5Z1RFt5.js +0 -14
  171. package/dist/gatherSub-CRUfUzBa.js +0 -22
  172. package/dist/gelu-Xx9-ohH9.js +0 -25
  173. package/dist/gpgpu_math-48m8q3jI.js +0 -1591
  174. package/dist/inference/Beamer.js +0 -215
  175. package/dist/inference/Generator.js +0 -1
  176. package/dist/inference/tokenisePrompt.js +0 -17
  177. package/dist/inference/types.js +0 -0
  178. package/dist/inference/utilities.js +0 -31
  179. package/dist/jszip.min-Btv48m44.js +0 -3037
  180. package/dist/kernel_funcs_utils-BYRpSfV_.js +0 -229
  181. package/dist/layers/BaseLayer.js +0 -75
  182. package/dist/layers/GQA.js +0 -102
  183. package/dist/layers/HeadLayer.js +0 -28
  184. package/dist/layers/LoRA.js +0 -45
  185. package/dist/layers/MHA.js +0 -102
  186. package/dist/layers/MLP.js +0 -47
  187. package/dist/layers/PositionEmbedding.js +0 -28
  188. package/dist/layers/RMSNorm.js +0 -25
  189. package/dist/layers/RoPECache.js +0 -1
  190. package/dist/layers/TiedEmbedding.js +0 -33
  191. package/dist/layers/TransformerBlock.js +0 -50
  192. package/dist/layers/WeightStore.js +0 -68
  193. package/dist/layers-CFqEip3s.js +0 -13
  194. package/dist/layers.js +0 -6
  195. package/dist/loader/load.js +0 -63
  196. package/dist/loader/loadHF.js +0 -17
  197. package/dist/loader/loadTransformers.js +0 -61
  198. package/dist/loader/loadZipMeta.js +0 -15
  199. package/dist/loader/newZipLoad.js +0 -24
  200. package/dist/loader/oldZipLoad.js +0 -36
  201. package/dist/loader/save.js +0 -89
  202. package/dist/loader/types.js +0 -0
  203. package/dist/main.js +0 -12145
  204. package/dist/matMul16-tE26fnhf.js +0 -87
  205. package/dist/matMulGelu-ASUWlKqu.js +0 -162
  206. package/dist/mat_mul-R9_DWmIT.js +0 -16
  207. package/dist/models/Llama.js +0 -88
  208. package/dist/models/NanoGPTV1.js +0 -94
  209. package/dist/models/NanoGPTV2.js +0 -85
  210. package/dist/models/Qwen3.js +0 -88
  211. package/dist/models/config.js +0 -32
  212. package/dist/models/factory.js +0 -16
  213. package/dist/models/model.js +0 -75
  214. package/dist/models-DyBpJJwM.js +0 -13
  215. package/dist/models.js +0 -6
  216. package/dist/mul16-C7sqgqik.js +0 -41
  217. package/dist/non_max_suppression_impl-B0H318rb.js +0 -72
  218. package/dist/not_equal-Bu3O8rh_.js +0 -67
  219. package/dist/one_hot-TEMPumJj.js +0 -14
  220. package/dist/ones-DpPXWa6A.js +0 -13
  221. package/dist/ops/adamAdjust.js +0 -17
  222. package/dist/ops/adamMoments.js +0 -15
  223. package/dist/ops/add16.js +0 -11
  224. package/dist/ops/appendCache.js +0 -26
  225. package/dist/ops/attentionMask.js +0 -19
  226. package/dist/ops/concat16.js +0 -8
  227. package/dist/ops/cpu/adamAdjust.js +0 -15
  228. package/dist/ops/cpu/adamMoments.js +0 -16
  229. package/dist/ops/cpu/appendCache.js +0 -65
  230. package/dist/ops/cpu/attentionMask.js +0 -20
  231. package/dist/ops/cpu/fusedSoftmax.js +0 -22
  232. package/dist/ops/cpu/gatherSub.js +0 -1
  233. package/dist/ops/cpu/gelu.js +0 -35
  234. package/dist/ops/cpu/matMul16.js +0 -14
  235. package/dist/ops/cpu/matMulGelu.js +0 -44
  236. package/dist/ops/cpu/matMulMul.js +0 -19
  237. package/dist/ops/cpu/mulDropout.js +0 -19
  238. package/dist/ops/cpu/normRMS.js +0 -34
  239. package/dist/ops/cpu/qkv.js +0 -74
  240. package/dist/ops/cpu/rope.js +0 -84
  241. package/dist/ops/cpu/scatterSub.js +0 -1
  242. package/dist/ops/dot16.js +0 -28
  243. package/dist/ops/dropout.js +0 -12
  244. package/dist/ops/dropout16.js +0 -1
  245. package/dist/ops/gatherSub.js +0 -12
  246. package/dist/ops/gelu.js +0 -1
  247. package/dist/ops/globalNorm.js +0 -19
  248. package/dist/ops/grads/add16.js +0 -26
  249. package/dist/ops/grads/attentionMask.js +0 -25
  250. package/dist/ops/grads/dropout16.js +0 -1
  251. package/dist/ops/grads/gelu.js +0 -1
  252. package/dist/ops/grads/matMul16.js +0 -1
  253. package/dist/ops/grads/matMulGelu.js +0 -21
  254. package/dist/ops/grads/mul16.js +0 -1
  255. package/dist/ops/grads/normRMS.js +0 -36
  256. package/dist/ops/grads/pack16.js +0 -1
  257. package/dist/ops/grads/qkv.js +0 -46
  258. package/dist/ops/grads/rope.js +0 -1
  259. package/dist/ops/grads/silu.js +0 -1
  260. package/dist/ops/grads/softmax16.js +0 -22
  261. package/dist/ops/grads/unpack16.js +0 -1
  262. package/dist/ops/grads/utils.js +0 -11
  263. package/dist/ops/log.js +0 -1
  264. package/dist/ops/matMul16.js +0 -1
  265. package/dist/ops/matMulGelu.js +0 -19
  266. package/dist/ops/matMulMul.js +0 -15
  267. package/dist/ops/mul16.js +0 -1
  268. package/dist/ops/mulDrop.js +0 -14
  269. package/dist/ops/normRMS.js +0 -21
  270. package/dist/ops/pack16.js +0 -1
  271. package/dist/ops/qkv.js +0 -15
  272. package/dist/ops/reshape16.js +0 -33
  273. package/dist/ops/rope.js +0 -1
  274. package/dist/ops/scatterSub.js +0 -12
  275. package/dist/ops/silu.js +0 -1
  276. package/dist/ops/slice16.js +0 -11
  277. package/dist/ops/softmax16.js +0 -8
  278. package/dist/ops/sub16.js +0 -10
  279. package/dist/ops/sum16.js +0 -13
  280. package/dist/ops/transpose16.js +0 -33
  281. package/dist/ops/unpack16.js +0 -1
  282. package/dist/ops/webgl/adamAdjust.js +0 -81
  283. package/dist/ops/webgl/adamMoments.js +0 -43
  284. package/dist/ops/webgl/appendCache.js +0 -52
  285. package/dist/ops/webgl/attentionMask.js +0 -63
  286. package/dist/ops/webgl/dropout16.js +0 -11
  287. package/dist/ops/webgl/fusedSoftmax.js +0 -70
  288. package/dist/ops/webgl/gatherSub.js +0 -27
  289. package/dist/ops/webgl/gelu.js +0 -47
  290. package/dist/ops/webgl/log.js +0 -14
  291. package/dist/ops/webgl/matMul16.js +0 -48
  292. package/dist/ops/webgl/matMulGelu.js +0 -1
  293. package/dist/ops/webgl/matMulMul.js +0 -23
  294. package/dist/ops/webgl/mulDropout.js +0 -31
  295. package/dist/ops/webgl/normRMS.js +0 -115
  296. package/dist/ops/webgl/qkv.js +0 -53
  297. package/dist/ops/webgl/rope.js +0 -73
  298. package/dist/ops/webgl/scatterSub.js +0 -27
  299. package/dist/ops/webgpu/adamAdjust.js +0 -76
  300. package/dist/ops/webgpu/adamMoments.js +0 -75
  301. package/dist/ops/webgpu/add16.js +0 -13
  302. package/dist/ops/webgpu/appendCache.js +0 -129
  303. package/dist/ops/webgpu/attentionMask.js +0 -41
  304. package/dist/ops/webgpu/attentionMask32_program.js +0 -61
  305. package/dist/ops/webgpu/clipScale.js +0 -44
  306. package/dist/ops/webgpu/concat16.js +0 -110
  307. package/dist/ops/webgpu/dropout16.js +0 -58
  308. package/dist/ops/webgpu/gatherSub.js +0 -51
  309. package/dist/ops/webgpu/gelu.js +0 -146
  310. package/dist/ops/webgpu/index.js +0 -27
  311. package/dist/ops/webgpu/matMul16.js +0 -91
  312. package/dist/ops/webgpu/matMul16_program.js +0 -311
  313. package/dist/ops/webgpu/mul16.js +0 -13
  314. package/dist/ops/webgpu/norm2.js +0 -45
  315. package/dist/ops/webgpu/normRMS.js +0 -25
  316. package/dist/ops/webgpu/normRMS16_program.js +0 -28
  317. package/dist/ops/webgpu/normRMS32_program.js +0 -28
  318. package/dist/ops/webgpu/normRMSGrad.js +0 -225
  319. package/dist/ops/webgpu/pack16.js +0 -20
  320. package/dist/ops/webgpu/pack16_program.js +0 -92
  321. package/dist/ops/webgpu/qkv.js +0 -63
  322. package/dist/ops/webgpu/rope.js +0 -227
  323. package/dist/ops/webgpu/scatterSub.js +0 -52
  324. package/dist/ops/webgpu/silu.js +0 -117
  325. package/dist/ops/webgpu/slice16.js +0 -73
  326. package/dist/ops/webgpu/softmax16.js +0 -18
  327. package/dist/ops/webgpu/softmax16_program.js +0 -88
  328. package/dist/ops/webgpu/softmax16_subgroup_program.js +0 -69
  329. package/dist/ops/webgpu/softmax16grad.js +0 -30
  330. package/dist/ops/webgpu/sub16.js +0 -13
  331. package/dist/ops/webgpu/sum16.js +0 -30
  332. package/dist/ops/webgpu/transpose16.js +0 -38
  333. package/dist/ops/webgpu/transpose16_program.js +0 -50
  334. package/dist/ops/webgpu/transpose16_shared_program.js +0 -78
  335. package/dist/ops/webgpu/unpack16.js +0 -59
  336. package/dist/ops/webgpu/utils/binary_op.js +0 -140
  337. package/dist/ops/webgpu/utils/deviceInfo.js +0 -10
  338. package/dist/ops/webgpu/utils/reductions.js +0 -264
  339. package/dist/ops-Be5ACU5R.js +0 -13
  340. package/dist/ops-C1UpdEYM.js +0 -509
  341. package/dist/pack16-BHO4t1-M.js +0 -36
  342. package/dist/pad-Dy-1IP3A.js +0 -13
  343. package/dist/patches/webgpu_backend.js +0 -42
  344. package/dist/patches/webgpu_program.js +0 -292
  345. package/dist/picomatch--TW6gyBJ.js +0 -999
  346. package/dist/qkv-BQfNPucX.js +0 -42
  347. package/dist/rand_util-_vCY93Uw.js +0 -44
  348. package/dist/random_normal-DUIT8kyC.js +0 -11
  349. package/dist/range-CYvQC3fW.js +0 -13
  350. package/dist/relu-C4XULT8A.js +0 -8
  351. package/dist/reshape-DJb1jgMt.js +0 -8
  352. package/dist/resize_nearest_neighbor-DAqcTYUe.js +0 -188
  353. package/dist/rope-JjBVufF_.js +0 -24
  354. package/dist/scatterSub-BOnqk-uY.js +0 -27
  355. package/dist/scatter_nd_util-BepMCpLY.js +0 -34
  356. package/dist/seedrandom-SHEGFK6H.js +0 -282
  357. package/dist/selu_util-DeOTf-sc.js +0 -27
  358. package/dist/shared-CX_iPI5K.js +0 -4
  359. package/dist/silu-DsAE2cJ5.js +0 -23
  360. package/dist/slice-Dlb1FlzG.js +0 -13
  361. package/dist/slice_util-BVgPRoij.js +0 -207
  362. package/dist/softmax-Dpav_dWw.js +0 -10
  363. package/dist/split-DYnT8chz.js +0 -11
  364. package/dist/squeeze-B3XYGAlg.js +0 -9
  365. package/dist/stack-Dbbt9mIk.js +0 -10
  366. package/dist/step-DA-5DNu9.js +0 -348
  367. package/dist/stream-BBe2apn4.js +0 -2280
  368. package/dist/sum-C8qNbFNp.js +0 -13
  369. package/dist/tensor-ALxWZfmz.js +0 -7
  370. package/dist/tensor1d-BHgkkhTE.js +0 -9
  371. package/dist/tensor2d-ARItvqVn.js +0 -10
  372. package/dist/tensor4d-D1zRBipJ.js +0 -10
  373. package/dist/tfjs_backend-CsXOum0h.js +0 -685
  374. package/dist/tile-DfyQ0KX-.js +0 -10
  375. package/dist/tokenise-DbS2Ea-T.js +0 -14
  376. package/dist/tokenise.js +0 -6
  377. package/dist/tokeniser/BaseTokeniser.js +0 -137
  378. package/dist/tokeniser/CharTokeniser.js +0 -85
  379. package/dist/tokeniser/bpe.js +0 -156
  380. package/dist/tokeniser/messages.js +0 -0
  381. package/dist/tokeniser/type.js +0 -0
  382. package/dist/topk-BrU2pkrR.js +0 -19
  383. package/dist/training/AdamW.js +0 -132
  384. package/dist/training/BasicTrainer.js +0 -274
  385. package/dist/training/DatasetBuilder.js +0 -1
  386. package/dist/training/Evaluator.js +0 -51
  387. package/dist/training/LRScheduler.js +0 -37
  388. package/dist/training/PreTrainer.js +0 -21
  389. package/dist/training/SFTTrainer.js +0 -23
  390. package/dist/training/configure.js +0 -33
  391. package/dist/training/factory.js +0 -7
  392. package/dist/training/loss.js +0 -18
  393. package/dist/training/orthoGrad.js +0 -9
  394. package/dist/training/prepareData.js +0 -51
  395. package/dist/training/sparseCrossEntropy.js +0 -53
  396. package/dist/training/tasks/TokenStore.js +0 -217
  397. package/dist/training/tasks/tokenStream.js +0 -45
  398. package/dist/training/types.js +0 -0
  399. package/dist/training/validateOptions.js +0 -18
  400. package/dist/training/validation.js +0 -30
  401. package/dist/transpose-BC-M_OoT.js +0 -34
  402. package/dist/unsorted_segment_sum-BelC7R-q.js +0 -408
  403. package/dist/utilities/arrayClose.js +0 -29
  404. package/dist/utilities/arrayShape.js +0 -7
  405. package/dist/utilities/datasetID.js +0 -17
  406. package/dist/utilities/dummy.js +0 -36
  407. package/dist/utilities/float16.js +0 -46
  408. package/dist/utilities/maxHeap.js +0 -54
  409. package/dist/utilities/multinomialCPU.js +0 -7
  410. package/dist/utilities/naming.js +0 -0
  411. package/dist/utilities/packed.js +0 -12
  412. package/dist/utilities/parameters.js +0 -53
  413. package/dist/utilities/performance.js +0 -15
  414. package/dist/utilities/profile.js +0 -32
  415. package/dist/utilities/random.js +0 -18
  416. package/dist/utilities/safetensors.js +0 -63
  417. package/dist/utilities/sentences.js +0 -35
  418. package/dist/utilities/tokenParse.js +0 -16
  419. package/dist/utilities/tokens.js +0 -39
  420. package/dist/utilities/topP.js +0 -25
  421. package/dist/utilities/waitForModel.js +0 -11
  422. package/dist/utilities/weights.js +0 -40
  423. package/dist/utilities/yielder.js +0 -6
  424. package/dist/v4-YCkfo8OR.js +0 -27
  425. package/dist/webgpu-BHX-uBym.js +0 -518
  426. package/dist/webgpu_util-5QTyovaf.js +0 -105
  427. package/dist/zeros-hxKGkRfl.js +0 -12
@@ -1,37 +0,0 @@
1
- import { yi as e } from "./dist-CMMLi-qO.js";
2
- // node_modules/@tensorflow/tfjs-core/dist/ops/axis_util.js
3
- function t(e, t) {
4
- for (let n = 0; n < e.length; ++n) if (e[e.length - n - 1] !== t - 1 - n) return !1;
5
- return !0;
6
- }
7
- function n(e, t, n) {
8
- let r = e.length + t.length, i = [], a = 0, o = 0;
9
- for (let s = 0; s < r; s++) n.indexOf(s) === -1 ? i.push(e[a++]) : i.push(t[o++]);
10
- return i;
11
- }
12
- function r(e, t) {
13
- let n = [], r = e.length;
14
- for (let i = 0; i < r; i++) t.indexOf(i) === -1 && n.push(e[i]);
15
- return [n, t.map((t) => e[t])];
16
- }
17
- function i(e, t) {
18
- return n(e, t.map((e) => 1), t);
19
- }
20
- function a(n, r, i) {
21
- e(t(r, i), () => `${n} supports only inner-most axes for now. Got axes ${r} and rank-${i} input.`);
22
- }
23
- function o(e, n) {
24
- if (t(e, n)) return null;
25
- let r = [];
26
- for (let t = 0; t < n; ++t) e.indexOf(t) === -1 && r.push(t);
27
- return e.forEach((e) => r.push(e)), r;
28
- }
29
- function s(e) {
30
- return e.map((e, t) => [t, e]).sort((e, t) => e[1] - t[1]).map((e) => e[0]);
31
- }
32
- function c(e, t) {
33
- let n = [];
34
- for (let r = t - e; r < t; ++r) n.push(r);
35
- return n;
36
- }
37
- export { i as a, s as c, r as i, t as n, o, n as r, c as s, a as t };
package/dist/backend.js DELETED
@@ -1,12 +0,0 @@
1
- import { J as e, K as t, U as n } from "./dist-CMMLi-qO.js";
2
- // lib/backend.ts
3
- async function r(r, i) {
4
- if (n() !== r) {
5
- if (r === "webgpu") {
6
- let { registerWebGPUBackend: e } = await import("./patches/webgpu_base.js");
7
- e(i), await import("./dist-DeVH1nGn.js"), await import("./ops/webgpu/index.js");
8
- }
9
- await e(r), await t(), console.log(`Backend set to ${r}`);
10
- }
11
- }
12
- export { r as selectBackend };
@@ -1,394 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CwxnZyOB.js";
2
- import { C as t, Ct as n, St as r, T as i, Ti as a, Vi as o, ht as s, lt as c, mt as l, qi as u, w as d, yi as f } from "./dist-CMMLi-qO.js";
3
- import { a as ee, c as te, i as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./axis_util-rF9RnwKE.js";
4
- import { n as ce, t as le } from "./concat_util-CY45Hf4F.js";
5
- import { _ as ue, c as de, d as fe, f as pe, g as me, h as he, l as ge, m as _e, p as ve, s as ye, u as be } from "./step-DA-5DNu9.js";
6
- import { a as xe, i as Se, n as Ce, o as we, r as Te, t as Ee } from "./selu_util-DeOTf-sc.js";
7
- import { s as De } from "./slice_util-BVgPRoij.js";
8
- import { n as Oe, r as ke, t as Ae } from "./scatter_nd_util-BepMCpLY.js";
9
- import { a as je, c as Me, i as Ne, n as Pe, o as Fe, r as Ie, s as Le, t as Re } from "./complex_util-BBlPAm-s.js";
10
- // node_modules/@tensorflow/tfjs-core/dist/ops/gather_nd_util.js
11
- function p(e, t) {
12
- let n = e.shape.length, r = t.shape.length;
13
- if (n < 1) throw Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);
14
- if (r < 1) throw Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);
15
- if (t.dtype !== "int32") throw Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);
16
- if (t.shape[r - 1] > n) throw Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[r - 1]} vs. ${n}`);
17
- if (u(e.shape) === 0) throw Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);
18
- let i = t.shape, o = i[i.length - 1], s = 1;
19
- for (let e = 0; e < i.length - 1; ++e) s *= i[e];
20
- let c = e.shape, l = i.slice();
21
- l.pop();
22
- let d = 1;
23
- for (let e = o; e < n; ++e) d *= c[e], l.push(c[e]);
24
- let f = [...a(e.shape).map((e) => e / d), 1].slice(0, o);
25
- return [
26
- l,
27
- s,
28
- d,
29
- f
30
- ];
31
- }
32
- // node_modules/@tensorflow/tfjs-core/dist/ops/ragged_to_dense_util.js
33
- var m;
34
- (function(e) {
35
- e[e.FIRST_DIM_SIZE = 0] = "FIRST_DIM_SIZE", e[e.VALUE_ROWIDS = 1] = "VALUE_ROWIDS", e[e.ROW_LENGTHS = 2] = "ROW_LENGTHS", e[e.ROW_SPLITS = 3] = "ROW_SPLITS", e[e.ROW_LIMITS = 4] = "ROW_LIMITS", e[e.ROW_STARTS = 5] = "ROW_STARTS";
36
- })(m ||= {});
37
- function h(e, t, n) {
38
- let r = [];
39
- if (n == null && t == null) return r;
40
- if (t == null) for (; r.length < e + n.length;) r.push(-1);
41
- else r = t.slice();
42
- if (n == null) return r;
43
- if (e + n.length !== r.length) throw Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e + n.length}, but shape.rank = ${r.length}`);
44
- for (let i = 1; i < n.length; ++i) {
45
- let a = n[i], o = r[r.length - n.length + i], s = r[o];
46
- if (a >= 0) {
47
- if (s >= 0) {
48
- if (s !== a) throw Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${i + e}] = ${a} but shape[${i + e}] = ${s}`);
49
- } else r[o] = a;
50
- }
51
- }
52
- return r;
53
- }
54
- function g(e) {
55
- let t = {
56
- FIRST_DIM_SIZE: m.FIRST_DIM_SIZE,
57
- VALUE_ROWIDS: m.VALUE_ROWIDS,
58
- ROW_LENGTHS: m.ROW_LENGTHS,
59
- ROW_SPLITS: m.ROW_SPLITS,
60
- ROW_LIMITS: m.ROW_LIMITS,
61
- ROW_STARTS: m.ROW_STARTS
62
- }, n = [];
63
- for (let r of e) if (r in t) n.push(t[r]);
64
- else break;
65
- return n;
66
- }
67
- function _(e) {
68
- return e.length === 0 ? 0 : e[0] === m.FIRST_DIM_SIZE ? e.length - 1 : e.length;
69
- }
70
- function v(e, t) {
71
- if (e == null || t == null) return;
72
- let n = e.length, r = t.length;
73
- if (n >= r) throw Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${r})`);
74
- for (let i = 0; i < Math.min(n, r - 1); ++i) {
75
- let n = e[i], r = t[i + 1];
76
- if (n >= 0 && r >= 0 && n !== 1 && n !== r) throw Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${i - e.length}] = ${n} but ragged tensor input.flatValues.shape[${i - e.length}] = ${r}`);
77
- }
78
- }
79
- function y(e) {
80
- return e <= 30 ? e : o(e, Math.floor(Math.sqrt(e)));
81
- }
82
- // node_modules/@tensorflow/tfjs-core/dist/ops/rotate_util.js
83
- function ze(e, t, n) {
84
- return [n * (typeof e == "number" ? e : e[0]), t * (typeof e == "number" ? e : e[1])];
85
- }
86
- // node_modules/@tensorflow/tfjs-core/dist/ops/array_ops_util.js
87
- function b(e, t, n, r = !0) {
88
- let i = [];
89
- if (r) i = i.concat(t.slice(0)), i.push(e[0] / n), i = i.concat(e.slice(1));
90
- else {
91
- i = i.concat(e[0]);
92
- let n = t.length;
93
- for (let r = 0; r < n; ++r) i = i.concat([e[r + 1] / t[r], t[r]]);
94
- i = i.concat(e.slice(n + 1));
95
- }
96
- return i;
97
- }
98
- function x(e, t, n = !0) {
99
- let r = [];
100
- if (n) {
101
- r.push(t);
102
- for (let n = t + 1; n < e; ++n) n <= 2 * t ? (r.push(n), r.push(n - (t + 1))) : r.push(n);
103
- } else {
104
- let n = [], i = [];
105
- for (let r = 1; r < e; ++r) r >= t * 2 + 1 || r % 2 == 1 ? i.push(r) : n.push(r);
106
- r.push(...n), r.push(0), r.push(...i);
107
- }
108
- return r;
109
- }
110
- function S(e, t, n, r = !0) {
111
- let i = [];
112
- r ? i.push(e[0] / n) : i.push(e[0] * n);
113
- for (let n = 1; n < e.length; ++n) n <= t.length ? r ? i.push(t[n - 1] * e[n]) : i.push(e[n] / t[n - 1]) : i.push(e[n]);
114
- return i;
115
- }
116
- function C(e, t) {
117
- let n = [0];
118
- for (let r = 0; r < t; ++r) n.push(e[r][0]);
119
- return n;
120
- }
121
- function w(e, t, n) {
122
- let r = e.slice(0, 1);
123
- for (let i = 0; i < n; ++i) r.push(e[i + 1] - t[i][0] - t[i][1]);
124
- return r;
125
- }
126
- // node_modules/@tensorflow/tfjs-core/dist/ops/erf_util.js
127
- var T = .3275911, E = .254829592, D = -.284496736, O = 1.421413741, k = -1.453152027, A = 1.061405429, j = "->", Be = /->/g, M = ",", N = "...";
128
- function P(e, t) {
129
- e = e.replace(/\s/g, "");
130
- let n = (e.length - e.replace(Be, "").length) / 2;
131
- if (n < 1) throw Error("Equations without an arrow are not supported.");
132
- if (n > 1) throw Error(`Equation must contain exactly one arrow ("${j}").`);
133
- let [r, i] = e.split(j);
134
- f(r.indexOf(N) === -1, () => `The ellipsis notation ("${N}") is not supported yet.`);
135
- let a = r.split(M), o = a.length;
136
- if (t !== o) throw Error(`Expected ${o} input tensors, received ${t}`);
137
- if (o > 2) throw Error("Support for more than 2 input tensors is not implemented yet.");
138
- let s = [];
139
- for (let e = 0; e < i.length; ++e) {
140
- let t = i[e];
141
- if (!a.some((e) => e.indexOf(t) !== -1)) throw Error(`Output subscripts contain the label ${t} not present in the input subscripts.`);
142
- s.indexOf(t) === -1 && s.push(t);
143
- }
144
- for (let e = 0; e < r.length; ++e) {
145
- let t = r[e];
146
- s.indexOf(t) === -1 && t !== M && s.push(t);
147
- }
148
- let c = Array(a.length);
149
- for (let e = 0; e < o; ++e) {
150
- if (new Set(a[e].split("")).size !== a[e].length) throw Error(`Found duplicate axes in input component ${a[e]}. Support for duplicate axes in input is not implemented yet.`);
151
- c[e] = [];
152
- for (let t = 0; t < a[e].length; ++t) c[e].push(s.indexOf(a[e][t]));
153
- }
154
- let l = s.length, u = i.length, d = [];
155
- for (let e = u; e < l; ++e) d.push(e);
156
- return {
157
- allDims: s,
158
- summedDims: d,
159
- idDims: c
160
- };
161
- }
162
- function F(e, t) {
163
- let n = Array(e);
164
- n.fill(-1);
165
- for (let e = 0; e < t.length; ++e) n[t[e]] = e;
166
- let r = [];
167
- for (let t = 0; t < e; ++t) n[t] === -1 && r.push(t);
168
- return n = n.filter((e) => e !== -1), {
169
- permutationIndices: n,
170
- expandDims: r
171
- };
172
- }
173
- function I(e, t, n) {
174
- let r = Array(e);
175
- for (let e = 0; e < n.length; ++e) {
176
- let i = n[e].shape;
177
- for (let n = 0; n < t[e].length; ++n) r[t[e][n]] === void 0 ? r[t[e][n]] = i[n] : f(r[t[e][n]] === i[n], () => `Expected dimension ${r[t[e][n]]} at axis ${n} of input shaped ${JSON.stringify(i)}, but got dimension ${i[n]}`);
178
- }
179
- }
180
- function L(e, t) {
181
- let n = e, r = [], i = 0;
182
- e.length === 0 && n.push(-1), i = e.length + 1;
183
- for (let e = 0; e < i; ++e) r.push([]);
184
- let a = [];
185
- for (let e = 0; e < n.length; ++e) {
186
- let i = n[e], o = Ve(t, i);
187
- for (let t of o) a.indexOf(t) === -1 && (r[e].push(t), a.push(t));
188
- }
189
- return {
190
- path: n,
191
- steps: r
192
- };
193
- }
194
- function R(e) {
195
- return e.every((e, t) => e === t);
196
- }
197
- function Ve(e, t) {
198
- let n = [];
199
- for (let r = 0; r < e.length; ++r) (e[r].length === 0 || e[r].indexOf(t) !== -1 || t === -1) && n.push(r);
200
- return n;
201
- }
202
- // node_modules/@tensorflow/tfjs-core/dist/ops/split_util.js
203
- function z(e, t, n = 0) {
204
- let r = [];
205
- if (typeof t == "number") f(e.shape[n] % t === 0, () => "Number of splits must evenly divide the axis."), r = Array(t).fill(e.shape[n] / t);
206
- else {
207
- let i = t.reduce((e, t) => (t === -1 && (e += 1), e), 0);
208
- f(i <= 1, () => "There should be only one negative value in split array.");
209
- let a = t.indexOf(-1);
210
- if (a !== -1) {
211
- let r = t.reduce((e, t) => t > 0 ? e + t : e);
212
- t[a] = e.shape[n] - r;
213
- }
214
- f(e.shape[n] === t.reduce((e, t) => e + t), () => "The sum of sizes must match the size of the axis dimension."), r = t;
215
- }
216
- return r;
217
- }
218
- // node_modules/@tensorflow/tfjs-core/dist/ops/sparse/sparse_fill_empty_rows_util.js
219
- function B(e) {
220
- return `Received SparseTensor with denseShape[0] = 0 but
221
- indices.shape[0] = ${e}`;
222
- }
223
- function V(e, t) {
224
- return `indices(${e}, 0) is invalid: ${t} < 0`;
225
- }
226
- function H(e, t, n) {
227
- return `indices(${e}, 0) is invalid: ${t} >= ${n}`;
228
- }
229
- // node_modules/@tensorflow/tfjs-core/dist/ops/sparse/sparse_reshape_util.js
230
- function U(e, t) {
231
- return `only one output dimension may be -1, not both ${e} and ${t}`;
232
- }
233
- function W(e, t) {
234
- return `size ${e} must be non-negative, not ${t}`;
235
- }
236
- function G() {
237
- return "reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero";
238
- }
239
- function K(e, t) {
240
- return `Input to reshape is a SparseTensor with ${u(e)}
241
- dense values, but the requested shape requires a multiple of ${u(t)}. inputShape=${e} outputShape= ${t}`;
242
- }
243
- function q(e, t) {
244
- return `Input to reshape is a tensor with ${u(e)} dense values, but the requested shape has ${u(t)}. inputShape=${e} outputShape=${t}`;
245
- }
246
- // node_modules/@tensorflow/tfjs-core/dist/ops/sparse/sparse_segment_reduction_util.js
247
- function J() {
248
- return "segment ids must be >= 0";
249
- }
250
- function Y() {
251
- return "segment ids are not increasing";
252
- }
253
- function X(e, t) {
254
- return `Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`;
255
- }
256
- function Z(e, t, n) {
257
- return `Bad: indices[${e}] == ${t} out of range [0, ${n})`;
258
- }
259
- // node_modules/@tensorflow/tfjs-core/dist/ops/segment_util.js
260
- var He = /* @__PURE__ */ e({
261
- collectGatherOpShapeInfo: () => We,
262
- computeOutShape: () => Ue,
263
- segOpComputeOptimalWindowSize: () => Q
264
- });
265
- function Q(e, t) {
266
- let n = !1, r;
267
- for (e <= 30 ? (r = e, n = !0) : r = o(e, Math.floor(Math.sqrt(e))); !n;) r > t || r === e ? n = !0 : r = o(e, r + 1);
268
- return r;
269
- }
270
- function Ue(e, t, n) {
271
- let r = [], i = e.length;
272
- for (let a = 0; a < i; a++) a === t ? r.push(n) : r.push(e[a]);
273
- return r;
274
- }
275
- function We(e, t, n, r) {
276
- let i = t.shape.length, a = e.shape.length;
277
- if (r !== 0 && (r < -i || r > i)) throw Error(`Expect batchDims in the range of [-${i}, ${i}], but got ${r}`);
278
- if (r < 0 && (r += i), r > a) throw Error(`batchDims (${r}) must be less than rank(x) (
279
- ${a}).`);
280
- if (n < r) throw Error(`batchDims (${r}) must be less than or equal to axis (${n}).`);
281
- for (let n = 0; n < r; ++n) if (e.shape[n] !== t.shape[n]) throw Error(`x.shape[${n}]: ${e.shape[n]} should be equal to indices.shape[${n}]: ${t.shape[n]}.`);
282
- let o = e.shape[n], s = [], c = 1, l = 1, u = 1;
283
- for (let t = 0; t < r; ++t) s.push(e.shape[t]), c *= e.shape[t];
284
- for (let t = r; t < n; t++) s.push(e.shape[t]), l *= e.shape[t];
285
- for (let e = r; e < i; e++) s.push(t.shape[e]);
286
- for (let t = n + 1; t < a; t++) s.push(e.shape[t]), u *= e.shape[t];
287
- return {
288
- batchSize: c,
289
- sliceSize: u,
290
- outerSize: l,
291
- dimSize: o,
292
- outputShape: s
293
- };
294
- }
295
- // node_modules/@tensorflow/tfjs-core/dist/backends/backend_util.js
296
- var Ge = /* @__PURE__ */ e({
297
- ERF_A1: () => E,
298
- ERF_A2: () => D,
299
- ERF_A3: () => O,
300
- ERF_A4: () => k,
301
- ERF_A5: () => A,
302
- ERF_P: () => T,
303
- PARALLELIZE_THRESHOLD: () => 30,
304
- RowPartitionType: () => m,
305
- SELU_SCALE: () => Ee,
306
- SELU_SCALEALPHA: () => Ce,
307
- applyActivation: () => Te,
308
- assertAndGetBroadcastShape: () => t,
309
- assertAxesAreInnerMostDims: () => se,
310
- assertParamsConsistent: () => le,
311
- assignToTypedArray: () => Re,
312
- axesAreInnerMostDims: () => re,
313
- calculateShapes: () => Ae,
314
- checkEinsumDimSizes: () => I,
315
- checkPadOnDimRoundingMode: () => ye,
316
- combineLocations: () => ae,
317
- combineRaggedTensorToTensorShapes: () => h,
318
- complexWithEvenIndex: () => Pe,
319
- complexWithOddIndex: () => Ie,
320
- computeConv2DInfo: () => de,
321
- computeConv3DInfo: () => ge,
322
- computeDefaultPad: () => be,
323
- computeDilation2DInfo: () => fe,
324
- computeOptimalWindowSize: () => y,
325
- computeOutAndReduceShapes: () => ne,
326
- computeOutShape: () => ce,
327
- computePool2DInfo: () => pe,
328
- computePool3DInfo: () => ve,
329
- convertConv2DDataFormat: () => _e,
330
- decodeEinsumEquation: () => P,
331
- eitherStridesOrDilationsAreOne: () => he,
332
- expandShapeToKeepDim: () => ee,
333
- exponent: () => Ne,
334
- exponents: () => je,
335
- fromStringArrayToUint8: () => $,
336
- fromUint8ToStringArray: () => Ke,
337
- getAxesPermutation: () => ie,
338
- getBroadcastDims: () => d,
339
- getComplexWithIndex: () => Fe,
340
- getEinsumComputePath: () => L,
341
- getEinsumPermutation: () => F,
342
- getFusedBiasGradient: () => Se,
343
- getFusedDyActivation: () => xe,
344
- getImageCenter: () => ze,
345
- getInnerMostAxes: () => oe,
346
- getPermuted: () => x,
347
- getRaggedRank: () => _,
348
- getReductionAxes: () => i,
349
- getReshaped: () => b,
350
- getReshapedPermuted: () => S,
351
- getRowPartitionTypesHelper: () => g,
352
- getSliceBeginCoords: () => C,
353
- getSliceSize: () => w,
354
- getSparseFillEmptyRowsIndicesDenseShapeMismatch: () => B,
355
- getSparseFillEmptyRowsNegativeIndexErrorMessage: () => V,
356
- getSparseFillEmptyRowsOutOfRangeIndexErrorMessage: () => H,
357
- getSparseReshapeEmptyTensorZeroOutputDimErrorMessage: () => G,
358
- getSparseReshapeInputOutputMismatchErrorMessage: () => q,
359
- getSparseReshapeInputOutputMultipleErrorMessage: () => K,
360
- getSparseReshapeMultipleNegativeOneOutputDimErrorMessage: () => U,
361
- getSparseReshapeNegativeOutputDimErrorMessage: () => W,
362
- getSparseSegmentReductionIndicesOutOfRangeErrorMessage: () => Z,
363
- getSparseSegmentReductionNegativeSegmentIdsErrorMessage: () => J,
364
- getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage: () => Y,
365
- getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage: () => X,
366
- getUndoAxesPermutation: () => te,
367
- isIdentityPermutation: () => R,
368
- log: () => r,
369
- mergeRealAndImagArrays: () => Le,
370
- prepareAndValidate: () => p,
371
- prepareSplitSize: () => z,
372
- segment_util: () => He,
373
- shouldFuse: () => we,
374
- slice_util: () => De,
375
- splitRealAndImagArrays: () => Me,
376
- stridesOrDilationsArePositive: () => me,
377
- tupleValuesAreOne: () => ue,
378
- upcastType: () => c,
379
- validateDefaultValueShape: () => v,
380
- validateInput: () => Oe,
381
- validateUpdateShape: () => ke,
382
- warn: () => n
383
- });
384
- function Ke(e) {
385
- try {
386
- return e.map((e) => l(e));
387
- } catch (e) {
388
- throw Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`);
389
- }
390
- }
391
- function $(e) {
392
- return e.map((e) => s(e));
393
- }
394
- export { T as A, _ as B, F as C, O as D, D as E, w as F, v as H, ze as I, y as L, b as M, S as N, k as O, C as P, m as R, L as S, E as T, p as U, g as V, V as _, Ue as a, I as b, J as c, G as d, q as f, B as g, W as h, We as i, x as j, A as k, Y as l, U as m, $ as n, Q as o, K as p, Ke as r, Z as s, Ge as t, X as u, H as v, R as w, P as x, z as y, h as z };
@@ -1,20 +0,0 @@
1
- import { M as e, Q as t, Z as n, bi as r, ci as i, rt as a } from "./dist-CMMLi-qO.js";
2
- import { t as o } from "./reshape-DJb1jgMt.js";
3
- // node_modules/@tensorflow/tfjs-core/dist/ops/broadcast_to.js
4
- function s(n, s) {
5
- let c = t(n, "broadcastTo", "x"), l = c.shape;
6
- if (r(s), s.length < c.rank) throw Error(`broadcastTo(): shape.length=${s.length} < input.rank=${c.rank}.`);
7
- if (s.length > c.rank) {
8
- let e = c.shape.slice();
9
- for (; e.length < s.length;) e.unshift(1);
10
- c = o(c, e);
11
- }
12
- let u = c.shape, d = Array.from(s);
13
- for (let e = s.length - 1; e >= 0; e--) if (u[e] === s[e]) d[e] = 1;
14
- else if (c.shape[e] !== 1) throw Error(`broadcastTo(): [${l}] cannot be broadcast to [${s}].`);
15
- if (d.map((e, t) => e > 1 ? t : -1).filter((e) => e >= 0).length === 0) return e(c);
16
- let f = { x: c }, p = { reps: d };
17
- return a.runKernel(i, f, p);
18
- }
19
- var c = /* @__PURE__ */ n({ broadcastTo_: s });
20
- export { c as t };
@@ -1,55 +0,0 @@
1
- import { H as e, J as t } from "../dist-CMMLi-qO.js";
2
- import { t as n } from "../tensor4d-D1zRBipJ.js";
3
- // lib/checks/appendCache.ts
4
- async function r(r) {
5
- await t(r);
6
- let i = n([[[
7
- [
8
- .1,
9
- .2,
10
- 0,
11
- 0
12
- ],
13
- [
14
- .1,
15
- .2,
16
- 0,
17
- 0
18
- ],
19
- [
20
- 0,
21
- 0,
22
- 0,
23
- 0
24
- ],
25
- [
26
- 0,
27
- 0,
28
- 0,
29
- 0
30
- ]
31
- ]]], [
32
- 1,
33
- 1,
34
- 4,
35
- 4
36
- ]), a = n([[[[
37
- .1,
38
- .2,
39
- .3,
40
- .4
41
- ]]]], [
42
- 1,
43
- 1,
44
- 1,
45
- 4
46
- ]);
47
- return await e().runKernel("AppendCache", {
48
- cache: i,
49
- item: a
50
- }, {
51
- maxSize: 4,
52
- pastLen: 2
53
- }).array();
54
- }
55
- export { r as execute };
@@ -1,57 +0,0 @@
1
- import { H as e, J as t } from "../dist-CMMLi-qO.js";
2
- import { t as n } from "../tensor2d-ARItvqVn.js";
3
- import { t as r } from "../tensor4d-D1zRBipJ.js";
4
- // lib/checks/attentionMask.ts
5
- async function i(i) {
6
- await t(i);
7
- let a = r([[[[
8
- .1,
9
- .2,
10
- .3,
11
- .4
12
- ], [
13
- .3,
14
- .4,
15
- .5,
16
- .6
17
- ]]]], [
18
- 1,
19
- 1,
20
- 2,
21
- 4
22
- ]), o = r([[[[
23
- .5,
24
- .6,
25
- .5,
26
- .6
27
- ], [
28
- .7,
29
- .8,
30
- .7,
31
- .8
32
- ]]]], [
33
- 1,
34
- 1,
35
- 2,
36
- 4
37
- ]), s = n([[
38
- 0,
39
- -Infinity,
40
- -Infinity,
41
- -Infinity
42
- ], [
43
- 0,
44
- 0,
45
- 0,
46
- -Infinity
47
- ]], [2, 4]);
48
- return await e().runKernel("AttentionMask", {
49
- q: a,
50
- k: o,
51
- mask: s
52
- }, {
53
- divisor: .5,
54
- pastLen: 0
55
- }).array();
56
- }
57
- export { i as execute };
@@ -1,31 +0,0 @@
1
- import { arraysClose as e } from "../utilities/arrayClose.js";
2
- // lib/checks/check.ts
3
- async function t(t, n, r) {
4
- let i = r ?? [
5
- "cpu",
6
- "webgl",
7
- "webgpu"
8
- ], a = [];
9
- for (let e of i) try {
10
- let n = await t(e);
11
- a.push({
12
- backend: e,
13
- result: n,
14
- passed: !0
15
- });
16
- } catch (t) {
17
- a.push({
18
- backend: e,
19
- error: t.message,
20
- result: [],
21
- passed: !1
22
- });
23
- }
24
- let o = await Promise.all(a), s = o[0].result;
25
- for (let t = 1; t < o.length; t++) {
26
- let r = o[t].result, i = e(s, r);
27
- o[t].passed = i <= (n ?? 1e-6), o[t].maxError = i;
28
- }
29
- return o;
30
- }
31
- export { t as default };
@@ -1,46 +0,0 @@
1
- import { H as e, J as t } from "../dist-CMMLi-qO.js";
2
- import { t as n } from "../tensor2d-ARItvqVn.js";
3
- // lib/checks/gelu.ts
4
- async function r(r) {
5
- await t(r);
6
- let i = n([
7
- [
8
- .1,
9
- .2,
10
- 0,
11
- 0,
12
- 1230,
13
- 1232331234,
14
- -12234234
15
- ],
16
- [
17
- .1,
18
- .2,
19
- 0,
20
- 0,
21
- -1230,
22
- -1232331234,
23
- 12234234
24
- ],
25
- [
26
- 0,
27
- 0,
28
- 0,
29
- 0,
30
- -1,
31
- 0,
32
- 0
33
- ],
34
- [
35
- 0,
36
- 0,
37
- 0,
38
- 0,
39
- -.1,
40
- .001,
41
- 0
42
- ]
43
- ], [4, 7]);
44
- return await e().runKernel("Gelu", { x: i }).array();
45
- }
46
- export { r as execute };
@@ -1,27 +0,0 @@
1
- import { execute as e } from "./rope.js";
2
- import { execute as t } from "./normRMS.js";
3
- import { t as n } from "../qkv-BQfNPucX.js";
4
- import { execute as r } from "./gelu.js";
5
- import { execute as i } from "./normRMSGrad.js";
6
- import { execute as a } from "./appendCache.js";
7
- import { execute as o } from "./attentionMask.js";
8
- import { execute as s } from "./matMulGelu.js";
9
- import { execute as c } from "./packUnpack.js";
10
- import l from "./check.js";
11
- import { createTensorStatistics as u, createWeightStatistics as d } from "./weights.js";
12
- // lib/checks/index.ts
13
- var f = {
14
- rope: e,
15
- qkv: n,
16
- gelu: r,
17
- normRMS: t,
18
- normRMSGrad: i,
19
- appendCache: a,
20
- attentionMask: o,
21
- matMulGelu: s,
22
- packUnpack: c,
23
- runCheck: l,
24
- createLayerWeightStatistics: d,
25
- createWeightStatistics: u
26
- };
27
- export { f as default };