@genai-fi/nanogpt 1.6.1 → 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-8IK28IWR.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,685 +0,0 @@
1
- import { C as e, D as t, N as n, O as r, Q as i, Y as a, Z as o, gi as s, j as c, k as l, m as u, qi as d, rt as f, st as ee, ut as p, vt as m, yi as h, z as g } from "./dist-CMMLi-qO.js";
2
- import { a as _ } from "./step-DA-5DNu9.js";
3
- import { t as v } from "./reshape-DJb1jgMt.js";
4
- import { t as y } from "./concat-Oip5acVY.js";
5
- import { t as b } from "./mat_mul-R9_DWmIT.js";
6
- import { t as x } from "./slice-Dlb1FlzG.js";
7
- import { t as S } from "./clip_by_value-D-UX9am5.js";
8
- import { t as C } from "./tile-DfyQ0KX-.js";
9
- import { t as te } from "./floor-BwjmUb7X.js";
10
- import { t as w } from "./gather-B5Z1RFt5.js";
11
- import { t as T } from "./transpose-BC-M_OoT.js";
12
- import { t as E } from "./random_normal-DUIT8kyC.js";
13
- import { n as D, t as O } from "./dropout_util-SiFMbFXz.js";
14
- import { t as k } from "./tensor1d-BHgkkhTE.js";
15
- import { a as ne, i as re, o as ie, r as ae } from "./selu_util-DeOTf-sc.js";
16
- // node_modules/@tensorflow/tfjs-core/dist/ops/concat_1d.js
17
- function A(e) {
18
- return y(e, 0);
19
- }
20
- var j = /* @__PURE__ */ o({ concat1d_: A });
21
- // node_modules/@tensorflow/tfjs-core/dist/ops/concat_2d.js
22
- function M(e, t) {
23
- return y(e, t);
24
- }
25
- var N = /* @__PURE__ */ o({ concat2d_: M });
26
- // node_modules/@tensorflow/tfjs-core/dist/ops/concat_3d.js
27
- function P(e, t) {
28
- return y(e, t);
29
- }
30
- var oe = /* @__PURE__ */ o({ concat3d_: P });
31
- // node_modules/@tensorflow/tfjs-core/dist/ops/concat_4d.js
32
- function se(e, t) {
33
- return y(e, t);
34
- }
35
- var ce = /* @__PURE__ */ o({ concat4d_: se });
36
- // node_modules/@tensorflow/tfjs-core/dist/ops/slice1d.js
37
- function le(e, t, n) {
38
- let r = i(e, "x", "slice1d");
39
- return h(r.rank === 1, () => `slice1d expects a rank-1 tensor, but got a rank-${r.rank} tensor`), x(r, [t], [n]);
40
- }
41
- var F = /* @__PURE__ */ o({ slice1d_: le });
42
- // node_modules/@tensorflow/tfjs-core/dist/ops/slice2d.js
43
- function ue(e, t, n) {
44
- let r = i(e, "x", "slice2d");
45
- return h(r.rank === 2, () => `slice2d expects a rank-2 tensor, but got a rank-${r.rank} tensor`), x(r, t, n);
46
- }
47
- var de = /* @__PURE__ */ o({ slice2d_: ue });
48
- // node_modules/@tensorflow/tfjs-core/dist/ops/slice3d.js
49
- function fe(e, t, n) {
50
- let r = i(e, "x", "slice3d");
51
- return h(r.rank === 3, () => `slice3d expects a rank-3 tensor, but got a rank-${r.rank} tensor`), x(r, t, n);
52
- }
53
- var I = /* @__PURE__ */ o({ slice3d_: fe });
54
- // node_modules/@tensorflow/tfjs-core/dist/ops/slice4d.js
55
- function pe(e, t, n) {
56
- let r = i(e, "x", "slice4d");
57
- return h(r.rank === 4, () => `slice4d expects a rank-4 tensor, but got a rank-${r.rank} tensor`), x(r, t, n);
58
- }
59
- var L = /* @__PURE__ */ o({ slice4d_: pe });
60
- // node_modules/@tensorflow/tfjs-core/dist/ops/dropout.js
61
- function me(e, t, n, a) {
62
- let o = i(e, "x", "dropout");
63
- if (h(o.dtype === "float32", () => `x has to be a floating point tensor since it's going to be scaled, but got a ${o.dtype} tensor instead.`), h(t >= 0 && t < 1, () => `rate must be a float in the range [0, 1), but got ${t}.`), t === 0) return e instanceof p ? o.clone() : o;
64
- let s = O(o, n), u = 1 - t, d = l(te(c(D(s, 0, 1, "float32", a), u)), u);
65
- return r(o, d);
66
- }
67
- var he = /* @__PURE__ */ o({ dropout_: me });
68
- // node_modules/@tensorflow/tfjs-core/dist/ops/fused/mat_mul.js
69
- function ge({ a: t, b: n, transposeA: r = !1, transposeB: a = !1, bias: o, activation: l = "linear", preluActivationWeights: p, leakyreluAlpha: m = .2 }) {
70
- if (ie(f.state.gradientDepth, l) === !1) {
71
- let e = b(t, n, r, a);
72
- return o != null && (e = c(e, o)), ae(e, l, p, m);
73
- }
74
- let g = i(t, "a", "fused matMul"), _ = i(n, "b", "fused matMul");
75
- [g, _] = ee(g, _);
76
- let y = r ? g.shape[g.rank - 2] : g.shape[g.rank - 1], x = a ? _.shape[_.rank - 1] : _.shape[_.rank - 2], S = r ? g.shape[g.rank - 1] : g.shape[g.rank - 2], C = a ? _.shape[_.rank - 2] : _.shape[_.rank - 1], te = g.shape.slice(0, -2), w = _.shape.slice(0, -2), T = d(te), E = d(w);
77
- h(y === x, () => `Error in fused matMul: inner shapes (${y}) and (${x}) of Tensors with shapes ${g.shape} and ${_.shape} and transposeA=${r} and transposeB=${a} must match.`);
78
- let D = e(g.shape.slice(0, -2), _.shape.slice(0, -2)).concat([S, C]), O = r ? v(g, [
79
- T,
80
- y,
81
- S
82
- ]) : v(g, [
83
- T,
84
- S,
85
- y
86
- ]), k = a ? v(_, [
87
- E,
88
- C,
89
- x
90
- ]) : v(_, [
91
- E,
92
- x,
93
- C
94
- ]), A;
95
- o != null && (A = i(o, "bias", "fused matMul"), [A] = ee(A, g), e(D, A.shape));
96
- let j;
97
- p != null && (j = i(p, "prelu weights", "fused matMul"));
98
- let M = (e, t) => {
99
- let [n, i, s, c] = t, u = ne(v(e, s.shape), s, l), d, f;
100
- if (!r && !a ? (d = b(u, i, !1, !0), f = b(n, u, !0, !1)) : !r && a ? (d = b(u, i, !1, !1), f = b(u, n, !0, !1)) : r && !a ? (d = b(i, u, !1, !0), f = b(n, u, !1, !1)) : (d = b(i, u, !0, !0), f = b(u, n, !0, !0)), o != null) {
101
- let e = re(c, u);
102
- return [
103
- d,
104
- f,
105
- e
106
- ];
107
- }
108
- return [d, f];
109
- }, N = {
110
- a: O,
111
- b: k,
112
- bias: A,
113
- preluActivationWeights: j
114
- }, P = {
115
- transposeA: r,
116
- transposeB: a,
117
- activation: l,
118
- leakyreluAlpha: m
119
- };
120
- return o == null ? u((e, t, n) => {
121
- let r = f.runKernel(s, N, P);
122
- return n([
123
- e,
124
- t,
125
- r
126
- ]), {
127
- value: v(r, D),
128
- gradFunc: M
129
- };
130
- })(O, k) : u((e, t, n, r) => {
131
- let i = f.runKernel(s, N, P);
132
- return r([
133
- e,
134
- t,
135
- i,
136
- n
137
- ]), {
138
- value: v(i, D),
139
- gradFunc: M
140
- };
141
- })(O, k, A);
142
- }
143
- var R = /* @__PURE__ */ o({ fusedMatMul_: ge }), _e = ["channelsFirst", "channelsLast"], ve = ["nearest", "bilinear"], ye = [
144
- "valid",
145
- "same",
146
- "causal"
147
- ], be = ["max", "avg"], xe = [
148
- "sum",
149
- "mul",
150
- "concat",
151
- "ave"
152
- ], Se = class e extends Error {
153
- constructor(t) {
154
- super(t), Object.setPrototypeOf(this, e.prototype);
155
- }
156
- }, Ce = class e extends Error {
157
- constructor(t) {
158
- super(t), Object.setPrototypeOf(this, e.prototype);
159
- }
160
- }, z = class e extends Error {
161
- constructor(t) {
162
- super(t), Object.setPrototypeOf(this, e.prototype);
163
- }
164
- }, B = class e extends Error {
165
- constructor(t) {
166
- super(t), Object.setPrototypeOf(this, e.prototype);
167
- }
168
- }, we = class e extends Error {
169
- constructor(t) {
170
- super(t), Object.setPrototypeOf(this, e.prototype);
171
- }
172
- };
173
- // node_modules/@tensorflow/tfjs-layers/dist/utils/generic_utils.js
174
- function Te(e, t) {
175
- if (Array.isArray(e)) {
176
- let n = [];
177
- for (let r = 0; r < t; r++) n = n.concat(e);
178
- return n;
179
- }
180
- {
181
- let n = Array(t);
182
- return n.fill(e), n;
183
- }
184
- }
185
- function V(e, t) {
186
- if (!e) throw new we(t);
187
- }
188
- function Ee(e, t) {
189
- let n = 0;
190
- for (let r of e) r === t && n++;
191
- return n;
192
- }
193
- function De(e) {
194
- return e.length === 1 ? e[0] : e;
195
- }
196
- function Oe(e) {
197
- return Array.isArray(e) ? e : [e];
198
- }
199
- function ke(e) {
200
- let t = e.replace(/(.)([A-Z][a-z0-9]+)/g, "$1_$2").replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
201
- return t[0] === "_" ? "private" + t : t;
202
- }
203
- function Ae(e) {
204
- return e.length <= 1 || e.indexOf("_") === -1 ? e : e.replace(/[_]+(\w|$)/g, (e, t) => t.toUpperCase());
205
- }
206
- var H = {};
207
- function je(e) {
208
- if (e == null) return null;
209
- let t = {};
210
- return t.className = e.getClassName(), t.config = e.getConfig(), t;
211
- }
212
- function U(e) {
213
- if (typeof e == "object" && e) {
214
- if (Array.isArray(e)) e.forEach((e) => U(e));
215
- else {
216
- let t = Object.keys(e);
217
- for (let n of t) {
218
- let t = e[n];
219
- typeof t == "object" && t && (!Array.isArray(t) && t.type === "ndarray" && typeof t.value == "number" ? e[n] = t.value : U(t));
220
- }
221
- }
222
- }
223
- }
224
- function Me(e, t = {}, n = {}, r = "object", i = !1) {
225
- if (typeof e == "string") {
226
- let i = e, a;
227
- if (i in n) a = n[i];
228
- else if (i in H) a = H[i];
229
- else if (a = t[i], a == null) throw new z(`Unknown ${r}: ${e}. This may be due to one of the following reasons:\n1. The ${r} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom ${r} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);
230
- return a;
231
- }
232
- {
233
- let a = e;
234
- if (a.className == null || a.config == null) throw new z(`${r}: Improper config format: ${JSON.stringify(a)}.\n'className' and 'config' must set.`);
235
- let o = a.className, s, c;
236
- if (o in n ? [s, c] = n[o] : o in H ? [s, c] = H.className : o in t && ([s, c] = t[o]), s == null) throw new z(`Unknown ${r}: ${o}. This may be due to one of the following reasons:\n1. The ${r} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.\n2. The custom ${r} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);
237
- if (c != null) {
238
- let e = {};
239
- for (let t of Object.keys(H)) e[t] = H[t];
240
- for (let t of Object.keys(n)) e[t] = n[t];
241
- let t = a.config;
242
- t.customObjects = e;
243
- let r = Object.assign({}, H);
244
- for (let e of Object.keys(n)) H[e] = n[e];
245
- U(a.config);
246
- let o = c(s, a.config, n, i);
247
- return H = Object.assign({}, r), o;
248
- }
249
- {
250
- let e = Object.assign({}, H);
251
- for (let e of Object.keys(n)) H[e] = n[e];
252
- let t = new s(a.config);
253
- return H = Object.assign({}, e), t;
254
- }
255
- }
256
- }
257
- function Ne(e, t) {
258
- return e < t ? -1 : +(e > t);
259
- }
260
- function Pe(e, t) {
261
- return -1 * Ne(e, t);
262
- }
263
- function Fe(e) {
264
- if (e == null) return e;
265
- let t = [];
266
- for (let n of e) t.indexOf(n) === -1 && t.push(n);
267
- return t;
268
- }
269
- function Ie(e) {
270
- if (e == null) throw new z(`Invalid value in obj: ${JSON.stringify(e)}`);
271
- for (let t in e) if (e.hasOwnProperty(t)) return !1;
272
- return !0;
273
- }
274
- function W(e, t, n) {
275
- if (n != null && e.indexOf(n) < 0) throw new z(`${n} is not a valid ${t}. Valid values are ${e} or null/undefined.`);
276
- }
277
- function Le(e, t, n = 0, r = Infinity) {
278
- return V(n >= 0), V(r >= n), Array.isArray(e) && e.length >= n && e.length <= r && e.every((e) => typeof e === t);
279
- }
280
- function Re(e, t) {
281
- Array.isArray(e) ? (h(e.length > 0, () => `${t} is unexpectedly an empty array.`), e.forEach((e, n) => Re(e, `element ${n + 1} of ${t}`))) : h(Number.isInteger(e) && e > 0, () => `Expected ${t} to be a positive integer, but got ${ze(e)}.`);
282
- }
283
- function ze(e) {
284
- return e === null ? "null" : Array.isArray(e) ? "[" + e.map((e) => ze(e)).join(",") + "]" : typeof e == "string" ? `"${e}"` : `${e}`;
285
- }
286
- function Be(e, t, n) {
287
- let r = n == null ? m() : n(), i;
288
- return (...a) => {
289
- let o = n == null ? m() : n();
290
- return o - r < t || (r = o, i = e(...a)), i;
291
- };
292
- }
293
- function Ve(e) {
294
- return e === "relu" ? "relu" : e === "linear" ? "linear" : e === "elu" ? "elu" : null;
295
- }
296
- // node_modules/@tensorflow/tfjs-layers/dist/common.js
297
- var G = /* @__PURE__ */ new Map();
298
- function He(e) {
299
- W(_e, "DataFormat", e);
300
- }
301
- function Ue(e) {
302
- W(ve, "InterpolationFormat", e);
303
- }
304
- function We(e) {
305
- W(ye, "PaddingMode", e);
306
- }
307
- function Ge(e) {
308
- W(be, "PoolMode", e);
309
- }
310
- var K = [], q = "/";
311
- function Ke(e, t) {
312
- K.push(e);
313
- try {
314
- let e = t();
315
- return K.pop(), e;
316
- } catch (e) {
317
- throw K.pop(), e;
318
- }
319
- }
320
- function qe() {
321
- return K.length === 0 ? "" : K.join(q) + q;
322
- }
323
- function Je(e) {
324
- if (!J(e)) throw Error("Not a valid tensor name: '" + e + "'");
325
- return qe() + e;
326
- }
327
- function Ye(e) {
328
- if (!J(e)) throw Error("Not a valid tensor name: '" + e + "'");
329
- G.has(e) || G.set(e, 0);
330
- let t = G.get(e);
331
- if (G.set(e, G.get(e) + 1), t > 0) {
332
- let n = `${e}_${t}`;
333
- return G.set(n, 1), n;
334
- }
335
- return e;
336
- }
337
- var Xe = /* @__PURE__ */ new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);
338
- function J(e) {
339
- return !!e.match(Xe);
340
- }
341
- // node_modules/@tensorflow/tfjs-layers/dist/utils/math_utils.js
342
- function Ze(e) {
343
- return e === parseInt(e.toString(), 10);
344
- }
345
- function Y(e, t, n) {
346
- t ??= 0, n ??= e.length;
347
- let r = 1;
348
- for (let i = t; i < n; ++i) r *= e[i];
349
- return r;
350
- }
351
- function Qe(e) {
352
- if (e.length === 0) return NaN;
353
- let t = Infinity;
354
- for (let n = 0; n < e.length; n++) {
355
- let r = e[n];
356
- r < t && (t = r);
357
- }
358
- return t;
359
- }
360
- function $e(e) {
361
- if (e.length === 0) return NaN;
362
- let t = -Infinity;
363
- for (let n = 0; n < e.length; n++) {
364
- let r = e[n];
365
- r > t && (t = r);
366
- }
367
- return t;
368
- }
369
- function et(e, t) {
370
- if (t < e) throw new z(`end (${t}) < begin (${e}) is forbidden.`);
371
- let n = [];
372
- for (let r = e; r < t; ++r) n.push(r);
373
- return n;
374
- }
375
- // node_modules/@tensorflow/tfjs-layers/dist/backend/common.js
376
- var tt;
377
- function nt() {
378
- return tt ??= g().epsilon(), tt;
379
- }
380
- function X() {
381
- return "channelsLast";
382
- }
383
- // node_modules/@tensorflow/tfjs-layers/dist/backend/tfjs_backend.js
384
- function rt(e, t) {
385
- return n(e, t);
386
- }
387
- function it(e, t = -1) {
388
- let n = e.shape.slice();
389
- return t < 0 && (t = n.length + t + 1), n.splice(t, 0, 1), v(e, n);
390
- }
391
- function at(e, t) {
392
- return a(() => {
393
- if (e.shape.length !== 2) throw new z(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);
394
- return dt(it(e, 1), [
395
- 1,
396
- t,
397
- 1
398
- ]);
399
- });
400
- }
401
- function ot(e) {
402
- let t = [Y(e.shape)];
403
- return v(e, t);
404
- }
405
- function st(e) {
406
- if (e.rank <= 1) throw new z(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);
407
- let t = [e.shape[0], Y(e.shape, 1)];
408
- return v(e, t);
409
- }
410
- function Z(e, t, n) {
411
- return a(() => {
412
- switch (e.rank) {
413
- case 1: return F(e, t, n);
414
- case 2: return de(e, [t, 0], [n, e.shape[1]]);
415
- case 3: return I(e, [
416
- t,
417
- 0,
418
- 0
419
- ], [
420
- n,
421
- e.shape[1],
422
- e.shape[2]
423
- ]);
424
- case 4: return L(e, [
425
- t,
426
- 0,
427
- 0,
428
- 0
429
- ], [
430
- n,
431
- e.shape[1],
432
- e.shape[2],
433
- e.shape[3]
434
- ]);
435
- case 5: return x(e, [
436
- t,
437
- 0,
438
- 0,
439
- 0,
440
- 0
441
- ], [
442
- n,
443
- e.shape[1],
444
- e.shape[2],
445
- e.shape[3],
446
- e.shape[4]
447
- ]);
448
- case 6: return x(e, [
449
- t,
450
- 0,
451
- 0,
452
- 0,
453
- 0,
454
- 0
455
- ], [
456
- n,
457
- e.shape[1],
458
- e.shape[2],
459
- e.shape[3],
460
- e.shape[4],
461
- e.shape[5]
462
- ]);
463
- default: throw new z(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`);
464
- }
465
- });
466
- }
467
- function Q(e, t, n) {
468
- return a(() => {
469
- switch (e.rank) {
470
- case 1: return F(e, t, n);
471
- case 2: return de(e, [0, t], [e.shape[0], n]);
472
- case 3: return I(e, [
473
- 0,
474
- 0,
475
- t
476
- ], [
477
- e.shape[0],
478
- e.shape[1],
479
- n
480
- ]);
481
- case 4: return L(e, [
482
- 0,
483
- 0,
484
- 0,
485
- t
486
- ], [
487
- e.shape[0],
488
- e.shape[1],
489
- e.shape[2],
490
- n
491
- ]);
492
- default: throw new z(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`);
493
- }
494
- });
495
- }
496
- function ct(e, t, n, r) {
497
- return a(() => {
498
- switch (e.rank) {
499
- case 1: return F(e, t, n);
500
- case 2: switch (r) {
501
- case 1: return Z(e, t, n);
502
- case 2: return Q(e, t, n);
503
- default: throw new z(`The axis is not within the rank of the tensor ${r}`);
504
- }
505
- case 3: switch (r) {
506
- case 1: return Z(e, t, n);
507
- case 2: return I(e, [
508
- 0,
509
- t,
510
- 0
511
- ], [
512
- e.shape[0],
513
- n,
514
- e.shape[2]
515
- ]);
516
- case 3: return Q(e, t, n);
517
- default: throw new z(`The axis is not within the rank of the tensor ${r}`);
518
- }
519
- case 4: switch (r) {
520
- case 1: return Z(e, t, n);
521
- case 2: return L(e, [
522
- 0,
523
- t,
524
- 0,
525
- 0
526
- ], [
527
- e.shape[0],
528
- n,
529
- e.shape[2],
530
- e.shape[3]
531
- ]);
532
- case 3: return L(e, [
533
- 0,
534
- 0,
535
- t,
536
- 0
537
- ], [
538
- e.shape[0],
539
- e.shape[1],
540
- n,
541
- e.shape[3]
542
- ]);
543
- case 4: return Q(e, t, n);
544
- default: throw new z(`The axis is not within the rank of the tensor ${r}`);
545
- }
546
- default: throw new z(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`);
547
- }
548
- });
549
- }
550
- function lt(e, t = -1) {
551
- let n;
552
- return t < 0 && (n = e[0].rank, t = n === 0 ? 0 : n), t === e[0].rank && (t = -1), y(e, t);
553
- }
554
- function ut(e, t) {
555
- switch (e.rank) {
556
- case 1: return j([e, t]);
557
- case 2: return N([e, t], 0);
558
- case 3: return oe([e, t], 0);
559
- case 4: return ce([e, t], 0);
560
- default: throw new z(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`);
561
- }
562
- }
563
- function dt(e, t) {
564
- if (Array.isArray(t) || (t = [t]), e.rank !== t.length) throw new z(`The length of input n (${t.length}) does not match the number of dimensions in input x (${e.rank})`);
565
- return C(e, t);
566
- }
567
- function ft(e, t = 0, n = 1, r, i) {
568
- return E(e, t, n, r, i);
569
- }
570
- function pt(e, t, n, r) {
571
- if (e.rank < 2 || t.rank < 2) throw new B(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${t.shape}`);
572
- if (t.rank >= 3 && e.shape.slice(-1)[0] !== t.shape.slice(-2)[0]) throw new B(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${t.shape}`);
573
- if (e.rank === 2 && t.rank === 2) return R({
574
- a: e,
575
- b: t,
576
- transposeA: !1,
577
- transposeB: !1,
578
- bias: r ? $(e.rank, r, X()) : null,
579
- activation: n
580
- });
581
- {
582
- let i = e.shape.slice(), a = i.pop();
583
- e = v(e, [-1, a]);
584
- let o = t.shape.slice(), s = o.pop(), c = o.pop(), l = [...o, s], u = Array.from({ length: t.rank }, (e, n) => n === 0 ? t.rank - 2 : n <= t.rank - 2 ? n - 1 : n);
585
- t = v(T(t, u), [c, -1]);
586
- let d = [...i, ...l];
587
- return v(R({
588
- a: e,
589
- b: t,
590
- transposeA: !1,
591
- transposeB: !1,
592
- bias: r ? $(e.rank, r, X()) : null,
593
- activation: n
594
- }), d);
595
- }
596
- }
597
- function mt(e, t, r) {
598
- return a(() => (t = Array.isArray(t) ? k(t, "int32") : n(t, "int32"), w(e, t, r)));
599
- }
600
- function ht(e) {
601
- return r(e, e);
602
- }
603
- function $(e, t, n) {
604
- let r = t.shape;
605
- if (t.rank !== 1 && t.rank !== e) throw new z(`Unexpected bias dimensions: ${t.rank}; expected it to be 1 or ${e}`);
606
- if (e === 5) {
607
- if (n === "channelsFirst") return r.length === 1 ? v(t, [
608
- 1,
609
- r[0],
610
- 1,
611
- 1,
612
- 1
613
- ]) : v(t, [
614
- 1,
615
- r[3],
616
- r[0],
617
- r[1],
618
- r[2]
619
- ]);
620
- if (n === "channelsLast") return r.length === 1 ? v(t, [
621
- 1,
622
- 1,
623
- 1,
624
- 1,
625
- r[0]
626
- ]) : v(t, [1].concat(r));
627
- } else if (e === 4) {
628
- if (n === "channelsFirst") return r.length === 1 ? v(t, [
629
- 1,
630
- r[0],
631
- 1,
632
- 1
633
- ]) : v(t, [
634
- 1,
635
- r[2],
636
- r[0],
637
- r[1]
638
- ]);
639
- if (n === "channelsLast") return r.length === 1 ? v(t, [
640
- 1,
641
- 1,
642
- 1,
643
- r[0]
644
- ]) : v(t, [1].concat(r));
645
- } else if (e === 3) {
646
- if (n === "channelsFirst") return r.length === 1 ? v(t, [
647
- 1,
648
- r[0],
649
- 1
650
- ]) : v(t, [
651
- 1,
652
- r[1],
653
- r[0]
654
- ]);
655
- if (n === "channelsLast") return r.length === 1 ? v(t, [
656
- 1,
657
- 1,
658
- r[0]
659
- ]) : v(t, [1].concat(r));
660
- } else if (e < 3) return t;
661
- throw new z(`Unsupported input rank by biasAdd: ${t.rank}`);
662
- }
663
- function gt(e, t, n) {
664
- return a(() => (n ??= X(), He(n), c(e, $(e.rank, t, n))));
665
- }
666
- function _t(e, t = 1) {
667
- if (t !== 1) throw new B(`Support for alpha values other than 1 (${t}) is not implemented yet.`);
668
- return _(e);
669
- }
670
- function vt(e) {
671
- return a(() => l(e, c(t(e), 1)));
672
- }
673
- function yt(e, t, n, r) {
674
- return a(() => he(e, t, n, r));
675
- }
676
- function bt(e) {
677
- return a(() => {
678
- let t = c(.5, r(.2, e));
679
- return S(t, 0, 1);
680
- });
681
- }
682
- function xt(e, t, n = !1) {
683
- return n ? e() : t();
684
- }
685
- export { B as $, We as A, Be as B, Y as C, et as D, Qe as E, V as F, Pe as G, Ie as H, Re as I, Ae as J, je as K, Le as L, Je as M, Ye as N, He as O, Ke as P, Se as Q, W as R, X as S, $e as T, Ve as U, Me as V, Te as W, ke as X, Oe as Y, Fe as Z, Z as _, lt as a, dt as b, _t as c, mt as d, Ce as et, bt as f, ct as g, at as h, ut as i, Ge as j, Ue as k, it as l, ft as m, gt as n, xe as nt, pt as o, xt as p, De as q, rt as r, yt as s, st as t, z as tt, ot as u, vt as v, Ze as w, nt as x, ht as y, Ee as z };
@@ -1,10 +0,0 @@
1
- import { Q as e, Z as t, ci as n, rt as r, yi as i } from "./dist-CMMLi-qO.js";
2
- // node_modules/@tensorflow/tfjs-core/dist/ops/tile.js
3
- function a(t, a) {
4
- let o = e(t, "x", "tile", "string_or_numeric");
5
- i(o.rank === a.length, () => `Error in transpose: rank of input ${o.rank} must match length of reps ${a}.`);
6
- let s = { x: o }, c = { reps: a };
7
- return r.runKernel(n, s, c);
8
- }
9
- var o = /* @__PURE__ */ t({ tile_: a });
10
- export { o as t };
@@ -1,14 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CwxnZyOB.js";
2
- import t from "./tokeniser/CharTokeniser.js";
3
- import n from "./tokeniser/bpe.js";
4
- import { tokensFromStreams as r } from "./training/tasks/tokenStream.js";
5
- import { TokenStore as i, createTokenStore as a } from "./training/tasks/TokenStore.js";
6
- // lib/tokenise.ts
7
- var o = /* @__PURE__ */ e({
8
- BPETokeniser: () => n,
9
- CharTokeniser: () => t,
10
- TokenStore: () => i,
11
- createTokenStore: () => a,
12
- tokensFromStreams: () => r
13
- });
14
- export { o as t };
package/dist/tokenise.js DELETED
@@ -1,6 +0,0 @@
1
- import e from "./tokeniser/CharTokeniser.js";
2
- import t from "./tokeniser/bpe.js";
3
- import { TokenStore as n, createTokenStore as r } from "./training/tasks/TokenStore.js";
4
- import { tokensFromStreams as i } from "./training/tasks/tokenStream.js";
5
- import "./tokenise-DbS2Ea-T.js";
6
- export { t as BPETokeniser, e as CharTokeniser, n as TokenStore, r as createTokenStore, i as tokensFromStreams };