@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,25 +0,0 @@
1
- import { Y as e } from "../dist-CMMLi-qO.js";
2
- import { t } from "../ones-DpPXWa6A.js";
3
- import { n } from "../picomatch--TW6gyBJ.js";
4
- import r from "./BaseLayer.js";
5
- import { normRMS as i } from "../ops/normRMS.js";
6
- import { isPackedTensor as a } from "../utilities/packed.js";
7
- // lib/layers/RMSNorm.ts
8
- var o = class extends r {
9
- GAMMA;
10
- rmsConfig;
11
- constructor(e, t, n = "", r) {
12
- super(e, r), this.GAMMA = n, this.rmsConfig = t, (this.rmsConfig.useGamma ?? !0) && this.addVariable(this.GAMMA);
13
- }
14
- buildGamma(e) {
15
- (this.rmsConfig.useGamma ?? !0) && this.hasVariable(this.GAMMA) === !1 && this.setVariable(this.GAMMA, n(t([e]), !0, this.GAMMA, "float32"));
16
- }
17
- forward(t, n) {
18
- return e(() => {
19
- this.startMemory(), this.buildGamma(a(n) ? n.shape[n.shape.length - 1] * 2 : n.shape[n.shape.length - 1]);
20
- let e = i(n, this.rmsConfig.useGamma ?? !0 ? this.getVariable(this.GAMMA) : void 0, this.rmsConfig.epsilon);
21
- return this.endMemory("RMSNorm"), e;
22
- });
23
- }
24
- };
25
- export { o as default };
@@ -1 +0,0 @@
1
- export { t as default } from "../RoPECache-dYscFINl.js";
@@ -1,33 +0,0 @@
1
- import { n as e } from "../dist-DyL7qSLJ.js";
2
- import "../dist-CMMLi-qO.js";
3
- import { t } from "../gather-B5Z1RFt5.js";
4
- import { n } from "../picomatch--TW6gyBJ.js";
5
- import r from "./BaseLayer.js";
6
- import { dot16 as i } from "../ops/dot16.js";
7
- import { isPackedTensor as a } from "../utilities/packed.js";
8
- import { t as o } from "../pack16-BHO4t1-M.js";
9
- import { transpose16 as s } from "../ops/transpose16.js";
10
- // lib/layers/TiedEmbedding.ts
11
- var c = class extends r {
12
- vocabSize;
13
- embedDim;
14
- initializer;
15
- WEIGHTS;
16
- constructor(t, r, i) {
17
- super(t, i), this.WEIGHTS = r, this.vocabSize = t.vocabSize, this.embedDim = t.nEmbed, this.initializer = e({
18
- mean: 0,
19
- stddev: .02
20
- }), this.addVariable(this.WEIGHTS, n(this.initializer.apply([this.vocabSize, this.embedDim]), !0, r));
21
- }
22
- embed(e) {
23
- return t(this.getVariable(this.WEIGHTS), e, 0);
24
- }
25
- project(e) {
26
- let t = a(e) ? o(this.getVariable(this.WEIGHTS), void 0, 32) : this.getVariable(this.WEIGHTS), n = s(t);
27
- return a(e) && t.dispose(), i(e, n);
28
- }
29
- forward(e, t) {
30
- return this.project(t);
31
- }
32
- };
33
- export { c as default };
@@ -1,50 +0,0 @@
1
- import e from "./MHA.js";
2
- import t from "./MLP.js";
3
- import n from "./RMSNorm.js";
4
- import r from "./BaseLayer.js";
5
- import { W as i, Y as a } from "../dist-CMMLi-qO.js";
6
- import { add16 as o } from "../ops/add16.js";
7
- // lib/layers/TransformerBlock.ts
8
- var s = class extends r {
9
- ln1;
10
- attn;
11
- ln2;
12
- mlp;
13
- index;
14
- skipped = !1;
15
- blockConfig;
16
- constructor(r, i, a, o) {
17
- super(i, o), this.index = r, this.blockConfig = a, this.ln1 = new n(i, this.blockConfig, `block_${this.index}_rms1`, this), this.attn = new e(this.index, i, this.blockConfig, this), this.ln2 = new n(i, this.blockConfig, `block_${this.index}_rms2`, this), this.mlp = new t(this.index, i, this.blockConfig, this);
18
- }
19
- getMLPOutput(e, t) {
20
- let n = this.ln2.call({ training: t.training }, e), r = this.mlp.call(t, n);
21
- t.outputEmbeddings ? (i(n), t.embeddings.push({
22
- name: `block_ln2_${this.index}`,
23
- tensor: n
24
- })) : n.dispose();
25
- let a = o(e, r);
26
- return e.dispose(), t.outputEmbeddings ? (i(r), t.embeddings.push({
27
- name: `block_mlp_out_${this.index}`,
28
- tensor: r
29
- })) : r.dispose(), a;
30
- }
31
- forward(e, t) {
32
- return a(() => {
33
- if (this.skipped) return t;
34
- let n = this.ln1.call(e, t), r = this.attn.call(e, n);
35
- e.outputEmbeddings ? (i(n), e.embeddings.push({
36
- name: `block_ln1_${this.index}`,
37
- tensor: n
38
- })) : n.dispose();
39
- let a = o(t, r);
40
- return e.outputEmbeddings ? (i(r), e.embeddings.push({
41
- name: `block_attn_out_${this.index}`,
42
- tensor: r
43
- })) : r.dispose(), this.getMLPOutput(a, e);
44
- });
45
- }
46
- dispose() {
47
- this.ln1.dispose(), this.attn.dispose(), this.ln2.dispose(), this.mlp.dispose();
48
- }
49
- };
50
- export { s as default };
@@ -1,68 +0,0 @@
1
- import { i as e } from "../rolldown-runtime-CwxnZyOB.js";
2
- import { M as t } from "../dist-CMMLi-qO.js";
3
- import { n, t as r } from "../picomatch--TW6gyBJ.js";
4
- // lib/layers/WeightStore.ts
5
- var i = /* @__PURE__ */ e(r(), 1), a = class {
6
- _variables = /* @__PURE__ */ new Map();
7
- touchedVariables = /* @__PURE__ */ new Set();
8
- onWeightRead;
9
- saveWeights(e) {
10
- this._variables.forEach((n, r) => {
11
- n && this.touchedVariables.has(r) && e.set(r, [t(n)]);
12
- });
13
- }
14
- loadWeights(e, t, r = !0) {
15
- e.forEach((e, i) => {
16
- let a = e[0], o = this._variables.get(i);
17
- o ? o.assign(a) : this._variables.set(i, n(a, r, i)), t ? this.touchedVariables.delete(i) : this.touchedVariables.add(i);
18
- });
19
- }
20
- addVariable(e, t) {
21
- this._variables.set(e, t || null);
22
- }
23
- deleteVariable(e) {
24
- let t = this._variables.get(e);
25
- t && t.dispose(), this._variables.delete(e), this.touchedVariables.delete(e);
26
- }
27
- get variables() {
28
- return Array.from(this._variables.values()).filter((e) => e !== null);
29
- }
30
- get variableNames() {
31
- return Array.from(this._variables.keys());
32
- }
33
- get trainableVariables() {
34
- return Array.from(this._variables.values()).filter((e) => e !== null && e.trainable);
35
- }
36
- getRawVariable(e) {
37
- let t = this._variables.get(e);
38
- if (!t) throw Error(`Variable ${e} not found`);
39
- return t;
40
- }
41
- getVariable(e) {
42
- let t = this._variables.get(e);
43
- if (!t) throw Error(`Variable ${e} not found`);
44
- return this.onWeightRead ? this.onWeightRead(e, t) : t;
45
- }
46
- setTrainable(e) {
47
- let t = (0, i.default)(e);
48
- this._variables.forEach((e, n) => {
49
- e && (e.trainable = t(n));
50
- });
51
- }
52
- hasVariable(e) {
53
- return !!this._variables.get(e);
54
- }
55
- setVariable(e, t) {
56
- if (!this._variables.has(e)) throw Error(`Variable ${e} not found`);
57
- this._variables.set(e, t);
58
- }
59
- touchVariables(e) {
60
- for (let t of e) this._variables.get(t) && this.touchedVariables.add(t);
61
- }
62
- dispose() {
63
- this._variables.forEach((e) => {
64
- e?.dispose();
65
- }), this._variables.clear();
66
- }
67
- };
68
- export { a as default };
@@ -1,13 +0,0 @@
1
- import { n as e } from "./rolldown-runtime-CwxnZyOB.js";
2
- import t from "./layers/MHA.js";
3
- import n from "./layers/MLP.js";
4
- import r from "./layers/TransformerBlock.js";
5
- import { t as i } from "./RoPECache-dYscFINl.js";
6
- // lib/layers.ts
7
- var a = /* @__PURE__ */ e({
8
- CausalSelfAttention: () => t,
9
- MLP: () => n,
10
- RoPECache: () => i,
11
- TransformerBlock: () => r
12
- });
13
- export { a as t };
package/dist/layers.js DELETED
@@ -1,6 +0,0 @@
1
- import { t as e } from "./RoPECache-dYscFINl.js";
2
- import t from "./layers/MHA.js";
3
- import n from "./layers/MLP.js";
4
- import r from "./layers/TransformerBlock.js";
5
- import "./layers-CFqEip3s.js";
6
- export { t as CausalSelfAttention, n as MLP, e as RoPECache, r as TransformerBlock };
@@ -1,63 +0,0 @@
1
- import { i as e } from "../rolldown-runtime-CwxnZyOB.js";
2
- import { t } from "../jszip.min-Btv48m44.js";
3
- import n from "./oldZipLoad.js";
4
- import r from "./newZipLoad.js";
5
- import i from "./loadHF.js";
6
- import { loadZipMeta as a } from "./loadZipMeta.js";
7
- import { load_safetensors as o } from "../utilities/safetensors.js";
8
- // lib/loader/load.ts
9
- var s = /* @__PURE__ */ e(t(), 1), c = 2;
10
- async function l(e) {
11
- let t = await fetch(e);
12
- if (!t.ok) throw Error(`Failed to fetch ${e}: ${t.statusText}`);
13
- return t.arrayBuffer();
14
- }
15
- async function u(e, t, n) {
16
- let r = e.file("model.safetensors");
17
- if (!r) return;
18
- let i = await r.async("arraybuffer"), a = await o(i), s = /* @__PURE__ */ new Map();
19
- for (let [e, t] of Object.entries(a)) s.set(e, [t]);
20
- t.weightStore.loadWeights(s, n);
21
- }
22
- async function d(e, t) {
23
- let n = e.file("config.json");
24
- if (!n) return;
25
- let r = await n.async("string"), i = JSON.parse(r);
26
- if (i.loraConfig && Object.entries(i.loraConfig).forEach(([e, n]) => {
27
- t.hasLoRA(e) || t.createLoRA(e, n);
28
- }), i.loraName) {
29
- if (t.hasLoRA()) throw Error("Model already has LoRA attached");
30
- t.attachLoRA(i.loraName);
31
- }
32
- }
33
- async function f(e, t) {
34
- if (t.reference) {
35
- let n = await p(t.reference);
36
- return await u(e, n.model, !!t.url), await d(e, n.model), n.model.config.loraName && n.model.attachLoRA(n.model.config.loraName), {
37
- ...n,
38
- metaData: {
39
- ...n.metaData,
40
- ...t
41
- }
42
- };
43
- }
44
- if (e.file("manifest.json")) return n(e, t);
45
- {
46
- let n = await r(e, t);
47
- return n.model.config.loraName && n.model.attachLoRA(n.model.config.loraName), n;
48
- }
49
- }
50
- async function p(e, t) {
51
- if (typeof e == "string") {
52
- if (e.startsWith("http://") || e.startsWith("https://")) {
53
- let t = await l(e), n = await s.default.loadAsync(t), r = await a(n);
54
- return r.url = e, f(n, r);
55
- }
56
- return i(e);
57
- }
58
- {
59
- let n = await s.default.loadAsync(e), r = await a(n);
60
- return r.url = t?.sourceURL || void 0, f(n, r);
61
- }
62
- }
63
- export { c as VERSION, p as loadModel };
@@ -1,17 +0,0 @@
1
- import e from "./loadTransformers.js";
2
- // lib/loader/loadHF.ts
3
- async function t(t) {
4
- let n = `https://huggingface.co/${t}/resolve/main/config.json`, r = `https://huggingface.co/${t}/resolve/main/tokeniser.json`, i = `https://huggingface.co/${t}/resolve/main/meta.json`, a = `https://huggingface.co/${t}/resolve/main/model.safetensors`, [o, s, c, l] = await Promise.all([
5
- fetch(n),
6
- fetch(r),
7
- fetch(i),
8
- fetch(a)
9
- ]);
10
- if (!o.ok) throw Error(`Failed to fetch config from ${n}: ${o.statusText}`);
11
- if (!s.ok) throw Error(`Failed to fetch tokeniser from ${r}: ${s.statusText}`);
12
- if (!c.ok) throw Error(`Failed to fetch meta from ${i}: ${c.statusText}`);
13
- if (!l.ok) throw Error(`Failed to fetch weights from ${a}: ${l.statusText}`);
14
- let u = await o.json(), d = await s.json(), f = await c.json(), p = await l.arrayBuffer();
15
- return e(u, d, f, p);
16
- }
17
- export { t as default };
@@ -1,61 +0,0 @@
1
- import e from "../tokeniser/CharTokeniser.js";
2
- import t from "../tokeniser/bpe.js";
3
- import { load_safetensors as n } from "../utilities/safetensors.js";
4
- import { V as r } from "../dist-CMMLi-qO.js";
5
- import { dummyPassAsync as i } from "../utilities/dummy.js";
6
- import a from "../models/factory.js";
7
- // lib/loader/loadTransformers.ts
8
- function o(e) {
9
- let t;
10
- return t = e.model_type === "GenAI_NanoGPT_v1" ? {
11
- modelType: "GenAI_NanoGPT_v1",
12
- vocabSize: e.vocab_size,
13
- blockSize: e.block_size,
14
- nLayer: e.num_hidden_layers,
15
- nHead: e.num_attention_heads,
16
- nEmbed: e.hidden_size,
17
- mlpFactor: e.mlpFactor,
18
- useRope: e.useRope
19
- } : e.model_type === "GenAI_NanoGPT_v2" ? {
20
- modelType: "GenAI_NanoGPT_v2",
21
- vocabSize: e.vocab_size,
22
- blockSize: e.block_size,
23
- nLayer: e.num_hidden_layers,
24
- nHead: e.num_attention_heads,
25
- nEmbed: e.hidden_size,
26
- mlpFactor: e.mlpFactor,
27
- loraConfig: e.loraConfig ? new Map(Object.entries(e.loraConfig)) : void 0,
28
- loraName: e.loraName,
29
- windowSize: e.windowSize
30
- } : e.model_type === "qwen3" ? {
31
- modelType: "qwen3",
32
- vocabSize: e.vocab_size,
33
- blockSize: e.block_size,
34
- nLayer: e.num_hidden_layers,
35
- nHead: e.num_attention_heads,
36
- nEmbed: e.hidden_size,
37
- mlpFactor: e.mlpFactor
38
- } : {
39
- modelType: "llama",
40
- vocabSize: e.vocab_size,
41
- blockSize: e.block_size,
42
- nLayer: e.num_hidden_layers,
43
- nHead: e.num_attention_heads,
44
- nEmbed: e.hidden_size,
45
- mlpFactor: e.mlpFactor
46
- }, t;
47
- }
48
- async function s(s, c, l, u) {
49
- let d = o(s), f = (c.type ?? "char") === "char" ? new e(c.vocab) : new t(c.vocab, c.merges);
50
- c.datasetID && (f.datasetID = c.datasetID), c.id ? f.id = c.id : f.generateID();
51
- let p = await n(u), m = /* @__PURE__ */ new Map();
52
- for (let [e, t] of Object.entries(p)) m.set(e, [t]);
53
- r();
54
- let h = a(d);
55
- return h.metaData = l, await i(h), h.weightStore.loadWeights(m, !!l.url), {
56
- model: h,
57
- tokeniser: f,
58
- metaData: l
59
- };
60
- }
61
- export { s as default, o as mapTransformersConfigToGPTConfig };
@@ -1,15 +0,0 @@
1
- // lib/loader/loadZipMeta.ts
2
- async function e(e) {
3
- let t = await e.file("meta.json")?.async("string"), n = {
4
- version: 0,
5
- application: ""
6
- };
7
- if (t) try {
8
- n = JSON.parse(t);
9
- } catch (e) {
10
- throw console.error(e), Error("bad_format", { cause: e });
11
- }
12
- else console.warn("meta.json not found in the zip archive, using default metadata");
13
- return n;
14
- }
15
- export { e as loadZipMeta };
@@ -1,24 +0,0 @@
1
- import e from "./loadTransformers.js";
2
- import { AdamWOptimizer as t } from "../training/AdamW.js";
3
- // lib/loader/newZipLoad.ts
4
- async function n(n, r) {
5
- let i = await n.file("config.json")?.async("string");
6
- if (!i) throw Error("Config file not found in the zip archive");
7
- let a = JSON.parse(i), o = await n.file("tokeniser.json")?.async("string");
8
- if (!o) throw Error("Tokeniser file not found in the zip archive");
9
- let s = JSON.parse(o), c = await n.file("model.safetensors")?.async("arraybuffer");
10
- if (!c) throw Error("Model weights not found in the zip archive");
11
- let l = await n.file("optimizer_config.json")?.async("string"), u;
12
- if (l) {
13
- let e = JSON.parse(l), r = await n.file("optimizer.safetensors")?.async("arraybuffer");
14
- if (!r) throw Error("Optimizer weights not found in the zip archive");
15
- u = new t(e), await u.loadMoments(r);
16
- }
17
- let d = await n.file("training_log.json")?.async("string"), f;
18
- return d && (f = JSON.parse(d)), {
19
- ...await e(a, s, r, c),
20
- optimizer: u,
21
- log: f
22
- };
23
- }
24
- export { n as default };
@@ -1,36 +0,0 @@
1
- import e from "../tokeniser/CharTokeniser.js";
2
- import t from "../tokeniser/bpe.js";
3
- import { importWeights as n } from "../utilities/weights.js";
4
- import { V as r } from "../dist-CMMLi-qO.js";
5
- import { dummyPassAsync as i } from "../utilities/dummy.js";
6
- import a from "../models/factory.js";
7
- // lib/loader/oldZipLoad.ts
8
- async function o(o, s) {
9
- let c = /* @__PURE__ */ new Map(), l = await o.file("manifest.json")?.async("string");
10
- if (!l) throw Error("Manifest file not found in the zip archive");
11
- let u = JSON.parse(l);
12
- for (let [e, t] of Object.entries(u.weightSpec)) c.set(e, {
13
- spec: t,
14
- data: /* @__PURE__ */ new Float32Array()
15
- });
16
- let d = await o.file("tokeniser.json")?.async("string");
17
- if (!d) throw Error("Tokeniser file not found in the zip archive");
18
- let f = JSON.parse(d), p = (f.type ?? "char") === "char" ? new e(f.vocab) : new t(f.vocab, f.merges), m = /* @__PURE__ */ new Map();
19
- for (let e of Object.keys(o.files)) if (e.endsWith(".bin")) {
20
- let t = e.replace(".bin", ""), r = await o.file(e).async("arraybuffer"), i = new Float32Array(r), a = c.get(t) || {
21
- spec: [],
22
- data: /* @__PURE__ */ new Float32Array()
23
- };
24
- a.data = i, c.set(t, a);
25
- let s = await n(a);
26
- m.set(t, s);
27
- }
28
- r();
29
- let h = a(u.config);
30
- return h.metaData = s, await i(h), h.weightStore.loadWeights(m, !!s.url), {
31
- model: h,
32
- tokeniser: p,
33
- metaData: s
34
- };
35
- }
36
- export { o as default };
@@ -1,89 +0,0 @@
1
- import { i as e } from "../rolldown-runtime-CwxnZyOB.js";
2
- import { t } from "../jszip.min-Btv48m44.js";
3
- import n from "../tokeniser/CharTokeniser.js";
4
- import { save_safetensors as r } from "../utilities/safetensors.js";
5
- import "./load.js";
6
- // lib/loader/save.ts
7
- var i = /* @__PURE__ */ e(t(), 1);
8
- function a(e) {
9
- if (e.length > 1e3) {
10
- let t = Math.ceil(e.length / 1e3);
11
- return e.filter((n, r) => r % t === 0 || r === e.length - 1);
12
- }
13
- return e;
14
- }
15
- async function o(e, t, o, s) {
16
- let c = /* @__PURE__ */ new Map();
17
- e.weightStore.saveWeights(c);
18
- let l = new i.default();
19
- if (s?.optimizer) {
20
- let e = await s.optimizer.saveMoments();
21
- l.file("optimizer.safetensors", e, { binary: !0 }), l.file("optimizer_config.json", JSON.stringify(s.optimizer.serializeConfig()), { binary: !1 });
22
- }
23
- s?.trainingLog && l.file("training_log.json", JSON.stringify(a(s.trainingLog), void 0, 4), { binary: !1 });
24
- let u = {};
25
- c.forEach((e, t) => {
26
- e.length === 1 && (u[t] = e[0]);
27
- });
28
- let d = await r(u, o?.quantize);
29
- l.file("model.safetensors", d, { binary: !0 });
30
- let f = e.config.modelType, p;
31
- p = f === "GenAI_NanoGPT_v1" ? {
32
- model_type: "GenAI_NanoGPT_v1",
33
- vocab_size: t.getVocab().length,
34
- hidden_size: e.config.nEmbed,
35
- num_hidden_layers: e.config.nLayer,
36
- num_attention_heads: e.config.nHead,
37
- block_size: e.config.blockSize,
38
- mlpFactor: e.config.mlpFactor,
39
- useRope: e.config.useRope
40
- } : f === "GenAI_NanoGPT_v2" ? {
41
- model_type: "GenAI_NanoGPT_v2",
42
- vocab_size: t.getVocab().length,
43
- hidden_size: e.config.nEmbed,
44
- num_hidden_layers: e.config.nLayer,
45
- num_attention_heads: e.config.nHead,
46
- block_size: e.config.blockSize,
47
- mlpFactor: e.config.mlpFactor,
48
- loraConfig: e.config.loraConfig ? Object.fromEntries(e.config.loraConfig) : void 0,
49
- loraName: e.config.loraName
50
- } : f === "qwen3" ? {
51
- model_type: "qwen3",
52
- vocab_size: t.getVocab().length,
53
- hidden_size: e.config.nEmbed,
54
- num_hidden_layers: e.config.nLayer,
55
- num_attention_heads: e.config.nHead,
56
- block_size: e.config.blockSize,
57
- mlpFactor: e.config.mlpFactor
58
- } : {
59
- model_type: "llama",
60
- vocab_size: t.getVocab().length,
61
- hidden_size: e.config.nEmbed,
62
- num_hidden_layers: e.config.nLayer,
63
- num_attention_heads: e.config.nHead,
64
- block_size: e.config.blockSize,
65
- mlpFactor: e.config.mlpFactor
66
- }, l.file("config.json", JSON.stringify(p, void 0, 4), { binary: !1 });
67
- let m = {
68
- version: 2,
69
- application: "@genai-fi/nanogpt",
70
- meta: o?.metadata,
71
- name: o?.name,
72
- training: e.metaData?.training || void 0,
73
- reference: e.metaData?.url || void 0,
74
- mode: e.metaData?.mode || void 0,
75
- pretrainingData: e.metaData?.pretrainingData || void 0,
76
- pretrainingSettings: e.metaData?.pretrainingSettings || void 0,
77
- generationSettings: e.metaData?.generationSettings || void 0,
78
- actionLog: e.metaData?.actionLog || void 0
79
- };
80
- if (l.file("meta.json", JSON.stringify(m, void 0, 4), { binary: !1 }), l.file("tokeniser.json", JSON.stringify({
81
- type: t instanceof n ? "char" : "bpe",
82
- vocab: t.getVocab(),
83
- merges: t.getMerges(),
84
- datasetID: t.datasetID,
85
- id: t.id
86
- }), { binary: !1 }), o?.files) for (let [e, t] of Object.entries(o.files)) l.file(e, JSON.stringify(t), { binary: !1 });
87
- return l.generateAsync({ type: "blob" });
88
- }
89
- export { o as saveModel };
File without changes