@genai-fi/nanogpt 0.19.1 → 0.20.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 (482) hide show
  1. package/package.json +9 -10
  2. package/dist/Generator.d.ts +0 -82
  3. package/dist/Generator.js +0 -11941
  4. package/dist/RealDiv-CGwv0liw.js +0 -365
  5. package/dist/Reshape-BW__R4mZ.js +0 -79
  6. package/dist/Reshape-CPBkTIH2.js +0 -14
  7. package/dist/TeachableLLM.d.ts +0 -70
  8. package/dist/TeachableLLM.js +0 -273
  9. package/dist/Trainer.d.ts +0 -43
  10. package/dist/Trainer.js +0 -244
  11. package/dist/_commonjsHelpers-ByX85dGu.js +0 -33
  12. package/dist/axis_util-GTVlo58H.js +0 -55
  13. package/dist/backend.d.ts +0 -2
  14. package/dist/backend.js +0 -13
  15. package/dist/backend_util-GaFarB78.js +0 -425
  16. package/dist/backend_webgpu-BqASlsbV.js +0 -545
  17. package/dist/binary_op_util-pKXltfxI.js +0 -192
  18. package/dist/broadcast_to-eS93CCN_.js +0 -28
  19. package/dist/checks/appendCache.d.ts +0 -1
  20. package/dist/checks/appendCache.js +0 -22
  21. package/dist/checks/attentionMask.d.ts +0 -1
  22. package/dist/checks/attentionMask.js +0 -37
  23. package/dist/checks/check.d.ts +0 -9
  24. package/dist/checks/check.js +0 -20
  25. package/dist/checks/gelu.d.ts +0 -1
  26. package/dist/checks/gelu.js +0 -18
  27. package/dist/checks/index.d.ts +0 -26
  28. package/dist/checks/index.js +0 -28
  29. package/dist/checks/matMulGelu.d.ts +0 -1
  30. package/dist/checks/matMulGelu.js +0 -28
  31. package/dist/checks/normRMS.d.ts +0 -1
  32. package/dist/checks/normRMS.js +0 -16
  33. package/dist/checks/normRMSGrad.d.ts +0 -1
  34. package/dist/checks/normRMSGrad.js +0 -12
  35. package/dist/checks/packUnpack.d.ts +0 -1
  36. package/dist/checks/packUnpack.js +0 -18
  37. package/dist/checks/qkv.d.ts +0 -1
  38. package/dist/checks/qkv.js +0 -34
  39. package/dist/checks/rope.d.ts +0 -1
  40. package/dist/checks/rope.js +0 -36
  41. package/dist/checks/weights.d.ts +0 -14
  42. package/dist/checks/weights.js +0 -31
  43. package/dist/clip_by_value-DDA7rrcT.js +0 -12
  44. package/dist/complex-DI35Q-gW.js +0 -11
  45. package/dist/complex_util-Yc1A_gV1.js +0 -55
  46. package/dist/concat-CAQpCret.js +0 -17
  47. package/dist/concat_util-D18dJ4fD.js +0 -22
  48. package/dist/data/docx.d.ts +0 -2
  49. package/dist/data/docx.js +0 -15
  50. package/dist/data/parquet.d.ts +0 -2
  51. package/dist/data/parquet.js +0 -17
  52. package/dist/data/pdf.d.ts +0 -2
  53. package/dist/data/pdf.js +0 -14
  54. package/dist/data/textLoader.d.ts +0 -7
  55. package/dist/data/textLoader.js +0 -118
  56. package/dist/dataset-CGGp1z9P.js +0 -1124
  57. package/dist/dropout_util--NxWuYg2.js +0 -27
  58. package/dist/expand_dims-Bkd1YD5x.js +0 -11
  59. package/dist/exports_initializers-CYzKLjN7.js +0 -7
  60. package/dist/floor-BQtb-Azg.js +0 -9
  61. package/dist/gather-qIqEqaGn.js +0 -9
  62. package/dist/gelu-B220X1Go.js +0 -26
  63. package/dist/gpgpu_math-BwvV12df.js +0 -2022
  64. package/dist/index-CUXkjxiT.js +0 -3516
  65. package/dist/index-CieiGp4Y.js +0 -349
  66. package/dist/index-CjOWnMXP.js +0 -7308
  67. package/dist/index-Cp39cXWe.js +0 -1016
  68. package/dist/index-D5v913EJ.js +0 -4
  69. package/dist/index-DmeWGGmS.js +0 -1074
  70. package/dist/index-DvYrXKkX.js +0 -113
  71. package/dist/index-Ksja3su6.js +0 -151
  72. package/dist/index-xuotMAFm.js +0 -118
  73. package/dist/inference/types.d.ts +0 -16
  74. package/dist/inference/types.js +0 -1
  75. package/dist/jszip.min-BZhlzntC.js +0 -2313
  76. package/dist/kernel_funcs_utils-pq0CK9co.js +0 -306
  77. package/dist/layers/BaseLayer.d.ts +0 -44
  78. package/dist/layers/BaseLayer.js +0 -74
  79. package/dist/layers/CausalSelfAttention.d.ts +0 -39
  80. package/dist/layers/CausalSelfAttention.js +0 -86
  81. package/dist/layers/LoRA.d.ts +0 -14
  82. package/dist/layers/LoRA.js +0 -58
  83. package/dist/layers/MLP.d.ts +0 -17
  84. package/dist/layers/MLP.js +0 -44
  85. package/dist/layers/PositionEmbedding.d.ts +0 -8
  86. package/dist/layers/PositionEmbedding.js +0 -31
  87. package/dist/layers/RMSNorm.d.ts +0 -12
  88. package/dist/layers/RMSNorm.js +0 -22
  89. package/dist/layers/RoPECache.d.ts +0 -18
  90. package/dist/layers/RoPECache.js +0 -50
  91. package/dist/layers/TiedEmbedding.d.ts +0 -13
  92. package/dist/layers/TiedEmbedding.js +0 -36
  93. package/dist/layers/TransformerBlock.d.ts +0 -27
  94. package/dist/layers/TransformerBlock.js +0 -40
  95. package/dist/layers/WeightStore.d.ts +0 -20
  96. package/dist/layers/WeightStore.js +0 -76
  97. package/dist/loader/load.d.ts +0 -6
  98. package/dist/loader/load.js +0 -68
  99. package/dist/loader/loadHF.d.ts +0 -8
  100. package/dist/loader/loadHF.js +0 -22
  101. package/dist/loader/loadTransformers.d.ts +0 -4
  102. package/dist/loader/loadTransformers.js +0 -44
  103. package/dist/loader/loadZipMeta.d.ts +0 -3
  104. package/dist/loader/loadZipMeta.js +0 -16
  105. package/dist/loader/newZipLoad.d.ts +0 -3
  106. package/dist/loader/newZipLoad.js +0 -31
  107. package/dist/loader/oldZipLoad.d.ts +0 -9
  108. package/dist/loader/oldZipLoad.js +0 -80
  109. package/dist/loader/save.d.ts +0 -16
  110. package/dist/loader/save.js +0 -90
  111. package/dist/loader/types.d.ts +0 -67
  112. package/dist/loader/types.js +0 -1
  113. package/dist/main.d.ts +0 -50
  114. package/dist/main.js +0 -109
  115. package/dist/matMul16-BcVC_E62.js +0 -80
  116. package/dist/matMulGelu-JNLZqKQp.js +0 -163
  117. package/dist/mat_mul-DhG0Newp.js +0 -11
  118. package/dist/mod-CSdCpRjf.js +0 -11
  119. package/dist/models/NanoGPTV1.d.ts +0 -16
  120. package/dist/models/NanoGPTV1.js +0 -99
  121. package/dist/models/NanoGPTV2.d.ts +0 -16
  122. package/dist/models/NanoGPTV2.js +0 -90
  123. package/dist/models/config.d.ts +0 -27
  124. package/dist/models/config.js +0 -50
  125. package/dist/models/factory.d.ts +0 -3
  126. package/dist/models/factory.js +0 -16
  127. package/dist/models/model.d.ts +0 -44
  128. package/dist/models/model.js +0 -134
  129. package/dist/non_max_suppression_impl-B2W7YjZB.js +0 -102
  130. package/dist/not_equal-hurPF26l.js +0 -64
  131. package/dist/ones-BytntneX.js +0 -14
  132. package/dist/ops/adamAdjust.d.ts +0 -2
  133. package/dist/ops/adamAdjust.js +0 -9
  134. package/dist/ops/adamMoments.d.ts +0 -2
  135. package/dist/ops/adamMoments.js +0 -9
  136. package/dist/ops/add16.d.ts +0 -2
  137. package/dist/ops/add16.js +0 -9
  138. package/dist/ops/appendCache.d.ts +0 -2
  139. package/dist/ops/appendCache.js +0 -22
  140. package/dist/ops/attentionMask.d.ts +0 -2
  141. package/dist/ops/attentionMask.js +0 -10
  142. package/dist/ops/concat16.d.ts +0 -2
  143. package/dist/ops/concat16.js +0 -9
  144. package/dist/ops/cpu/adamAdjust.d.ts +0 -1
  145. package/dist/ops/cpu/adamAdjust.js +0 -18
  146. package/dist/ops/cpu/adamMoments.d.ts +0 -1
  147. package/dist/ops/cpu/adamMoments.js +0 -16
  148. package/dist/ops/cpu/appendCache.d.ts +0 -1
  149. package/dist/ops/cpu/appendCache.js +0 -23
  150. package/dist/ops/cpu/attentionMask.d.ts +0 -1
  151. package/dist/ops/cpu/attentionMask.js +0 -22
  152. package/dist/ops/cpu/fusedSoftmax.d.ts +0 -9
  153. package/dist/ops/cpu/fusedSoftmax.js +0 -29
  154. package/dist/ops/cpu/gatherSub.d.ts +0 -1
  155. package/dist/ops/cpu/gatherSub.js +0 -18
  156. package/dist/ops/cpu/gelu.d.ts +0 -1
  157. package/dist/ops/cpu/gelu.js +0 -40
  158. package/dist/ops/cpu/matMul16.d.ts +0 -1
  159. package/dist/ops/cpu/matMul16.js +0 -15
  160. package/dist/ops/cpu/matMulGelu.d.ts +0 -1
  161. package/dist/ops/cpu/matMulGelu.js +0 -53
  162. package/dist/ops/cpu/matMulMul.d.ts +0 -1
  163. package/dist/ops/cpu/matMulMul.js +0 -23
  164. package/dist/ops/cpu/mulDropout.d.ts +0 -1
  165. package/dist/ops/cpu/mulDropout.js +0 -23
  166. package/dist/ops/cpu/normRMS.d.ts +0 -1
  167. package/dist/ops/cpu/normRMS.js +0 -39
  168. package/dist/ops/cpu/qkv.d.ts +0 -5
  169. package/dist/ops/cpu/qkv.js +0 -41
  170. package/dist/ops/cpu/rope.d.ts +0 -6
  171. package/dist/ops/cpu/rope.js +0 -38
  172. package/dist/ops/cpu/scatterSub.d.ts +0 -1
  173. package/dist/ops/cpu/scatterSub.js +0 -23
  174. package/dist/ops/dot16.d.ts +0 -2
  175. package/dist/ops/dot16.js +0 -42
  176. package/dist/ops/dropout.d.ts +0 -2
  177. package/dist/ops/dropout.js +0 -14
  178. package/dist/ops/dropout16.d.ts +0 -2
  179. package/dist/ops/dropout16.js +0 -25
  180. package/dist/ops/gatherSub.d.ts +0 -2
  181. package/dist/ops/gatherSub.js +0 -9
  182. package/dist/ops/gelu.d.ts +0 -3
  183. package/dist/ops/gelu.js +0 -8
  184. package/dist/ops/globalNorm.d.ts +0 -2
  185. package/dist/ops/globalNorm.js +0 -13
  186. package/dist/ops/grads/add16.d.ts +0 -1
  187. package/dist/ops/grads/add16.js +0 -26
  188. package/dist/ops/grads/attentionMask.d.ts +0 -1
  189. package/dist/ops/grads/attentionMask.js +0 -21
  190. package/dist/ops/grads/dropout16.d.ts +0 -1
  191. package/dist/ops/grads/dropout16.js +0 -2
  192. package/dist/ops/grads/gelu.d.ts +0 -2
  193. package/dist/ops/grads/gelu.js +0 -5
  194. package/dist/ops/grads/matMul16.d.ts +0 -2
  195. package/dist/ops/grads/matMul16.js +0 -9
  196. package/dist/ops/grads/matMulGelu.d.ts +0 -1
  197. package/dist/ops/grads/matMulGelu.js +0 -17
  198. package/dist/ops/grads/mul16.d.ts +0 -1
  199. package/dist/ops/grads/mul16.js +0 -4
  200. package/dist/ops/grads/normRMS.d.ts +0 -3
  201. package/dist/ops/grads/normRMS.js +0 -33
  202. package/dist/ops/grads/pack16.d.ts +0 -2
  203. package/dist/ops/grads/pack16.js +0 -6
  204. package/dist/ops/grads/qkv.d.ts +0 -3
  205. package/dist/ops/grads/qkv.js +0 -34
  206. package/dist/ops/grads/rope.d.ts +0 -2
  207. package/dist/ops/grads/rope.js +0 -5
  208. package/dist/ops/grads/softmax16.d.ts +0 -2
  209. package/dist/ops/grads/softmax16.js +0 -25
  210. package/dist/ops/grads/unpack16.d.ts +0 -2
  211. package/dist/ops/grads/unpack16.js +0 -5
  212. package/dist/ops/grads/utils.d.ts +0 -4
  213. package/dist/ops/grads/utils.js +0 -14
  214. package/dist/ops/log.d.ts +0 -0
  215. package/dist/ops/log.js +0 -1
  216. package/dist/ops/matMul16.d.ts +0 -15
  217. package/dist/ops/matMul16.js +0 -13
  218. package/dist/ops/matMulGelu.d.ts +0 -3
  219. package/dist/ops/matMulGelu.js +0 -14
  220. package/dist/ops/matMulMul.d.ts +0 -2
  221. package/dist/ops/matMulMul.js +0 -9
  222. package/dist/ops/mul16.d.ts +0 -2
  223. package/dist/ops/mul16.js +0 -39
  224. package/dist/ops/mulDrop.d.ts +0 -2
  225. package/dist/ops/mulDrop.js +0 -9
  226. package/dist/ops/normRMS.d.ts +0 -2
  227. package/dist/ops/normRMS.js +0 -19
  228. package/dist/ops/pack16.d.ts +0 -2
  229. package/dist/ops/pack16.js +0 -5
  230. package/dist/ops/qkv.d.ts +0 -2
  231. package/dist/ops/qkv.js +0 -10
  232. package/dist/ops/reshape16.d.ts +0 -2
  233. package/dist/ops/reshape16.js +0 -41
  234. package/dist/ops/rope.d.ts +0 -3
  235. package/dist/ops/rope.js +0 -7
  236. package/dist/ops/scatterSub.d.ts +0 -2
  237. package/dist/ops/scatterSub.js +0 -9
  238. package/dist/ops/slice16.d.ts +0 -2
  239. package/dist/ops/slice16.js +0 -9
  240. package/dist/ops/softmax16.d.ts +0 -2
  241. package/dist/ops/softmax16.js +0 -9
  242. package/dist/ops/sub16.d.ts +0 -2
  243. package/dist/ops/sub16.js +0 -8
  244. package/dist/ops/sum16.d.ts +0 -2
  245. package/dist/ops/sum16.js +0 -13
  246. package/dist/ops/transpose16.d.ts +0 -3
  247. package/dist/ops/transpose16.js +0 -40
  248. package/dist/ops/unpack16.d.ts +0 -2
  249. package/dist/ops/unpack16.js +0 -6
  250. package/dist/ops/webgl/adamAdjust.d.ts +0 -1
  251. package/dist/ops/webgl/adamAdjust.js +0 -49
  252. package/dist/ops/webgl/adamMoments.d.ts +0 -1
  253. package/dist/ops/webgl/adamMoments.js +0 -40
  254. package/dist/ops/webgl/appendCache.d.ts +0 -1
  255. package/dist/ops/webgl/appendCache.js +0 -44
  256. package/dist/ops/webgl/attentionMask.d.ts +0 -1
  257. package/dist/ops/webgl/attentionMask.js +0 -45
  258. package/dist/ops/webgl/dropout16.d.ts +0 -1
  259. package/dist/ops/webgl/dropout16.js +0 -11
  260. package/dist/ops/webgl/fusedSoftmax.d.ts +0 -11
  261. package/dist/ops/webgl/fusedSoftmax.js +0 -80
  262. package/dist/ops/webgl/gatherSub.d.ts +0 -1
  263. package/dist/ops/webgl/gatherSub.js +0 -27
  264. package/dist/ops/webgl/gelu.d.ts +0 -2
  265. package/dist/ops/webgl/gelu.js +0 -50
  266. package/dist/ops/webgl/log.d.ts +0 -17
  267. package/dist/ops/webgl/log.js +0 -23
  268. package/dist/ops/webgl/matMul16.d.ts +0 -1
  269. package/dist/ops/webgl/matMul16.js +0 -45
  270. package/dist/ops/webgl/matMulGelu.d.ts +0 -21
  271. package/dist/ops/webgl/matMulGelu.js +0 -9
  272. package/dist/ops/webgl/matMulMul.d.ts +0 -14
  273. package/dist/ops/webgl/matMulMul.js +0 -28
  274. package/dist/ops/webgl/mulDropout.d.ts +0 -1
  275. package/dist/ops/webgl/mulDropout.js +0 -41
  276. package/dist/ops/webgl/normRMS.d.ts +0 -1
  277. package/dist/ops/webgl/normRMS.js +0 -93
  278. package/dist/ops/webgl/qkv.d.ts +0 -1
  279. package/dist/ops/webgl/qkv.js +0 -46
  280. package/dist/ops/webgl/rope.d.ts +0 -1
  281. package/dist/ops/webgl/rope.js +0 -56
  282. package/dist/ops/webgl/scatterSub.d.ts +0 -1
  283. package/dist/ops/webgl/scatterSub.js +0 -27
  284. package/dist/ops/webgpu/adamAdjust.d.ts +0 -1
  285. package/dist/ops/webgpu/adamAdjust.js +0 -57
  286. package/dist/ops/webgpu/adamMoments.d.ts +0 -1
  287. package/dist/ops/webgpu/adamMoments.js +0 -60
  288. package/dist/ops/webgpu/add16.d.ts +0 -1
  289. package/dist/ops/webgpu/add16.js +0 -13
  290. package/dist/ops/webgpu/appendCache.d.ts +0 -1
  291. package/dist/ops/webgpu/appendCache.js +0 -105
  292. package/dist/ops/webgpu/attentionMask.d.ts +0 -1
  293. package/dist/ops/webgpu/attentionMask.js +0 -26
  294. package/dist/ops/webgpu/attentionMask32_program.d.ts +0 -19
  295. package/dist/ops/webgpu/attentionMask32_program.js +0 -54
  296. package/dist/ops/webgpu/clipScale.d.ts +0 -1
  297. package/dist/ops/webgpu/clipScale.js +0 -58
  298. package/dist/ops/webgpu/concat16.d.ts +0 -19
  299. package/dist/ops/webgpu/concat16.js +0 -126
  300. package/dist/ops/webgpu/dropout16.d.ts +0 -1
  301. package/dist/ops/webgpu/dropout16.js +0 -51
  302. package/dist/ops/webgpu/gatherSub.d.ts +0 -1
  303. package/dist/ops/webgpu/gatherSub.js +0 -39
  304. package/dist/ops/webgpu/gelu.d.ts +0 -14
  305. package/dist/ops/webgpu/gelu.js +0 -141
  306. package/dist/ops/webgpu/index.d.ts +0 -0
  307. package/dist/ops/webgpu/index.js +0 -26
  308. package/dist/ops/webgpu/matMul16.d.ts +0 -1
  309. package/dist/ops/webgpu/matMul16.js +0 -65
  310. package/dist/ops/webgpu/matMul16_program.d.ts +0 -42
  311. package/dist/ops/webgpu/matMul16_program.js +0 -343
  312. package/dist/ops/webgpu/mul16.d.ts +0 -1
  313. package/dist/ops/webgpu/mul16.js +0 -13
  314. package/dist/ops/webgpu/norm2.d.ts +0 -1
  315. package/dist/ops/webgpu/norm2.js +0 -76
  316. package/dist/ops/webgpu/normRMS.d.ts +0 -1
  317. package/dist/ops/webgpu/normRMS.js +0 -34
  318. package/dist/ops/webgpu/normRMS16_program.d.ts +0 -10
  319. package/dist/ops/webgpu/normRMS16_program.js +0 -25
  320. package/dist/ops/webgpu/normRMS32_program.d.ts +0 -10
  321. package/dist/ops/webgpu/normRMS32_program.js +0 -25
  322. package/dist/ops/webgpu/normRMSGrad.d.ts +0 -1
  323. package/dist/ops/webgpu/normRMSGrad.js +0 -284
  324. package/dist/ops/webgpu/pack16.d.ts +0 -1
  325. package/dist/ops/webgpu/pack16.js +0 -18
  326. package/dist/ops/webgpu/pack16_program.d.ts +0 -19
  327. package/dist/ops/webgpu/pack16_program.js +0 -92
  328. package/dist/ops/webgpu/qkv.d.ts +0 -1
  329. package/dist/ops/webgpu/qkv.js +0 -24
  330. package/dist/ops/webgpu/rope.d.ts +0 -1
  331. package/dist/ops/webgpu/rope.js +0 -135
  332. package/dist/ops/webgpu/scatterSub.d.ts +0 -1
  333. package/dist/ops/webgpu/scatterSub.js +0 -40
  334. package/dist/ops/webgpu/slice16.d.ts +0 -7
  335. package/dist/ops/webgpu/slice16.js +0 -69
  336. package/dist/ops/webgpu/softmax16.d.ts +0 -17
  337. package/dist/ops/webgpu/softmax16.js +0 -21
  338. package/dist/ops/webgpu/softmax16_program.d.ts +0 -13
  339. package/dist/ops/webgpu/softmax16_program.js +0 -73
  340. package/dist/ops/webgpu/softmax16_subgroup_program.d.ts +0 -17
  341. package/dist/ops/webgpu/softmax16_subgroup_program.js +0 -75
  342. package/dist/ops/webgpu/softmax16grad.d.ts +0 -1
  343. package/dist/ops/webgpu/softmax16grad.js +0 -37
  344. package/dist/ops/webgpu/sub16.d.ts +0 -1
  345. package/dist/ops/webgpu/sub16.js +0 -13
  346. package/dist/ops/webgpu/sum16.d.ts +0 -1
  347. package/dist/ops/webgpu/sum16.js +0 -38
  348. package/dist/ops/webgpu/transpose16.d.ts +0 -1
  349. package/dist/ops/webgpu/transpose16.js +0 -34
  350. package/dist/ops/webgpu/transpose16_program.d.ts +0 -16
  351. package/dist/ops/webgpu/transpose16_program.js +0 -50
  352. package/dist/ops/webgpu/transpose16_shared_program.d.ts +0 -15
  353. package/dist/ops/webgpu/transpose16_shared_program.js +0 -70
  354. package/dist/ops/webgpu/unpack16.d.ts +0 -1
  355. package/dist/ops/webgpu/unpack16.js +0 -48
  356. package/dist/ops/webgpu/utils/binary_op.d.ts +0 -35
  357. package/dist/ops/webgpu/utils/binary_op.js +0 -139
  358. package/dist/ops/webgpu/utils/deviceInfo.d.ts +0 -7
  359. package/dist/ops/webgpu/utils/deviceInfo.js +0 -11
  360. package/dist/ops/webgpu/utils/reductions.d.ts +0 -43
  361. package/dist/ops/webgpu/utils/reductions.js +0 -275
  362. package/dist/ops-CsXeTq1P.js +0 -476
  363. package/dist/pack16-bqltoUlR.js +0 -39
  364. package/dist/papaparse.min-C0cScC2i.js +0 -418
  365. package/dist/parquet-Bqjmp2vo.js +0 -44231
  366. package/dist/patches/webgpu_backend.d.ts +0 -18
  367. package/dist/patches/webgpu_backend.js +0 -56
  368. package/dist/patches/webgpu_base.d.ts +0 -21
  369. package/dist/patches/webgpu_base.js +0 -34
  370. package/dist/patches/webgpu_program.d.ts +0 -36
  371. package/dist/patches/webgpu_program.js +0 -400
  372. package/dist/pdf-NIhmP3sq.js +0 -19477
  373. package/dist/rand_util-CZ7yLoUm.js +0 -50
  374. package/dist/random_normal-IBRrha8a.js +0 -14
  375. package/dist/random_width-DN5ZtQkM.js +0 -9796
  376. package/dist/range-C-CjF-LI.js +0 -10
  377. package/dist/relu-J_X6MUzx.js +0 -9
  378. package/dist/reshape-BDOuCSNW.js +0 -9
  379. package/dist/resize_nearest_neighbor-BojqlfRe.js +0 -150
  380. package/dist/rope-DcrZM_e6.js +0 -24
  381. package/dist/scatter_nd_util-ByNJaL6I.js +0 -46
  382. package/dist/segment_util-Dasb2Zaf.js +0 -43
  383. package/dist/selu_util-BLhIqRkw.js +0 -44
  384. package/dist/shared-3agzAqQ_.js +0 -53
  385. package/dist/shared-CagdqkLh.js +0 -2143
  386. package/dist/slice-BzS11Qh0.js +0 -12
  387. package/dist/slice_util-CC35pLmT.js +0 -153
  388. package/dist/softmax-D4q1LJN7.js +0 -12
  389. package/dist/split-C2Sj255c.js +0 -9
  390. package/dist/squeeze-ho4wLUek.js +0 -10
  391. package/dist/stack-DudVrtmG.js +0 -11
  392. package/dist/step-BTxPtq1r.js +0 -261
  393. package/dist/sum-BpiwSWvg.js +0 -11
  394. package/dist/tensor-BWFldCso.js +0 -8
  395. package/dist/tensor1d-LMGMIUlr.js +0 -11
  396. package/dist/tensor2d-BnXMKScO.js +0 -14
  397. package/dist/tensor4d-C6UCG_u8.js +0 -14
  398. package/dist/tfjs_backend-BGnG-ppu.js +0 -654
  399. package/dist/tile-CFy-xTO6.js +0 -11
  400. package/dist/tokeniser/BaseTokeniser.d.ts +0 -33
  401. package/dist/tokeniser/BaseTokeniser.js +0 -124
  402. package/dist/tokeniser/CharTokeniser.d.ts +0 -24
  403. package/dist/tokeniser/CharTokeniser.js +0 -107
  404. package/dist/tokeniser/bpe.d.ts +0 -28
  405. package/dist/tokeniser/bpe.js +0 -173
  406. package/dist/tokeniser/messages.d.ts +0 -61
  407. package/dist/tokeniser/messages.js +0 -1
  408. package/dist/tokeniser/type.d.ts +0 -34
  409. package/dist/tokeniser/type.js +0 -1
  410. package/dist/training/AdamW.d.ts +0 -36
  411. package/dist/training/AdamW.js +0 -138
  412. package/dist/training/BasicTrainer.d.ts +0 -63
  413. package/dist/training/BasicTrainer.js +0 -265
  414. package/dist/training/DatasetBuilder.d.ts +0 -26
  415. package/dist/training/DatasetBuilder.js +0 -86
  416. package/dist/training/Evaluator.d.ts +0 -19
  417. package/dist/training/Evaluator.js +0 -39
  418. package/dist/training/LRScheduler.d.ts +0 -12
  419. package/dist/training/LRScheduler.js +0 -34
  420. package/dist/training/PreTrainer.d.ts +0 -11
  421. package/dist/training/PreTrainer.js +0 -20
  422. package/dist/training/SFTTrainer.d.ts +0 -12
  423. package/dist/training/SFTTrainer.js +0 -22
  424. package/dist/training/loss.d.ts +0 -3
  425. package/dist/training/loss.js +0 -24
  426. package/dist/training/orthoGrad.d.ts +0 -2
  427. package/dist/training/orthoGrad.js +0 -10
  428. package/dist/training/sparseCrossEntropy.d.ts +0 -7
  429. package/dist/training/sparseCrossEntropy.js +0 -69
  430. package/dist/training/tasks/ConversationTask.d.ts +0 -18
  431. package/dist/training/tasks/ConversationTask.js +0 -40
  432. package/dist/training/tasks/PretrainingTask.d.ts +0 -17
  433. package/dist/training/tasks/PretrainingTask.js +0 -47
  434. package/dist/training/tasks/StartSentenceTask.d.ts +0 -18
  435. package/dist/training/tasks/StartSentenceTask.js +0 -49
  436. package/dist/training/tasks/Task.d.ts +0 -22
  437. package/dist/training/tasks/Task.js +0 -68
  438. package/dist/training/tasks/splitter.d.ts +0 -5
  439. package/dist/training/tasks/splitter.js +0 -21
  440. package/dist/training/types.d.ts +0 -78
  441. package/dist/training/types.js +0 -1
  442. package/dist/training/validation.d.ts +0 -17
  443. package/dist/training/validation.js +0 -84
  444. package/dist/transpose-9kRxIXWR.js +0 -36
  445. package/dist/unsorted_segment_sum-DJvk5xnh.js +0 -277
  446. package/dist/utilities/arrayClose.d.ts +0 -1
  447. package/dist/utilities/arrayClose.js +0 -20
  448. package/dist/utilities/datasetID.d.ts +0 -2
  449. package/dist/utilities/datasetID.js +0 -21
  450. package/dist/utilities/dummy.d.ts +0 -9
  451. package/dist/utilities/dummy.js +0 -43
  452. package/dist/utilities/multinomialCPU.d.ts +0 -2
  453. package/dist/utilities/multinomialCPU.js +0 -13
  454. package/dist/utilities/naming.d.ts +0 -4
  455. package/dist/utilities/naming.js +0 -1
  456. package/dist/utilities/packed.d.ts +0 -4
  457. package/dist/utilities/packed.js +0 -15
  458. package/dist/utilities/parameters.d.ts +0 -11
  459. package/dist/utilities/parameters.js +0 -57
  460. package/dist/utilities/performance.d.ts +0 -2
  461. package/dist/utilities/performance.js +0 -16
  462. package/dist/utilities/profile.d.ts +0 -17
  463. package/dist/utilities/profile.js +0 -38
  464. package/dist/utilities/safetensors.d.ts +0 -3
  465. package/dist/utilities/safetensors.js +0 -83
  466. package/dist/utilities/sentences.d.ts +0 -5
  467. package/dist/utilities/sentences.js +0 -41
  468. package/dist/utilities/tokenParse.d.ts +0 -1
  469. package/dist/utilities/tokenParse.js +0 -21
  470. package/dist/utilities/topP.d.ts +0 -1
  471. package/dist/utilities/topP.js +0 -13
  472. package/dist/utilities/waitForModel.d.ts +0 -2
  473. package/dist/utilities/waitForModel.js +0 -12
  474. package/dist/utilities/weights.d.ts +0 -12
  475. package/dist/utilities/weights.js +0 -45
  476. package/dist/utilities/yielder.d.ts +0 -1
  477. package/dist/utilities/yielder.js +0 -7
  478. package/dist/variable-Ck482e3n.js +0 -7
  479. package/dist/webgpu_program-B4HmApL1.js +0 -525
  480. package/dist/webgpu_util-DYlGSwOJ.js +0 -64
  481. package/dist/zeros-DvZpK8s6.js +0 -13
  482. package/dist/zeros_like-CWjDdwr-.js +0 -721
@@ -1,654 +0,0 @@
1
- import { o as g, q as w, x as A, ag as Te, i as ke, j as M, m as Q, E as J, B as ae, U as ue, _ as le, a2 as fe, bb as he, aD as pe, bc as Ie, t as S, L as $e, a_ as Ee } from "./index-CUXkjxiT.js";
2
- import { t as be } from "./tensor1d-LMGMIUlr.js";
3
- import { r as Le } from "./random_normal-IBRrha8a.js";
4
- import { s as P } from "./slice-BzS11Qh0.js";
5
- import { r as c } from "./reshape-BDOuCSNW.js";
6
- import { g as Ne } from "./gather-qIqEqaGn.js";
7
- import { e as Pe } from "./step-BTxPtq1r.js";
8
- import { c as Ce } from "./clip_by_value-DDA7rrcT.js";
9
- import { t as Fe } from "./tile-CFy-xTO6.js";
10
- import { s as ve, b as Me, c as je, g as Ue } from "./selu_util-BLhIqRkw.js";
11
- import { m as $ } from "./mat_mul-DhG0Newp.js";
12
- import { t as Ve } from "./transpose-9kRxIXWR.js";
13
- import { c as j } from "./concat-CAQpCret.js";
14
- import { g as xe, r as Be } from "./dropout_util--NxWuYg2.js";
15
- import { f as Ge } from "./floor-BQtb-Azg.js";
16
- function qe(e) {
17
- return j(
18
- e,
19
- 0
20
- /* axis */
21
- );
22
- }
23
- const Je = /* @__PURE__ */ g({ concat1d_: qe });
24
- function Ke(e, n) {
25
- return j(e, n);
26
- }
27
- const Re = /* @__PURE__ */ g({ concat2d_: Ke });
28
- function Ze(e, n) {
29
- return j(e, n);
30
- }
31
- const We = /* @__PURE__ */ g({ concat3d_: Ze });
32
- function Ye(e, n) {
33
- return j(e, n);
34
- }
35
- const He = /* @__PURE__ */ g({ concat4d_: Ye });
36
- function Qe(e, n, t) {
37
- const s = w(e, "x", "slice1d");
38
- return A(s.rank === 1, () => `slice1d expects a rank-1 tensor, but got a rank-${s.rank} tensor`), P(s, [n], [t]);
39
- }
40
- const X = /* @__PURE__ */ g({ slice1d_: Qe });
41
- function Xe(e, n, t) {
42
- const s = w(e, "x", "slice2d");
43
- return A(s.rank === 2, () => `slice2d expects a rank-2 tensor, but got a rank-${s.rank} tensor`), P(s, n, t);
44
- }
45
- const we = /* @__PURE__ */ g({ slice2d_: Xe });
46
- function ze(e, n, t) {
47
- const s = w(e, "x", "slice3d");
48
- return A(s.rank === 3, () => `slice3d expects a rank-3 tensor, but got a rank-${s.rank} tensor`), P(s, n, t);
49
- }
50
- const z = /* @__PURE__ */ g({ slice3d_: ze });
51
- function en(e, n, t) {
52
- const s = w(e, "x", "slice4d");
53
- return A(s.rank === 4, () => `slice4d expects a rank-4 tensor, but got a rank-${s.rank} tensor`), P(s, n, t);
54
- }
55
- const V = /* @__PURE__ */ g({ slice4d_: en });
56
- function nn(e, n, t, s) {
57
- const r = w(e, "x", "dropout");
58
- if (A(r.dtype === "float32", () => `x has to be a floating point tensor since it's going to be scaled, but got a ${r.dtype} tensor instead.`), A(n >= 0 && n < 1, () => `rate must be a float in the range [0, 1), but got ${n}.`), n === 0)
59
- return e instanceof Te ? r.clone() : r;
60
- const o = xe(r, t), i = 1 - n, f = ke(Ge(M(Be(o, 0, 1, "float32", s), i)), i);
61
- return Q(r, f);
62
- }
63
- const tn = /* @__PURE__ */ g({ dropout_: nn });
64
- function sn({ a: e, b: n, transposeA: t = !1, transposeB: s = !1, bias: r, activation: o = "linear", preluActivationWeights: i, leakyreluAlpha: f = 0.2 }) {
65
- if (ve(J.state.gradientDepth, o) === !1) {
66
- let _ = $(e, n, t, s);
67
- return r != null && (_ = M(_, r)), Me(_, o, i, f);
68
- }
69
- let a = w(e, "a", "fused matMul"), u = w(n, "b", "fused matMul");
70
- [a, u] = ae(a, u);
71
- const m = t ? a.shape[a.rank - 2] : a.shape[a.rank - 1], d = s ? u.shape[u.rank - 1] : u.shape[u.rank - 2], T = t ? a.shape[a.rank - 1] : a.shape[a.rank - 2], h = s ? u.shape[u.rank - 2] : u.shape[u.rank - 1], ne = a.shape.slice(0, -2), I = u.shape.slice(0, -2), te = ue(ne), se = ue(I);
72
- A(m === d, () => `Error in fused matMul: inner shapes (${m}) and (${d}) of Tensors with shapes ${a.shape} and ${u.shape} and transposeA=${t} and transposeB=${s} must match.`);
73
- const B = le(a.shape.slice(0, -2), u.shape.slice(0, -2)).concat([T, h]), G = t ? c(a, [te, m, T]) : c(a, [te, T, m]), q = s ? c(u, [se, h, d]) : c(u, [se, d, h]);
74
- let E;
75
- r != null && (E = w(r, "bias", "fused matMul"), [E] = ae(E, a), le(B, E.shape));
76
- let re;
77
- i != null && (re = w(i, "prelu weights", "fused matMul"));
78
- const oe = (_, C) => {
79
- const [O, D, y, U] = C, k = je(c(_, y.shape), y, o);
80
- let b, L;
81
- if (!t && !s ? (b = $(k, D, !1, !0), L = $(O, k, !0, !1)) : !t && s ? (b = $(k, D, !1, !1), L = $(k, O, !0, !1)) : t && !s ? (b = $(D, k, !1, !0), L = $(O, k, !1, !1)) : (b = $(D, k, !0, !0), L = $(k, O, !0, !0)), r != null) {
82
- const ye = Ue(U, k);
83
- return [b, L, ye];
84
- } else
85
- return [b, L];
86
- }, ie = {
87
- a: G,
88
- b: q,
89
- bias: E,
90
- preluActivationWeights: re
91
- }, ce = { transposeA: t, transposeB: s, activation: o, leakyreluAlpha: f };
92
- return r == null ? fe((C, O, D) => {
93
- const y = (
94
- // tslint:disable-next-line: no-unnecessary-type-assertion
95
- J.runKernel(he, ie, ce)
96
- );
97
- return D([C, O, y]), { value: c(y, B), gradFunc: oe };
98
- })(G, q) : fe((C, O, D, y) => {
99
- const U = (
100
- // tslint:disable-next-line: no-unnecessary-type-assertion
101
- J.runKernel(he, ie, ce)
102
- );
103
- return y([C, O, U, D]), { value: c(U, B), gradFunc: oe };
104
- })(G, q, E);
105
- }
106
- const de = /* @__PURE__ */ g({ fusedMatMul_: sn });
107
- class Ae extends Error {
108
- constructor(n) {
109
- super(n), Object.setPrototypeOf(this, Ae.prototype);
110
- }
111
- }
112
- class Se extends Error {
113
- constructor(n) {
114
- super(n), Object.setPrototypeOf(this, Se.prototype);
115
- }
116
- }
117
- class l extends Error {
118
- constructor(n) {
119
- super(n), Object.setPrototypeOf(this, l.prototype);
120
- }
121
- }
122
- class v extends Error {
123
- constructor(n) {
124
- super(n), Object.setPrototypeOf(this, v.prototype);
125
- }
126
- }
127
- class ee extends Error {
128
- constructor(n) {
129
- super(n), Object.setPrototypeOf(this, ee.prototype);
130
- }
131
- }
132
- function Pn(e, n) {
133
- if (Array.isArray(e)) {
134
- let t = [];
135
- for (let s = 0; s < n; s++)
136
- t = t.concat(e);
137
- return t;
138
- } else {
139
- const t = new Array(n);
140
- return t.fill(e), t;
141
- }
142
- }
143
- function me(e, n) {
144
- if (!e)
145
- throw new ee(n);
146
- }
147
- function Cn(e, n) {
148
- let t = 0;
149
- for (const s of e)
150
- s === n && t++;
151
- return t;
152
- }
153
- function Fn(e) {
154
- return e.length === 1 ? e[0] : e;
155
- }
156
- function vn(e) {
157
- return Array.isArray(e) ? e : [e];
158
- }
159
- function Mn(e) {
160
- const t = e.replace(/(.)([A-Z][a-z0-9]+)/g, "$1_$2").replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
161
- return t[0] !== "_" ? t : "private" + t;
162
- }
163
- function jn(e) {
164
- return e.length <= 1 || e.indexOf("_") === -1 ? e : e.replace(/[_]+(\w|$)/g, (n, t) => t.toUpperCase());
165
- }
166
- let p = {};
167
- function Un(e) {
168
- if (e == null)
169
- return null;
170
- const n = {};
171
- return n.className = e.getClassName(), n.config = e.getConfig(), n;
172
- }
173
- function W(e) {
174
- if (!(e == null || typeof e != "object"))
175
- if (Array.isArray(e))
176
- e.forEach((n) => W(n));
177
- else {
178
- const n = Object.keys(e);
179
- for (const t of n) {
180
- const s = e[t];
181
- s != null && typeof s == "object" && (!Array.isArray(s) && s.type === "ndarray" && typeof s.value == "number" ? e[t] = s.value : W(s));
182
- }
183
- }
184
- }
185
- function Vn(e, n = {}, t = {}, s = "object", r = !1) {
186
- if (typeof e == "string") {
187
- const o = e;
188
- let i;
189
- if (o in t)
190
- i = t[o];
191
- else if (o in p)
192
- i = p[o];
193
- else if (i = n[o], i == null)
194
- throw new l(`Unknown ${s}: ${e}. This may be due to one of the following reasons:
195
- 1. The ${s} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
196
- 2. The custom ${s} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);
197
- return i;
198
- } else {
199
- const o = e;
200
- if (o.className == null || o.config == null)
201
- throw new l(`${s}: Improper config format: ${JSON.stringify(o)}.
202
- 'className' and 'config' must set.`);
203
- const i = o.className;
204
- let f, a;
205
- if (i in t ? [f, a] = t[i] : i in p ? [f, a] = p.className : i in n && ([f, a] = n[i]), f == null)
206
- throw new l(`Unknown ${s}: ${i}. This may be due to one of the following reasons:
207
- 1. The ${s} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code.
208
- 2. The custom ${s} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);
209
- if (a != null) {
210
- const u = {};
211
- for (const h of Object.keys(p))
212
- u[h] = p[h];
213
- for (const h of Object.keys(t))
214
- u[h] = t[h];
215
- const m = o.config;
216
- m.customObjects = u;
217
- const d = Object.assign({}, p);
218
- for (const h of Object.keys(t))
219
- p[h] = t[h];
220
- W(o.config);
221
- const T = a(f, o.config, t, r);
222
- return p = Object.assign({}, d), T;
223
- } else {
224
- const u = Object.assign({}, p);
225
- for (const d of Object.keys(t))
226
- p[d] = t[d];
227
- const m = new f(o.config);
228
- return p = Object.assign({}, u), m;
229
- }
230
- }
231
- }
232
- function rn(e, n) {
233
- return e < n ? -1 : e > n ? 1 : 0;
234
- }
235
- function xn(e, n) {
236
- return -1 * rn(e, n);
237
- }
238
- function Bn(e) {
239
- if (e == null)
240
- return e;
241
- const n = [];
242
- for (const t of e)
243
- n.indexOf(t) === -1 && n.push(t);
244
- return n;
245
- }
246
- function Gn(e) {
247
- if (e == null)
248
- throw new l(`Invalid value in obj: ${JSON.stringify(e)}`);
249
- for (const n in e)
250
- if (e.hasOwnProperty(n))
251
- return !1;
252
- return !0;
253
- }
254
- function x(e, n, t) {
255
- if (t != null && e.indexOf(t) < 0)
256
- throw new l(`${t} is not a valid ${n}. Valid values are ${e} or null/undefined.`);
257
- }
258
- function qn(e, n, t = 0, s = 1 / 0) {
259
- return me(t >= 0), me(s >= t), Array.isArray(e) && e.length >= t && e.length <= s && e.every((r) => typeof r === n);
260
- }
261
- function on(e, n) {
262
- Array.isArray(e) ? (A(e.length > 0, () => `${n} is unexpectedly an empty array.`), e.forEach((t, s) => on(t, `element ${s + 1} of ${n}`))) : A(Number.isInteger(e) && e > 0, () => `Expected ${n} to be a positive integer, but got ${Oe(e)}.`);
263
- }
264
- function Oe(e) {
265
- return e === null ? "null" : Array.isArray(e) ? "[" + e.map((n) => Oe(n)).join(",") + "]" : typeof e == "string" ? `"${e}"` : `${e}`;
266
- }
267
- function Jn(e, n, t) {
268
- let s = t != null ? t() : pe(), r;
269
- return (...i) => {
270
- const f = t != null ? t() : pe();
271
- return f - s < n || (s = f, r = e(...i)), r;
272
- };
273
- }
274
- function Kn(e) {
275
- return e === "relu" ? "relu" : e === "linear" ? "linear" : e === "elu" ? "elu" : null;
276
- }
277
- const cn = ["channelsFirst", "channelsLast"], an = ["nearest", "bilinear"], un = ["valid", "same", "causal"], ln = ["max", "avg"], Rn = ["sum", "mul", "concat", "ave"];
278
- const N = /* @__PURE__ */ new Map();
279
- function fn(e) {
280
- x(cn, "DataFormat", e);
281
- }
282
- function Zn(e) {
283
- x(an, "InterpolationFormat", e);
284
- }
285
- function Wn(e) {
286
- x(un, "PaddingMode", e);
287
- }
288
- function Yn(e) {
289
- x(ln, "PoolMode", e);
290
- }
291
- const F = [], ge = "/";
292
- function Hn(e, n) {
293
- F.push(e);
294
- try {
295
- const t = n();
296
- return F.pop(), t;
297
- } catch (t) {
298
- throw F.pop(), t;
299
- }
300
- }
301
- function hn() {
302
- return F.length === 0 ? "" : F.join(ge) + ge;
303
- }
304
- function Qn(e) {
305
- if (!De(e))
306
- throw new Error("Not a valid tensor name: '" + e + "'");
307
- return hn() + e;
308
- }
309
- function Xn(e) {
310
- if (!De(e))
311
- throw new Error("Not a valid tensor name: '" + e + "'");
312
- N.has(e) || N.set(e, 0);
313
- const n = N.get(e);
314
- if (N.set(e, N.get(e) + 1), n > 0) {
315
- const t = `${e}_${n}`;
316
- return N.set(t, 1), t;
317
- } else
318
- return e;
319
- }
320
- const pn = new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);
321
- function De(e) {
322
- return !!e.match(pn);
323
- }
324
- function zn(e) {
325
- return e === parseInt(e.toString(), 10);
326
- }
327
- function _e(e, n, t) {
328
- n == null && (n = 0), t == null && (t = e.length);
329
- let s = 1;
330
- for (let r = n; r < t; ++r)
331
- s *= e[r];
332
- return s;
333
- }
334
- function et(e) {
335
- if (e.length === 0)
336
- return Number.NaN;
337
- let n = Number.POSITIVE_INFINITY;
338
- for (let t = 0; t < e.length; t++) {
339
- const s = e[t];
340
- s < n && (n = s);
341
- }
342
- return n;
343
- }
344
- function nt(e) {
345
- if (e.length === 0)
346
- return Number.NaN;
347
- let n = Number.NEGATIVE_INFINITY;
348
- for (let t = 0; t < e.length; t++) {
349
- const s = e[t];
350
- s > n && (n = s);
351
- }
352
- return n;
353
- }
354
- function tt(e, n) {
355
- if (n < e)
356
- throw new l(`end (${n}) < begin (${e}) is forbidden.`);
357
- const t = [];
358
- for (let s = e; s < n; ++s)
359
- t.push(s);
360
- return t;
361
- }
362
- let K;
363
- function st() {
364
- return K == null && (K = Ie().epsilon()), K;
365
- }
366
- function Y() {
367
- return "channelsLast";
368
- }
369
- function rt(e, n) {
370
- return $e(e, n);
371
- }
372
- function dn(e, n = -1) {
373
- const t = e.shape.slice();
374
- return n < 0 && (n = t.length + n + 1), t.splice(n, 0, 1), c(e, t);
375
- }
376
- function ot(e, n) {
377
- return S(() => {
378
- if (e.shape.length !== 2)
379
- throw new l(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);
380
- const t = dn(e, 1);
381
- return mn(t, [1, n, 1]);
382
- });
383
- }
384
- function it(e) {
385
- const n = [_e(e.shape)];
386
- return c(e, n);
387
- }
388
- function ct(e) {
389
- if (e.rank <= 1)
390
- throw new l(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);
391
- const n = [e.shape[0], _e(e.shape, 1)];
392
- return c(e, n);
393
- }
394
- function R(e, n, t) {
395
- return S(() => {
396
- switch (e.rank) {
397
- case 1:
398
- return X(e, n, t);
399
- case 2:
400
- return we(e, [n, 0], [t, e.shape[1]]);
401
- case 3:
402
- return z(e, [n, 0, 0], [t, e.shape[1], e.shape[2]]);
403
- case 4:
404
- return V(e, [n, 0, 0, 0], [t, e.shape[1], e.shape[2], e.shape[3]]);
405
- case 5:
406
- return P(e, [n, 0, 0, 0, 0], [
407
- t,
408
- e.shape[1],
409
- e.shape[2],
410
- e.shape[3],
411
- e.shape[4]
412
- ]);
413
- case 6:
414
- return P(e, [n, 0, 0, 0, 0, 0], [
415
- t,
416
- e.shape[1],
417
- e.shape[2],
418
- e.shape[3],
419
- e.shape[4],
420
- e.shape[5]
421
- ]);
422
- default:
423
- throw new l(`sliceAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`);
424
- }
425
- });
426
- }
427
- function Z(e, n, t) {
428
- return S(() => {
429
- switch (e.rank) {
430
- case 1:
431
- return X(e, n, t);
432
- case 2:
433
- return we(e, [0, n], [e.shape[0], t]);
434
- case 3:
435
- return z(e, [0, 0, n], [e.shape[0], e.shape[1], t]);
436
- case 4:
437
- return V(e, [0, 0, 0, n], [e.shape[0], e.shape[1], e.shape[2], t]);
438
- default:
439
- throw new l(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`);
440
- }
441
- });
442
- }
443
- function at(e, n, t, s) {
444
- return S(() => {
445
- switch (e.rank) {
446
- case 1:
447
- return X(e, n, t);
448
- case 2:
449
- switch (s) {
450
- case 1:
451
- return R(e, n, t);
452
- case 2:
453
- return Z(e, n, t);
454
- default:
455
- throw new l(`The axis is not within the rank of the tensor ${s}`);
456
- }
457
- case 3:
458
- switch (s) {
459
- case 1:
460
- return R(e, n, t);
461
- case 2:
462
- return z(e, [0, n, 0], [e.shape[0], t, e.shape[2]]);
463
- case 3:
464
- return Z(e, n, t);
465
- default:
466
- throw new l(`The axis is not within the rank of the tensor ${s}`);
467
- }
468
- case 4:
469
- switch (s) {
470
- case 1:
471
- return R(e, n, t);
472
- case 2:
473
- return V(e, [0, n, 0, 0], [e.shape[0], t, e.shape[2], e.shape[3]]);
474
- case 3:
475
- return V(e, [0, 0, n, 0], [e.shape[0], e.shape[1], t, e.shape[3]]);
476
- case 4:
477
- return Z(e, n, t);
478
- default:
479
- throw new l(`The axis is not within the rank of the tensor ${s}`);
480
- }
481
- default:
482
- throw new l(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`);
483
- }
484
- });
485
- }
486
- function ut(e, n = -1) {
487
- let t;
488
- return n < 0 && (t = e[0].rank, t !== 0 ? n = t : n = 0), n === e[0].rank && (n = -1), j(e, n);
489
- }
490
- function lt(e, n) {
491
- switch (e.rank) {
492
- case 1:
493
- return Je([e, n]);
494
- case 2:
495
- return Re([e, n], 0);
496
- case 3:
497
- return We([e, n], 0);
498
- case 4:
499
- return He([e, n], 0);
500
- default:
501
- throw new l(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`);
502
- }
503
- }
504
- function mn(e, n) {
505
- if (Array.isArray(n) || (n = [n]), e.rank !== n.length)
506
- throw new l(`The length of input n (${n.length}) does not match the number of dimensions in input x (${e.rank})`);
507
- return Fe(e, n);
508
- }
509
- function ft(e, n = 0, t = 1, s, r) {
510
- return Le(e, n, t, s, r);
511
- }
512
- function ht(e, n, t, s) {
513
- if (e.rank < 2 || n.rank < 2)
514
- throw new v(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${n.shape}`);
515
- if (n.rank >= 3) {
516
- const r = e.shape.slice(-1)[0], o = n.shape.slice(-2)[0];
517
- if (r !== o)
518
- throw new v(`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 = ${n.shape}`);
519
- }
520
- if (e.rank === 2 && n.rank === 2)
521
- return de({
522
- a: e,
523
- b: n,
524
- transposeA: !1,
525
- transposeB: !1,
526
- bias: s ? H(e.rank, s, Y()) : null,
527
- activation: t
528
- });
529
- {
530
- const r = e.shape.slice(), o = r.pop();
531
- e = c(e, [-1, o]);
532
- const i = n.shape.slice(), f = i.pop(), a = i.pop(), u = [...i, f], m = Array.from({ length: n.rank }, (ne, I) => I === 0 ? n.rank - 2 : I <= n.rank - 2 ? I - 1 : I);
533
- n = c(Ve(n, m), [a, -1]);
534
- const d = [...r, ...u];
535
- return c(de({
536
- a: e,
537
- b: n,
538
- transposeA: !1,
539
- transposeB: !1,
540
- bias: s ? H(e.rank, s, Y()) : null,
541
- activation: t
542
- }), d);
543
- }
544
- }
545
- function pt(e, n, t) {
546
- return S(() => (Array.isArray(n) ? n = be(n, "int32") : n = $e(n, "int32"), Ne(e, n, t)));
547
- }
548
- function dt(e) {
549
- return Q(e, e);
550
- }
551
- function H(e, n, t) {
552
- const s = n.shape;
553
- if (n.rank !== 1 && n.rank !== e)
554
- throw new l(`Unexpected bias dimensions: ${n.rank}; expected it to be 1 or ${e}`);
555
- if (e === 5) {
556
- if (t === "channelsFirst")
557
- return s.length === 1 ? c(n, [1, s[0], 1, 1, 1]) : c(n, [1, s[3], s[0], s[1], s[2]]);
558
- if (t === "channelsLast")
559
- return s.length === 1 ? c(n, [1, 1, 1, 1, s[0]]) : c(n, [1].concat(s));
560
- } else if (e === 4) {
561
- if (t === "channelsFirst")
562
- return s.length === 1 ? c(n, [1, s[0], 1, 1]) : c(n, [1, s[2], s[0], s[1]]);
563
- if (t === "channelsLast")
564
- return s.length === 1 ? c(n, [1, 1, 1, s[0]]) : c(n, [1].concat(s));
565
- } else if (e === 3) {
566
- if (t === "channelsFirst")
567
- return s.length === 1 ? c(n, [1, s[0], 1]) : c(n, [1, s[1], s[0]]);
568
- if (t === "channelsLast")
569
- return s.length === 1 ? c(n, [1, 1, s[0]]) : c(n, [1].concat(s));
570
- } else if (e < 3)
571
- return n;
572
- throw new l(`Unsupported input rank by biasAdd: ${n.rank}`);
573
- }
574
- function mt(e, n, t) {
575
- return S(() => (t == null && (t = Y()), fn(t), M(e, H(e.rank, n, t))));
576
- }
577
- function gt(e, n = 1) {
578
- if (n !== 1)
579
- throw new v(`Support for alpha values other than 1 (${n}) is not implemented yet.`);
580
- return Pe(e);
581
- }
582
- function kt(e) {
583
- return S(() => ke(e, M(Ee(e), 1)));
584
- }
585
- function $t(e, n, t, s) {
586
- return S(() => tn(e, n, t, s));
587
- }
588
- function wt(e) {
589
- return S(() => {
590
- const n = M(0.5, Q(0.2, e));
591
- return Ce(n, 0, 1);
592
- });
593
- }
594
- function At(e, n, t = !1) {
595
- return t ? e() : n();
596
- }
597
- export {
598
- ot as $,
599
- Ae as A,
600
- pt as B,
601
- tt as C,
602
- Cn as D,
603
- gt as E,
604
- wt as F,
605
- kt as G,
606
- nt as H,
607
- zn as I,
608
- qn as J,
609
- mt as K,
610
- at as L,
611
- Zn as M,
612
- v as N,
613
- on as O,
614
- Kn as P,
615
- Wn as Q,
616
- Se as R,
617
- Y as S,
618
- mn as T,
619
- et as U,
620
- l as V,
621
- lt as W,
622
- At as X,
623
- $t as Y,
624
- ut as Z,
625
- ct as _,
626
- fn as a,
627
- Yn as a0,
628
- Rn as a1,
629
- _e as b,
630
- x as c,
631
- ht as d,
632
- Vn as e,
633
- Xn as f,
634
- Qn as g,
635
- Fn as h,
636
- vn as i,
637
- st as j,
638
- Jn as k,
639
- it as l,
640
- dt as m,
641
- Hn as n,
642
- me as o,
643
- rt as p,
644
- jn as q,
645
- ft as r,
646
- Un as s,
647
- Mn as t,
648
- Bn as u,
649
- xn as v,
650
- Pn as w,
651
- Gn as x,
652
- R as y,
653
- dn as z
654
- };
@@ -1,11 +0,0 @@
1
- import { o as e, q as a, x as i, E as c, T as l } from "./index-CUXkjxiT.js";
2
- function u(r, t) {
3
- const n = a(r, "x", "tile", "string_or_numeric");
4
- i(n.rank === t.length, () => `Error in transpose: rank of input ${n.rank} must match length of reps ${t}.`);
5
- const o = { x: n }, s = { reps: t };
6
- return c.runKernel(l, o, s);
7
- }
8
- const p = /* @__PURE__ */ e({ tile_: u });
9
- export {
10
- p as t
11
- };
@@ -1,33 +0,0 @@
1
- import { Conversation, ITokeniser } from './type';
2
- import { default as EE } from 'eventemitter3';
3
- export declare const SPECIALS: string[];
4
- export default abstract class BaseTokeniser extends EE<'trainStatus'> implements ITokeniser {
5
- id: string;
6
- datasetID?: string;
7
- protected specialTokens: Map<string, number>;
8
- protected specialTokenSet: Set<number>;
9
- abstract vocabSize: number;
10
- abstract eosToken: number;
11
- abstract bosToken: number;
12
- abstract trained: boolean;
13
- abstract addToken(token: string, index?: number): number;
14
- isSpecialToken(index: number): boolean;
15
- protected addSpecialTokens(): void;
16
- protected addSpecialToken(token: string, index: number): void;
17
- generateID(): void;
18
- abstract train(text: Conversation[][], cb?: (vocab: number) => void, datasetID?: string): Promise<number>;
19
- abstract getVocab(): string[];
20
- abstract getMerges(): [string, string][];
21
- abstract destroy(): void;
22
- abstract encode(text: string): number[];
23
- encodeSequence(text: string): number[];
24
- encodeAsSequence(conversation: Conversation[], completion?: boolean): number[];
25
- encodeConversation(conversation: Conversation[], completion?: boolean): number[];
26
- encodeConversation(conversation: Conversation[], completion: boolean, masking: boolean): {
27
- tokens: number[];
28
- mask: boolean[];
29
- };
30
- abstract decode(tokens: number[]): string;
31
- decodeConversation(tokens: number[] | Uint16Array): Conversation[];
32
- getSpecialTokenIndex(token: string): number | undefined;
33
- }