@genai-fi/nanogpt 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Generator.js +29 -27
- package/dist/{RealDiv-N8TpOMYv.js → RealDiv-D_q39E3A.js} +14 -14
- package/dist/{Reshape-B-lWQRnF.js → Reshape-41YpQqEo.js} +1 -1
- package/dist/{Reshape-Bo8HzP8V.js → Reshape-Bh_jzKzV.js} +2 -2
- package/dist/TeachableLLM.js +7 -5
- package/dist/{axis_util-DubwyOhW.js → axis_util-Did9235A.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-BJ-_jSeK.js → backend_util-yC3YH1jo.js} +17 -17
- package/dist/{broadcast_to-BYfCp5iL.js → broadcast_to-CUvOdOT5.js} +2 -2
- package/dist/checks/appendCache.d.ts +1 -0
- package/dist/checks/appendCache.js +22 -0
- package/dist/checks/attentionMask.d.ts +1 -0
- package/dist/checks/attentionMask.js +37 -0
- package/dist/checks/check.d.ts +9 -0
- package/dist/checks/check.js +20 -0
- package/dist/checks/gelu.d.ts +1 -0
- package/dist/checks/gelu.js +18 -0
- package/dist/checks/index.d.ts +19 -0
- package/dist/checks/index.js +21 -0
- package/dist/checks/normRMS.d.ts +1 -0
- package/dist/checks/normRMS.js +16 -0
- package/dist/checks/normRMSGrad.d.ts +1 -0
- package/dist/checks/normRMSGrad.js +12 -0
- package/dist/checks/qkv.d.ts +1 -0
- package/dist/checks/qkv.js +25 -0
- package/dist/checks/rope.d.ts +1 -0
- package/dist/checks/rope.js +21 -0
- package/dist/{concat-BmDqqFsa.js → concat-pHiVqR3L.js} +1 -1
- package/dist/{dataset-CJmEGu6D.js → dataset-DPPl-iLT.js} +7 -7
- package/dist/{dropout-sx0sjVAT.js → dropout-CcKSfOYE.js} +11 -11
- package/dist/{exports_initializers-DAKM8UO9.js → exports_initializers-DKk7-bsx.js} +1 -1
- package/dist/{gather-C1siEkdp.js → gather-CPg6ZlQA.js} +1 -1
- package/dist/{gelu-Bd3UBBxg.js → gelu-BkcmEEyD.js} +1 -1
- package/dist/{gpgpu_math-TFLxaLkw.js → gpgpu_math-D_ODOLix.js} +2 -2
- package/dist/{index-CUQrfsw_.js → index-DdmHGZjq.js} +655 -647
- package/dist/{index-BaPo_0H8.js → index-evZ57wr4.js} +10 -10
- package/dist/{kernel_funcs_utils-P9aFa232.js → kernel_funcs_utils-CDfFpUab.js} +15 -15
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +5 -5
- package/dist/layers/PositionEmbedding.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +4 -4
- package/dist/layers/TiedEmbedding.js +5 -5
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +9 -7
- package/dist/{log_sum_exp-C142qZqY.js → log_sum_exp-C8yFJfZz.js} +45 -24
- package/dist/main.d.ts +1 -0
- package/dist/main.js +9 -7
- package/dist/{mat_mul-DMkduNJu.js → mat_mul-Dpy2mMRu.js} +1 -1
- package/dist/{mod-uUuj4gSb.js → mod-CbibJi3D.js} +1 -1
- package/dist/models/NanoGPTV1.js +1 -1
- package/dist/models/model.js +9 -7
- package/dist/{mulmat_packed_gpu-Cm2gw-c8.js → mulmat_packed_gpu-q_Gmwyld.js} +1 -1
- package/dist/{ones-ZdgQGBCP.js → ones-BAqVh-eA.js} +2 -2
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.js +1 -1
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/cpu/adamAdjust.js +1 -1
- package/dist/ops/cpu/adamMoments.js +2 -2
- package/dist/ops/cpu/appendCache.js +2 -2
- package/dist/ops/cpu/attentionMask.js +5 -5
- package/dist/ops/cpu/fusedSoftmax.js +2 -2
- package/dist/ops/cpu/gatherSub.js +5 -5
- package/dist/ops/cpu/gelu.js +1 -1
- package/dist/ops/cpu/matMulGelu.js +2 -2
- package/dist/ops/cpu/matMulMul.js +1 -1
- package/dist/ops/cpu/mulDropout.js +1 -1
- package/dist/ops/cpu/normRMS.js +1 -1
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +5 -5
- package/dist/ops/cpu/scatterSub.js +13 -13
- package/dist/ops/fusedSoftmax.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/attentionMask.js +1 -1
- package/dist/ops/grads/fusedSoftmax.js +2 -2
- package/dist/ops/grads/gelu.js +2 -2
- package/dist/ops/grads/matMulGelu.js +1 -1
- package/dist/ops/grads/normRMS.js +1 -1
- package/dist/ops/grads/qkv.js +1 -1
- package/dist/ops/grads/rope.js +1 -1
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/qkv.js +1 -1
- package/dist/ops/rope.js +4 -4
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/webgl/adamAdjust.js +2 -2
- package/dist/ops/webgl/adamMoments.js +1 -1
- package/dist/ops/webgl/appendCache.js +1 -1
- package/dist/ops/webgl/attentionMask.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +4 -4
- package/dist/ops/webgl/gatherSub.js +1 -1
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +3 -3
- package/dist/ops/webgl/matMulGelu.js +4 -4
- package/dist/ops/webgl/matMulMul.js +1 -1
- package/dist/ops/webgl/mulDropout.js +1 -1
- package/dist/ops/webgl/normRMS.js +2 -2
- package/dist/ops/webgl/qkv.js +1 -1
- package/dist/ops/webgl/rope.js +1 -1
- package/dist/ops/webgl/scatterSub.js +1 -1
- package/dist/ops/webgpu/adamAdjust.js +3 -3
- package/dist/ops/webgpu/adamMoments.js +3 -3
- package/dist/ops/webgpu/appendCache.js +3 -3
- package/dist/ops/webgpu/attentionMask.js +3 -3
- package/dist/ops/webgpu/gatherSub.js +3 -3
- package/dist/ops/webgpu/gelu.js +3 -3
- package/dist/ops/webgpu/normRMS.js +2 -2
- package/dist/ops/webgpu/normRMSGrad.js +5 -5
- package/dist/ops/webgpu/qkv.js +3 -3
- package/dist/ops/webgpu/rope.js +3 -3
- package/dist/ops/webgpu/scatterSub.js +3 -3
- package/dist/ops/webgpu/utils/reductions.js +4 -4
- package/dist/ops-542ai2vG.js +1525 -0
- package/dist/{random_width-D8Pwy_na.js → random_width-DKGeiFuR.js} +1514 -1581
- package/dist/{range-LVHrSLdi.js → range-BcUvLuf5.js} +1 -1
- package/dist/{reciprocal-CaR9e67G.js → reciprocal-DhDWSKiD.js} +1 -1
- package/dist/{register_all_kernels-DUshvVWP.js → register_all_kernels-Do9VvZmo.js} +2312 -2335
- package/dist/{max-B3JOcNGb.js → relu-B1AXs7p5.js} +6 -6
- package/dist/{reshape-DEfQGSin.js → reshape-WeJkT3ja.js} +1 -1
- package/dist/{scatter_nd_util-CUPPNLaA.js → scatter_nd_util-B7yDhiQr.js} +1 -1
- package/dist/{selu_util-8vv5JxQV.js → selu_util-BgUO9gHY.js} +125 -146
- package/dist/{shared-D1elLckx.js → shared-CZiWmQCI.js} +1 -1
- package/dist/{shared-CkNorDcU.js → shared-V6D_md-c.js} +120 -120
- package/dist/{sin-D2CKKmyR.js → sin-CPxad7Am.js} +1 -1
- package/dist/{slice-BnyE-M_7.js → slice-B7jXtPnp.js} +1 -1
- package/dist/{softmax-DLoZWYBx.js → softmax-BfsyI4As.js} +1 -1
- package/dist/{split-By_n4TKP.js → split-BPxr8_8m.js} +1 -1
- package/dist/{stack-DkdFLq37.js → stack-BNwLzE43.js} +1 -1
- package/dist/{sum-l_0SqM4h.js → sum-ByFINZgi.js} +1 -1
- package/dist/{tensor-BAQdLqoU.js → tensor-DbqgIV9B.js} +1 -1
- package/dist/tensor1d-CtJq5BOv.js +27 -0
- package/dist/{tensor2d-BHy261cI.js → tensor2d-CObBWBkW.js} +1 -1
- package/dist/tensor3d-BOukqWwr.js +30 -0
- package/dist/tensor4d-DLtk7Nxh.js +30 -0
- package/dist/training/Adam.js +2 -2
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.js +2 -2
- package/dist/training/FullTrainer.js +1 -1
- package/dist/training/Trainer.js +2 -2
- package/dist/training/sparseCrossEntropy.js +8 -9
- package/dist/utilities/arrayClose.d.ts +1 -1
- package/dist/utilities/arrayClose.js +16 -7
- package/dist/utilities/dummy.js +2 -2
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-C9hihzDB.js → variable-DPFOJyRG.js} +1 -1
- package/dist/{webgpu_program-dFEVbDPL.js → webgpu_program-Dhk9R5aG.js} +1 -1
- package/dist/{webgpu_util-DLImlSc6.js → webgpu_util-BqGnZg8t.js} +1 -1
- package/dist/{zeros-VZ72lWXM.js → zeros-Dnwix0p4.js} +1 -1
- package/package.json +1 -1
- package/dist/ops-C_1K_-35.js +0 -1202
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ak as S, T as h, ag as k, d as v, al as o, am as p, an as g, n as N, t as y } from "./index-DdmHGZjq.js";
|
|
2
2
|
import { s as R } from "./index-C4L8Cm77.js";
|
|
3
|
-
import { s as $ } from "./stack-
|
|
4
|
-
import { t as B } from "./tensor-
|
|
3
|
+
import { s as $ } from "./stack-BNwLzE43.js";
|
|
4
|
+
import { t as B } from "./tensor-DbqgIV9B.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -381,7 +381,7 @@ class i {
|
|
|
381
381
|
* throw an `Error`.
|
|
382
382
|
*/
|
|
383
383
|
handleErrors(t) {
|
|
384
|
-
return new
|
|
384
|
+
return new Z(this, t);
|
|
385
385
|
}
|
|
386
386
|
// TODO(soergel): Implement reduce() etc.
|
|
387
387
|
/**
|
|
@@ -708,7 +708,7 @@ class K extends i {
|
|
|
708
708
|
return { value: r, done: !1 };
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
class
|
|
711
|
+
class Z extends i {
|
|
712
712
|
constructor(t, e) {
|
|
713
713
|
super(), this.upstream = t, this.handler = e, this.count = 0, this.lastRead = Promise.resolve({ value: null, done: !1 });
|
|
714
714
|
}
|
|
@@ -745,7 +745,7 @@ class w extends i {
|
|
|
745
745
|
return { value: r, done: !1 };
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
-
class
|
|
748
|
+
class j extends i {
|
|
749
749
|
constructor() {
|
|
750
750
|
super(), this.outputQueue = new f(), this.lastRead = Promise.resolve({ value: null, done: !1 });
|
|
751
751
|
}
|
|
@@ -759,7 +759,7 @@ class Z extends i {
|
|
|
759
759
|
return { value: this.outputQueue.shift(), done: !1 };
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
class tt extends
|
|
762
|
+
class tt extends j {
|
|
763
763
|
constructor(t, e) {
|
|
764
764
|
super(), this.upstream = t, this.transform = e;
|
|
765
765
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as
|
|
1
|
+
import { C as l, D as h, E as m, ao as p, M as c, ap as f, af as g, n as u, T as V, o as v, q as N, a as w } from "./index-DdmHGZjq.js";
|
|
2
|
+
import { s as d } from "./index-C4L8Cm77.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -41,7 +41,7 @@ class T {
|
|
|
41
41
|
constructor(t, e, s, n, o) {
|
|
42
42
|
this.mean = t, this.stdDev = e, this.dtype = s, this.nextVal = NaN, this.truncated = n, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
|
|
43
43
|
const a = o || Math.random();
|
|
44
|
-
this.random =
|
|
44
|
+
this.random = d.alea(a.toString());
|
|
45
45
|
}
|
|
46
46
|
/** Returns next sample from a Gaussian distribution. */
|
|
47
47
|
nextValue() {
|
|
@@ -69,11 +69,11 @@ class T {
|
|
|
69
69
|
return t <= this.upper && t >= this.lower;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class M {
|
|
73
73
|
constructor(t = 0, e = 1, s, n) {
|
|
74
74
|
if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = t, this.range = e - t, this.dtype = s, n == null && (n = Math.random()), typeof n == "number" && (n = n.toString()), !this.canReturnFloat() && this.range <= 1)
|
|
75
75
|
throw new Error(`The difference between ${t} - ${e} <= 1 and dtype is not float`);
|
|
76
|
-
this.random =
|
|
76
|
+
this.random = d.alea(n);
|
|
77
77
|
}
|
|
78
78
|
convertValue(t) {
|
|
79
79
|
return this.canReturnFloat() ? t : Math.round(t);
|
|
@@ -98,15 +98,15 @@ class $ {
|
|
|
98
98
|
* limitations under the License.
|
|
99
99
|
* =============================================================================
|
|
100
100
|
*/
|
|
101
|
-
function
|
|
101
|
+
function $(r, t = 0, e = 1, s, n) {
|
|
102
102
|
if (c(r), s != null && s === "bool")
|
|
103
103
|
throw new Error(`Unsupported data type ${s}`);
|
|
104
|
-
const o = new T(t, e, s, !1, n), a =
|
|
104
|
+
const o = new T(t, e, s, !1, n), a = f(r, s);
|
|
105
105
|
for (let i = 0; i < a.values.length; i++)
|
|
106
106
|
a.values[i] = o.nextValue();
|
|
107
107
|
return a.toTensor();
|
|
108
108
|
}
|
|
109
|
-
const _ = /* @__PURE__ */ l({ randomNormal_:
|
|
109
|
+
const _ = /* @__PURE__ */ l({ randomNormal_: $ });
|
|
110
110
|
/**
|
|
111
111
|
* @license
|
|
112
112
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -123,14 +123,14 @@ const _ = /* @__PURE__ */ l({ randomNormal_: y });
|
|
|
123
123
|
* limitations under the License.
|
|
124
124
|
* =============================================================================
|
|
125
125
|
*/
|
|
126
|
-
function
|
|
126
|
+
function y(r, t = 0, e = 1, s = "float32", n) {
|
|
127
127
|
c(r);
|
|
128
|
-
const o =
|
|
128
|
+
const o = f(r, s), a = new M(t, e, null, n);
|
|
129
129
|
for (let i = 0; i < o.values.length; i++)
|
|
130
130
|
o.values[i] = a.nextValue();
|
|
131
131
|
return o.toTensor();
|
|
132
132
|
}
|
|
133
|
-
const D = /* @__PURE__ */ l({ randomUniform_:
|
|
133
|
+
const D = /* @__PURE__ */ l({ randomUniform_: y });
|
|
134
134
|
/**
|
|
135
135
|
* @license
|
|
136
136
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aD as z, ag as v, aE as oe, aF as ie, aG as ae, n as F, aH as me, aI as J, a3 as B, aJ as I, af as T, j as E, aK as H, aL as $e, aM as Y, ae as Te } from "./index-DdmHGZjq.js";
|
|
2
2
|
import "./index-Tf7vU29b.js";
|
|
3
|
-
import { b as Se } from "./backend_util-
|
|
3
|
+
import { b as Se } from "./backend_util-yC3YH1jo.js";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2018 Google LLC. All Rights Reserved.
|