@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,365 +0,0 @@
1
- import { aE as E, ab as T, ah as O, U as V, aW as B, N as F, aM as U, aX as W } from "./index-CUXkjxiT.js";
2
- import { r as $ } from "./Reshape-BW__R4mZ.js";
3
- import { a as A, b as k, d as C, c as N, e as R } from "./axis_util-GTVlo58H.js";
4
- import { t as K, m as _ } from "./shared-3agzAqQ_.js";
5
- import { c as j } from "./backend_util-GaFarB78.js";
6
- import { f as y } from "./gpgpu_math-BwvV12df.js";
7
- import { g as G, b as L } from "./kernel_funcs_utils-pq0CK9co.js";
8
- class w {
9
- constructor(s, e) {
10
- this.variableNames = ["x"];
11
- const { windowSize: t, batchSize: n, inSize: l, outSize: r } = s;
12
- this.outputShape = [n, r];
13
- const i = Math.floor(t / 4) * 4, c = t % 4;
14
- let o = "sumValue += dot(values, ones);";
15
- if (e != null) {
16
- const p = 1 / e;
17
- o = `sumValue += dot(values * ${E(p) ? p.toPrecision(2) : p}, ones);`;
18
- }
19
- let u = "";
20
- l % t > 0 && (u = `
21
- if (inIdx < 0 || inIdx >= ${l}) {
22
- return 0.0;
23
- }
24
- `), this.userCode = `
25
- const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
26
-
27
- float getValue(int batch, int inIdx) {
28
- ${u}
29
- return getX(batch, inIdx);
30
- }
31
-
32
- void main() {
33
- ivec2 coords = getOutputCoords();
34
- int batch = coords[0];
35
- int outIdx = coords[1];
36
- int inOffset = outIdx * ${t};
37
-
38
- float sumValue = 0.0;
39
-
40
- for (int i = 0; i < ${i}; i += 4) {
41
- int inIdx = inOffset + i;
42
- vec4 values = vec4(
43
- getValue(batch, inIdx),
44
- getValue(batch, inIdx + 1),
45
- getValue(batch, inIdx + 2),
46
- getValue(batch, inIdx + 3)
47
- );
48
-
49
- ${o}
50
- }
51
-
52
- int inIdx = inOffset + ${i};
53
- if (${c === 1}) {
54
- vec4 values = vec4(getValue(batch, inIdx), 0.0, 0.0, 0.0);
55
-
56
- ${o}
57
- } else if (${c === 2}) {
58
- vec4 values = vec4(
59
- getValue(batch, inIdx),
60
- getValue(batch, inIdx + 1), 0.0, 0.0);
61
-
62
- ${o}
63
- } else if (${c === 3}) {
64
- vec4 values = vec4(
65
- getValue(batch, inIdx),
66
- getValue(batch, inIdx + 1),
67
- getValue(batch, inIdx + 2), 0.0);
68
-
69
- ${o}
70
- }
71
- setOutput(sumValue);
72
- }
73
- `;
74
- }
75
- }
76
- class X {
77
- constructor(s, e) {
78
- this.variableNames = ["x"];
79
- const { windowSize: t, batchSize: n, inSize: l, outSize: r } = s;
80
- this.outputShape = [n, r];
81
- let i = "0.0", c = "";
82
- e === "prod" ? i = "1.0" : e === "min" ? (i = "1.0 / 1e-20", c = "min") : e === "max" && (i = "-1.0 / 1e-20", c = "max");
83
- let o = `${e}(${e}(${e}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;
84
- e === "sum" ? o = "sumValue" : e === "prod" ? o = "prodValue" : e === "all" ? o = "allValue" : e === "any" && (o = "anyValue");
85
- const u = Math.floor(t / 4) * 4, p = t % 4;
86
- let h = `
87
- if (${e === "sum"}) {
88
- sumValue += dot(values, ones);
89
- } else if (${e === "prod"}) {
90
- vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);
91
- prodValue *= tmp[0] * tmp[1];
92
- } else {
93
- minMaxValue = ${c}(values, minMaxValue);
94
- if (${e === "min"} || ${e === "max"}) {
95
- minMaxValue = ${c}(values, minMaxValue);
96
- bvec4 isNaN = isnan(values);
97
- if (isNaN.r || isNaN.g || isNaN.b || isNaN.a) {
98
- minMaxValue = vec4(NAN);
99
- }
100
- }
101
- }
102
- `, d = "vec4";
103
- e === "all" ? (i = "1.0", h = `
104
- bool reducedAllValue = all(values);
105
- float floatedReducedAllValue = float(reducedAllValue);
106
- allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);
107
- `, d = "bvec4") : e === "any" && (i = "0.0", h = `
108
- bool reducedAnyValue = any(values);
109
- float floatedReducedAnyValue = float(reducedAnyValue);
110
- anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);
111
- `, d = "bvec4");
112
- let f = "";
113
- l % t > 0 && (f = `
114
- if (inIdx < 0 || inIdx >= ${l}) {
115
- return initializationValue;
116
- }
117
- `), this.userCode = `
118
- const float initializationValue = ${i};
119
- const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);
120
-
121
- float getValue(int batch, int inIdx) {
122
- ${f}
123
- return getX(batch, inIdx);
124
- }
125
-
126
- void main() {
127
- ivec2 coords = getOutputCoords();
128
- int batch = coords[0];
129
- int outIdx = coords[1];
130
- int inOffset = outIdx * ${t};
131
-
132
- vec4 minMaxValue = vec4(${i});
133
- float prodValue = 1.0;
134
- float sumValue = 0.0;
135
- float allValue = 1.0;
136
- float anyValue = 0.0;
137
-
138
- for (int i = 0; i < ${u}; i += 4) {
139
- int inIdx = inOffset + i;
140
- ${d} values = ${d}(
141
- getValue(batch, inIdx),
142
- getValue(batch, inIdx + 1),
143
- getValue(batch, inIdx + 2),
144
- getValue(batch, inIdx + 3)
145
- );
146
-
147
- ${h}
148
- }
149
-
150
- int inIdx = inOffset + ${u};
151
- if (${p === 1}) {
152
- ${d} values = ${d}(
153
- getValue(batch, inIdx),
154
- initializationValue,
155
- initializationValue,
156
- initializationValue
157
- );
158
-
159
- ${h}
160
- } else if (${p === 2}) {
161
- ${d} values = ${d}(
162
- getValue(batch, inIdx),
163
- getValue(batch, inIdx + 1),
164
- initializationValue,
165
- initializationValue
166
- );
167
-
168
- ${h}
169
- } else if (${p === 3}) {
170
- ${d} values = ${d}(
171
- getValue(batch, inIdx),
172
- getValue(batch, inIdx + 1),
173
- getValue(batch, inIdx + 2),
174
- initializationValue
175
- );
176
-
177
- ${h}
178
- }
179
- setOutput(${o});
180
- }
181
- `;
182
- }
183
- }
184
- function q(a) {
185
- const s = [];
186
- for (; s.length === 0 || s[s.length - 1].outSize !== 1; ) {
187
- const e = s.length ? s[s.length - 1].outSize : a[1], t = j(e);
188
- s.push({
189
- inSize: e,
190
- windowSize: t,
191
- outSize: Math.ceil(e / t)
192
- });
193
- }
194
- return s;
195
- }
196
- function M(a, s, e, t) {
197
- const n = q(a.shape);
198
- let l = a;
199
- for (let r = 0; r < n.length; r++) {
200
- const { inSize: i, windowSize: c, outSize: o } = n[r];
201
- let u, p;
202
- e === "mean" ? u = r === 0 ? new w({ windowSize: c, inSize: i, batchSize: a.shape[0], outSize: o }, i) : new w({ windowSize: c, inSize: i, batchSize: a.shape[0], outSize: o }) : u = new X({ windowSize: c, inSize: i, batchSize: a.shape[0], outSize: o }, e), p = l, l = t.runWebGLProgram(u, [l], s), p.dataId !== a.dataId && t.disposeIntermediateTensorInfo(p);
203
- }
204
- return l;
205
- }
206
- class Y {
207
- constructor(s, e) {
208
- this.variableNames = ["A"];
209
- const t = new Array(s.length);
210
- for (let r = 0; r < t.length; r++)
211
- t[r] = s[e[r]];
212
- this.outputShape = t, this.rank = t.length;
213
- const n = y(this.rank), l = H(e);
214
- this.userCode = `
215
- void main() {
216
- ${n} resRC = getOutputCoords();
217
- setOutput(getA(${l}));
218
- }
219
- `;
220
- }
221
- }
222
- function H(a) {
223
- const s = a.length;
224
- if (s > 6)
225
- throw Error(`Transpose for rank ${s} is not yet supported`);
226
- const e = ["resRC.x", "resRC.y", "resRC.z", "resRC.w", "resRC.u", "resRC.v"], t = new Array(s);
227
- for (let n = 0; n < a.length; n++)
228
- t[a[n]] = e[n];
229
- return t.join();
230
- }
231
- class J {
232
- constructor(s, e) {
233
- this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0;
234
- const t = new Array(s.length);
235
- for (let u = 0; u < t.length; u++)
236
- t[u] = s[e[u]];
237
- if (this.outputShape = t, this.rank = t.length, this.rank > 6)
238
- throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);
239
- const n = y(this.rank), l = G("rc", this.rank), r = new Array(this.rank);
240
- for (let u = 0; u < e.length; u++)
241
- r[e[u]] = l[u];
242
- const i = `vec2(${r.slice(-2).join()})`, c = `++${l[this.rank - 1]} < ${t[this.rank - 1]}`, o = `getChannel(getA(${r.join()}), ${i})`;
243
- this.userCode = `
244
- void main() {
245
- ${n} rc = getOutputCoords();
246
- vec4 result = vec4(0.);
247
- result[0] = ${o};
248
- if(${c}) {
249
- result[1] = ${o};
250
- }
251
- --${l[this.rank - 1]};
252
- if(++${l[this.rank - 2]} < ${t[this.rank - 2]}) {
253
- result[2] = ${o};
254
- if(${c}) {
255
- result[3] = ${o};
256
- }
257
- }
258
- setOutput(result);
259
- }
260
- `;
261
- }
262
- }
263
- function P(a, s, e) {
264
- const t = T().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new J(a.shape, s) : new Y(a.shape, s);
265
- return e.runWebGLProgram(t, [a], a.dtype);
266
- }
267
- function Q(a, s, e, t) {
268
- const n = s, l = a.shape.length, r = O(n, a.shape);
269
- let i = r;
270
- const c = A(i, l), o = c != null;
271
- let u = a;
272
- o && (u = P(a, c, t), i = k(i.length, l)), C("sum", i, l);
273
- const [p, h] = N(u.shape, i);
274
- let d = p;
275
- e && (d = R(p, r));
276
- const f = V(h), g = V(a.shape) / f, x = $({ inputs: { x: u }, attrs: { shape: [g, f] }, backend: t }), S = B(a.dtype), I = M(x, S, "sum", t), m = $({ inputs: { x: I }, attrs: { shape: d }, backend: t });
277
- return t.disposeIntermediateTensorInfo(x), t.disposeIntermediateTensorInfo(I), o && t.disposeIntermediateTensorInfo(u), m;
278
- }
279
- function Z(a) {
280
- const { inputs: s, backend: e, attrs: t } = a, { x: n } = s, { axis: l, keepDims: r } = t;
281
- return Q(n, l, r, e);
282
- }
283
- const pe = {
284
- kernelName: F,
285
- backendName: "webgl",
286
- kernelFunc: Z
287
- };
288
- function ee(a, s, e, t) {
289
- const n = V(s), r = V(a.shape) / n, i = $({ inputs: { x: a }, attrs: { shape: [r, n] }, backend: t }), c = M(i, a.dtype, "max", t), o = $({ inputs: { x: c }, attrs: { shape: e }, backend: t });
290
- return t.disposeIntermediateTensorInfo(i), t.disposeIntermediateTensorInfo(c), o;
291
- }
292
- function te(a) {
293
- const { inputs: s, backend: e, attrs: t } = a, { x: n } = s, { reductionIndices: l, keepDims: r } = t, i = n.shape.length, c = O(l, n.shape);
294
- let o = c;
295
- const u = A(o, i), p = u != null, h = e.shouldExecuteOnCPU([n]);
296
- let d = n;
297
- if (p) {
298
- if (h) {
299
- const I = e.texData.get(d.dataId).values, m = new Array(i);
300
- for (let v = 0; v < m.length; v++)
301
- m[v] = n.shape[u[v]];
302
- const z = K(I, n.shape, n.dtype, u, m);
303
- d = e.makeTensorInfo(m, n.dtype);
304
- const D = e.texData.get(d.dataId);
305
- D.values = z;
306
- } else
307
- d = P(n, u, e);
308
- o = k(o.length, i);
309
- }
310
- C("max", o, i);
311
- const [f, b] = N(d.shape, o);
312
- let g = f;
313
- r && (g = R(f, c));
314
- let x;
315
- if (h) {
316
- const I = e.texData.get(d.dataId).values, m = _(I, V(b), g, n.dtype);
317
- x = e.makeTensorInfo(g, n.dtype);
318
- const z = e.texData.get(x.dataId);
319
- z.values = m;
320
- } else
321
- x = ee(d, b, g, e);
322
- return p && e.disposeIntermediateTensorInfo(d), x;
323
- }
324
- const he = {
325
- kernelName: U,
326
- backendName: "webgl",
327
- kernelFunc: te
328
- };
329
- const ae = `
330
- if (a == b) {
331
- return 1.0;
332
- };
333
- return a / b;`, se = `
334
- // vec4 one = vec4(equal(a, b));
335
- // return one + (vec4(1.0) - one) * a / b;
336
- vec4 result = a / b;
337
- if(a.x == b.x) {
338
- result.x = 1.;
339
- }
340
- if(a.y == b.y) {
341
- result.y = 1.;
342
- }
343
- if(a.z == b.z) {
344
- result.z = 1.;
345
- }
346
- if(a.w == b.w) {
347
- result.w = 1.;
348
- }
349
-
350
- return result;
351
- `, ne = L({ opSnippet: ae, packedOpSnippet: se, checkOutOfBounds: !0 }), fe = {
352
- kernelName: W,
353
- backendName: "webgl",
354
- kernelFunc: ne
355
- };
356
- export {
357
- M as a,
358
- he as b,
359
- fe as c,
360
- pe as d,
361
- te as m,
362
- ne as r,
363
- Z as s,
364
- P as t
365
- };
@@ -1,79 +0,0 @@
1
- import { R as C, U as c, aj as R, x as f } from "./index-CUXkjxiT.js";
2
- import { u as g, g as I, a as x, b as F, c as $, d as u, e as m, i as l } from "./gpgpu_math-BwvV12df.js";
3
- class S {
4
- constructor(t, i) {
5
- this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0, this.customUniforms = [{ name: "inputShape", type: "ivec3" }], this.outputShape = t, this.enableShapeUniforms = g(this.outputShape.length);
6
- let a = "";
7
- for (let e = 0; e < 4; e++) {
8
- let o = "thisRC = rc;";
9
- e % 2 === 1 && (o += "thisRC.z += 1;"), e > 1 && (o += "thisRC.y += 1;"), a += `
10
- ${o}
11
- ${e > 0 ? "if(thisRC.y < rows && thisRC.z < cols){" : ""}
12
- int flatIndex = getFlatIndex(thisRC);
13
-
14
- ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);
15
- vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));
16
-
17
- result[${e}] =
18
- getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);
19
- ${e > 0 ? "}" : ""}
20
- `;
21
- }
22
- this.userCode = `
23
- ${v(i, this.enableShapeUniforms)}
24
- ${this.enableShapeUniforms ? I() : x(t)}
25
-
26
- void main() {
27
- ivec3 rc = getOutputCoords();
28
-
29
- vec4 result = vec4(0.);
30
-
31
- ivec3 thisRC;
32
- int rows = ${this.enableShapeUniforms ? "outShape[1]" : t[1]};
33
- int cols = ${this.enableShapeUniforms ? "outShape[2]" : t[2]};
34
-
35
- ${a}
36
-
37
- setOutput(result);
38
- }
39
- `;
40
- }
41
- }
42
- function v(s, t) {
43
- return `
44
- ivec3 inputCoordsFromReshapedOutCoords(int index) {
45
- ${t ? F(["r", "c", "d"], "inputShape") : $(["r", "c", "d"], s)}
46
- return ivec3(r, c, d);
47
- }
48
- `;
49
- }
50
- function b(s, t, i) {
51
- const a = [
52
- u(s.shape),
53
- ...m(s.shape)
54
- ], e = {
55
- dtype: s.dtype,
56
- shape: a,
57
- dataId: s.dataId
58
- }, o = [
59
- u(t),
60
- ...m(t)
61
- ], r = new S(o, a), p = !0, n = [a], h = i.runWebGLProgram(r, [e], s.dtype, n, p);
62
- return { dataId: h.dataId, shape: t, dtype: h.dtype };
63
- }
64
- function y(s) {
65
- const { inputs: t, backend: i, attrs: a } = s, { x: e } = t, { shape: o } = a, r = i, p = c(e.shape), n = R(o, p), h = c(n);
66
- f(p === h, () => `The new shape (${n}) has ${h} elements and the old shape (${e.shape}) has ${p} elements. The new shape and old shape must have the same number of elements.`);
67
- const d = r.texData.get(e.dataId);
68
- return d.isPacked && !l(e.shape, n) && !(d.texture !== null && l(d.shape, n)) ? b(e, n, r) : (r.incRef(e.dataId), { dataId: e.dataId, shape: n, dtype: e.dtype });
69
- }
70
- const U = {
71
- kernelName: C,
72
- backendName: "webgl",
73
- kernelFunc: y
74
- };
75
- export {
76
- S as R,
77
- U as a,
78
- y as r
79
- };
@@ -1,14 +0,0 @@
1
- import { U as h, aj as d, x as c, R as m } from "./index-CUXkjxiT.js";
2
- function i(n) {
3
- const { inputs: p, attrs: o } = n, { x: e } = p, { shape: r } = o, a = h(e.shape), s = d(r, a), t = h(s);
4
- return c(a === t, () => `The new shape (${s}) has ${t} elements and the old shape (${e.shape}) has ${a} elements. The new shape and old shape must have the same number of elements.`), n.backend.incRef(e.dataId), { dataId: e.dataId, shape: s, dtype: e.dtype };
5
- }
6
- const u = {
7
- kernelName: m,
8
- backendName: "webgpu",
9
- kernelFunc: i
10
- };
11
- export {
12
- u as a,
13
- i as r
14
- };
@@ -1,70 +0,0 @@
1
- import { GPTConfig, LoRAConfig } from './models/config';
2
- import { Conversation, ITokeniser } from './tokeniser/type';
3
- import { SaveOptions } from './loader/save';
4
- import { LoadModelOptions } from './loader/load';
5
- import { IGenerateOptions, IGenerator } from './Generator';
6
- import { default as Trainer, TrainingType } from './Trainer';
7
- import { default as MemoryProfiler } from './utilities/profile';
8
- import { default as Model, ModelForwardAttributes } from './models/model';
9
- import { Task } from './training/tasks/Task';
10
- import { TrainingLogEntry, TrainingOptions } from './training/types';
11
- import { ModelPhase, TransformersMetadata } from './loader/types';
12
- type TeachableLLMStatus = 'warmup' | 'awaitingTokens' | 'ready' | 'training' | 'loading' | 'busy' | 'error';
13
- export default class TeachableLLM {
14
- private ee;
15
- private _config?;
16
- private _model?;
17
- private _tokeniser?;
18
- private _status;
19
- private _memoryRequirements?;
20
- meta: TransformersMetadata;
21
- private _trainer;
22
- constructor(tokeniser?: ITokeniser, model?: Model<ModelForwardAttributes, GPTConfig>);
23
- get currentTrainer(): Trainer | null;
24
- get vocab(): string[];
25
- get phase(): ModelPhase;
26
- set phase(phase: ModelPhase);
27
- /** Model is fully loaded */
28
- get loaded(): boolean;
29
- get config(): GPTConfig;
30
- get model(): Model<ModelForwardAttributes, GPTConfig>;
31
- get tokeniser(): ITokeniser;
32
- get status(): TeachableLLMStatus;
33
- /** Model is both ready and not busy */
34
- get ready(): boolean;
35
- get busy(): boolean;
36
- createLoRA(name: string, loraConfig: LoRAConfig): void;
37
- deleteLoRA(name: string): void;
38
- renameLoRA(oldName: string, newName: string): void;
39
- attachLoRA(name: string): void;
40
- detachLoRA(): void;
41
- hasLoRA(name?: string): boolean;
42
- listLoRAs(): string[];
43
- estimateTrainingMemoryUsage(batchSize: number): number;
44
- private setStatus;
45
- saveModel(options?: SaveOptions): Promise<Blob>;
46
- static loadModel(data: Blob | Buffer | string, options?: LoadModelOptions): TeachableLLM;
47
- static create(tokeniserType: 'char' | 'bpe', config: GPTConfig): TeachableLLM;
48
- getProfiler(): MemoryProfiler | undefined;
49
- get enableProfiler(): boolean;
50
- set enableProfiler(value: boolean);
51
- getNumParams(): number;
52
- trainer(trainingType?: TrainingType, options?: TrainingOptions): Trainer;
53
- train(text: Task[], options?: TrainingOptions, trainingType?: TrainingType): Promise<void>;
54
- trainTokeniser(text: Conversation[][]): Promise<number>;
55
- generator(): IGenerator;
56
- generateText(prompt: Conversation[], options?: IGenerateOptions): Promise<Conversation[]>;
57
- generateText(options?: IGenerateOptions): Promise<Conversation[]>;
58
- dispose(): void;
59
- on(event: 'status', listener: (status: TeachableLLMStatus) => void): void;
60
- on(event: 'phase', listener: (phase: ModelPhase) => void): void;
61
- on(event: 'error', listener: (error: Error) => void): void;
62
- on(event: 'trainStep', listener: (step: TrainingLogEntry) => void): void;
63
- on(event: 'loaded' | 'changeLoRA', listener: () => void): void;
64
- off(event: 'status', listener: (status: TeachableLLMStatus) => void): void;
65
- off(event: 'phase', listener: (phase: ModelPhase) => void): void;
66
- off(event: 'error', listener: (error: Error) => void): void;
67
- off(event: 'trainStep', listener: (step: TrainingLogEntry) => void): void;
68
- off(event: 'loaded' | 'changeLoRA', listener: () => void): void;
69
- }
70
- export {};