@genai-fi/nanogpt 0.5.6 → 0.6.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.
- package/dist/Generator.js +8 -7
- package/dist/NanoGPTModel.js +8 -8
- package/dist/{Reshape-Biok_3X1.js → Reshape-CLOrdpve.js} +2 -2
- package/dist/TeachableLLM.js +16 -15
- package/dist/{TiedEmbedding-8S8xn8e6.js → TiedEmbedding-BhxWO8QR.js} +5 -5
- package/dist/{axis_util-BczFISHz.js → axis_util-D17qZRQm.js} +1 -1
- package/dist/{broadcast_to-B7NGsBSh.js → broadcast_to-BMQLjvt_.js} +2 -2
- package/dist/{concat-DdKPyAtw.js → concat-DhZfF1GY.js} +1 -1
- package/dist/{dataset-iqT4Otvb.js → dataset-oilnemHf.js} +3 -3
- package/dist/{dropout-B09InSJS.js → dropout-CrMQPCeG.js} +1 -1
- package/dist/{gather-D6MsdXqc.js → gather-DZCMHZuN.js} +1 -1
- package/dist/{gpgpu_math-BFbOyvk4.js → gpgpu_math-Ctc31slO.js} +1 -1
- package/dist/{index-Du-bmOP8.js → index-bMBtI-WR.js} +50 -50
- package/dist/{kernel_funcs_utils-DShm7-0k.js → kernel_funcs_utils-CNmjLWnB.js} +26 -24
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +3 -3
- package/dist/layers/TiedEmbedding.js +6 -6
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/{log_sum_exp-CxfBtUaG.js → log_sum_exp-BHdkCb4s.js} +5 -5
- package/dist/main.js +20 -19
- package/dist/{mat_mul-CbiqIe2d.js → mat_mul-BsrLfy81.js} +1 -1
- package/dist/{max-0Xnlpv8k.js → max-DechV4Bc.js} +1 -1
- package/dist/{norm-01kY9I2B.js → norm-B9hWHZH1.js} +5 -5
- package/dist/{ones-CrutWGas.js → ones-g0K8jVwm.js} +2 -2
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- 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 +3 -3
- package/dist/ops/cpu/gelu.js +1 -1
- package/dist/ops/cpu/matMulGelu.js +1 -1
- 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 +4 -4
- package/dist/ops/fusedSoftmax.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +1 -1
- package/dist/ops/grads/attentionMask.js +15 -11
- package/dist/ops/grads/fusedSoftmax.js +12 -10
- package/dist/ops/grads/gelu.js +1 -1
- 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/log.d.ts +0 -0
- package/dist/ops/log.js +1 -0
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/node/sparseCrossEntropy.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/qkv.js +1 -1
- package/dist/ops/scatterSub.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 +205 -3022
- package/dist/ops/webgl/gatherSub.js +1 -1
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.d.ts +17 -0
- package/dist/ops/webgl/log.js +39 -0
- 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-CJNniCAV.js → ops-Mv7Ta72x.js} +13 -13
- package/dist/{random_width-C-v-35bY.js → random_width-BBAWzDym.js} +23 -23
- package/dist/{range-Bvs1hidm.js → range-DMaG9A3G.js} +1 -1
- package/dist/{reshape-BH7eBpwq.js → reshape-T4yDEqoF.js} +1 -1
- package/dist/shared-XNAoXhOa.js +2826 -0
- package/dist/{sin-CPAZXNjH.js → sin-EEhbrRO_.js} +1 -1
- package/dist/{slice_util-DskXqRZa.js → slice_util-Ddk0uxGJ.js} +1 -1
- package/dist/{softmax-DhWoBa7r.js → softmax-B2_IKPDR.js} +1 -1
- package/dist/{split-BCUhuU7B.js → split-dcks18H1.js} +1 -1
- package/dist/{stack-BV1v7l3S.js → stack-lpJ5kYvE.js} +1 -1
- package/dist/{sum-Cvq06317.js → sum-CutF5lj2.js} +1 -1
- package/dist/{tensor-DgTOPY6h.js → tensor-C15NA2LA.js} +1 -1
- package/dist/{tensor2d-CRWjDyUe.js → tensor2d-DZ_e5eKM.js} +1 -1
- package/dist/{tfjs_backend-D9Ytje0G.js → tfjs_backend-BDb8r9qx.js} +28 -28
- 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 +3 -3
- package/dist/training/sparseCrossEntropy.js +4 -4
- package/dist/utilities/dummy.js +2 -2
- package/dist/utilities/generate.js +3 -3
- package/dist/utilities/load.d.ts +25 -0
- package/dist/utilities/load.js +89 -37
- package/dist/utilities/profile.js +4 -4
- package/dist/utilities/safetensors.d.ts +3 -0
- package/dist/utilities/safetensors.js +83 -0
- package/dist/utilities/save.js +47 -29
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-DZ3fF0R2.js → variable-CdRKKp8x.js} +1 -1
- package/dist/{zeros-BaHhQTWf.js → zeros-CAbHfODe.js} +1 -1
- package/package.json +1 -1
package/dist/Generator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as u } from "./index-Dwqa6Zy2.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-bMBtI-WR.js";
|
|
3
3
|
import "./ops/cpu/attentionMask.js";
|
|
4
4
|
import "./ops/webgl/attentionMask.js";
|
|
5
5
|
import "./ops/grads/attentionMask.js";
|
|
@@ -21,21 +21,22 @@ import "./ops/grads/matMulGelu.js";
|
|
|
21
21
|
import "./ops/cpu/normRMS.js";
|
|
22
22
|
import "./ops/webgl/normRMS.js";
|
|
23
23
|
import "./ops/grads/normRMS.js";
|
|
24
|
-
import "./random_width-
|
|
24
|
+
import "./random_width-BBAWzDym.js";
|
|
25
25
|
import "./ops/cpu/gatherSub.js";
|
|
26
26
|
import "./ops/webgl/gatherSub.js";
|
|
27
27
|
import "./ops/cpu/scatterSub.js";
|
|
28
28
|
import "./ops/webgl/scatterSub.js";
|
|
29
29
|
import "./jszip.min-CjP2V1VV.js";
|
|
30
30
|
import f from "./tokeniser/CharTokeniser.js";
|
|
31
|
-
import "./dataset-
|
|
31
|
+
import "./dataset-oilnemHf.js";
|
|
32
32
|
import "./index-Tf7vU29b.js";
|
|
33
33
|
import "./papaparse.min-C8l2Kvo1.js";
|
|
34
34
|
import "./ops/cpu/gelu.js";
|
|
35
35
|
import "./ops/webgl/gelu.js";
|
|
36
36
|
import "./ops/grads/gelu.js";
|
|
37
|
-
import
|
|
38
|
-
import {
|
|
37
|
+
import "./ops/webgl/log.js";
|
|
38
|
+
import { t as d } from "./tensor2d-DZ_e5eKM.js";
|
|
39
|
+
import { c as g } from "./concat-DhZfF1GY.js";
|
|
39
40
|
const k = [
|
|
40
41
|
...Array.from({ length: 95 }, (a, t) => String.fromCharCode(t + 32)),
|
|
41
42
|
// ASCII
|
|
@@ -51,7 +52,7 @@ const k = [
|
|
|
51
52
|
function T(a, t) {
|
|
52
53
|
return a.length === t ? a : a.length > t ? a.slice(0, t) : a.concat(Array(t - a.length).fill(""));
|
|
53
54
|
}
|
|
54
|
-
class
|
|
55
|
+
class rt extends u {
|
|
55
56
|
constructor(t, o) {
|
|
56
57
|
super(), this.model = t, this.tokeniser = o;
|
|
57
58
|
}
|
|
@@ -123,5 +124,5 @@ class ot extends u {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
export {
|
|
126
|
-
|
|
127
|
+
rt as default
|
|
127
128
|
};
|
package/dist/NanoGPTModel.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { defaultConfig as F } from "./config.js";
|
|
2
2
|
import O from "./layers/TransformerBlock.js";
|
|
3
|
-
import { T as N, r as R } from "./TiedEmbedding-
|
|
3
|
+
import { T as N, r as R } from "./TiedEmbedding-BhxWO8QR.js";
|
|
4
4
|
import A from "./layers/RoPECache.js";
|
|
5
5
|
import G from "./layers/RMSNorm.js";
|
|
6
6
|
import { estimateParameterCount as j } from "./utilities/parameters.js";
|
|
7
7
|
import { createSoftmaxCrossEntropyWithGrad as B } from "./training/sparseCrossEntropy.js";
|
|
8
8
|
import V from "./layers/BaseLayer.js";
|
|
9
|
-
import { E as H, D as W, p as J } from "./random_width-
|
|
10
|
-
import { o as x, j as y, u as Q, E as I, a9 as U, aa as X, ab as Y, t as z, a8 as Z, f as L, H as tt } from "./index-
|
|
11
|
-
import { r as T } from "./reshape-
|
|
12
|
-
import { r as et } from "./range-
|
|
13
|
-
import { s as q } from "./softmax-
|
|
14
|
-
import { t as ot } from "./ops-
|
|
15
|
-
import { g as st } from "./gather-
|
|
9
|
+
import { E as H, D as W, p as J } from "./random_width-BBAWzDym.js";
|
|
10
|
+
import { o as x, j as y, u as Q, E as I, a9 as U, aa as X, ab as Y, t as z, a8 as Z, f as L, H as tt } from "./index-bMBtI-WR.js";
|
|
11
|
+
import { r as T } from "./reshape-T4yDEqoF.js";
|
|
12
|
+
import { r as et } from "./range-DMaG9A3G.js";
|
|
13
|
+
import { s as q } from "./softmax-B2_IKPDR.js";
|
|
14
|
+
import { t as ot } from "./ops-Mv7Ta72x.js";
|
|
15
|
+
import { g as st } from "./gather-DZCMHZuN.js";
|
|
16
16
|
/**
|
|
17
17
|
* @license
|
|
18
18
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ac as f, ad as g, q as p, ae as C, l as x } from "./index-
|
|
2
|
-
import { u as I } from "./gpgpu_math-
|
|
1
|
+
import { ac as f, ad as g, q as p, ae as C, l as x } from "./index-bMBtI-WR.js";
|
|
2
|
+
import { u as I } from "./gpgpu_math-Ctc31slO.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
package/dist/TeachableLLM.js
CHANGED
|
@@ -11,7 +11,7 @@ import g from "./tokeniser/bpe.js";
|
|
|
11
11
|
import "./papaparse.min-C8l2Kvo1.js";
|
|
12
12
|
import "./index-Tf7vU29b.js";
|
|
13
13
|
import "./jszip.min-CjP2V1VV.js";
|
|
14
|
-
import "./index-
|
|
14
|
+
import "./index-bMBtI-WR.js";
|
|
15
15
|
import "./ops/cpu/scatterSub.js";
|
|
16
16
|
import "./ops/webgl/scatterSub.js";
|
|
17
17
|
import "./ops/cpu/gatherSub.js";
|
|
@@ -40,6 +40,7 @@ import "./ops/grads/gelu.js";
|
|
|
40
40
|
import "./ops/cpu/normRMS.js";
|
|
41
41
|
import "./ops/webgl/normRMS.js";
|
|
42
42
|
import "./ops/grads/normRMS.js";
|
|
43
|
+
import "./ops/webgl/log.js";
|
|
43
44
|
import w from "./utilities/profile.js";
|
|
44
45
|
class a {
|
|
45
46
|
ee = new _();
|
|
@@ -91,25 +92,25 @@ class a {
|
|
|
91
92
|
}
|
|
92
93
|
static loadModel(t) {
|
|
93
94
|
const e = new a();
|
|
94
|
-
return f(t).then(({ model:
|
|
95
|
-
e._model =
|
|
95
|
+
return f(t).then(({ model: r, tokeniser: s, name: o }) => {
|
|
96
|
+
e._model = r, e._tokeniser = s, e._config = r.config, o && (e.meta.name = o), e.setStatus("warmup"), m(r).then(() => {
|
|
96
97
|
e.setStatus("ready"), e.ee.emit("loaded");
|
|
97
|
-
}).catch((
|
|
98
|
-
e.setStatus("error"), e.ee.emit("error",
|
|
98
|
+
}).catch((i) => {
|
|
99
|
+
e.setStatus("error"), e.ee.emit("error", i);
|
|
99
100
|
});
|
|
100
|
-
}).catch((
|
|
101
|
-
e.setStatus("error"), e.ee.emit("error",
|
|
101
|
+
}).catch((r) => {
|
|
102
|
+
e.setStatus("error"), e.ee.emit("error", r);
|
|
102
103
|
}), e;
|
|
103
104
|
}
|
|
104
105
|
static create(t, e = {}) {
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
n === "trained" &&
|
|
106
|
+
const r = { ...h, ...e }, s = t === "char" ? new c(r.vocabSize) : new g(r.vocabSize), o = new l(r), i = new a(s, o);
|
|
107
|
+
return i.setStatus("warmup"), m(o).then(() => {
|
|
108
|
+
i.tokeniser.trained ? (i.setStatus("ready"), i.ee.emit("loaded")) : (i.setStatus("awaitingTokens"), i.ee.emit("loaded"), i.tokeniser.once("trainStatus", (n) => {
|
|
109
|
+
n === "trained" && i.setStatus("ready");
|
|
109
110
|
}));
|
|
110
111
|
}).catch((n) => {
|
|
111
|
-
|
|
112
|
-
}),
|
|
112
|
+
i.setStatus("error"), i.ee.emit("error", n);
|
|
113
|
+
}), i;
|
|
113
114
|
}
|
|
114
115
|
getProfiler() {
|
|
115
116
|
return this._model?.getProfiler();
|
|
@@ -134,10 +135,10 @@ class a {
|
|
|
134
135
|
if (!this._model || !this._tokeniser)
|
|
135
136
|
throw new Error("Model or tokeniser is not initialized.");
|
|
136
137
|
const t = new p(this._model, this._tokeniser);
|
|
137
|
-
return t.on("start", () => this.setStatus("training")), t.on("stop", () => this.setStatus("ready")), t.on("log", async (e,
|
|
138
|
+
return t.on("start", () => this.setStatus("training")), t.on("stop", () => this.setStatus("ready")), t.on("log", async (e, r) => {
|
|
138
139
|
const s = this.ee.listeners("trainStep");
|
|
139
140
|
for (const o of s)
|
|
140
|
-
await o(e,
|
|
141
|
+
await o(e, r);
|
|
141
142
|
}), t;
|
|
142
143
|
}
|
|
143
144
|
train(t, e) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { R as a } from "./random_width-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { d as s } from "./tfjs_backend-
|
|
1
|
+
import { R as a } from "./random_width-BBAWzDym.js";
|
|
2
|
+
import "./index-bMBtI-WR.js";
|
|
3
|
+
import { d as s } from "./tfjs_backend-BDb8r9qx.js";
|
|
4
4
|
import o from "./layers/BaseLayer.js";
|
|
5
|
-
import { v as m } from "./variable-
|
|
6
|
-
import { g as d } from "./gather-
|
|
5
|
+
import { v as m } from "./variable-CdRKKp8x.js";
|
|
6
|
+
import { g as d } from "./gather-DZCMHZuN.js";
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2018 Google LLC
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as h, j as f, n as p, y as g, E as u, L as b } from "./index-
|
|
2
|
-
import { r as T } from "./reshape-
|
|
1
|
+
import { o as h, j as f, n as p, y as g, E as u, L as b } from "./index-bMBtI-WR.js";
|
|
2
|
+
import { r as T } from "./reshape-T4yDEqoF.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { af as S, T as h, N, a as v, ag as o, ah as p, ai as g, l as k, t as y } from "./index-
|
|
1
|
+
import { af as S, T as h, N, a as v, ag as o, ah as p, ai as g, l as k, t as y } from "./index-bMBtI-WR.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-lpJ5kYvE.js";
|
|
4
|
+
import { t as B } from "./tensor-C15NA2LA.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as l, j as h, E as m, aj as p, n as c, ak as d, ad as g, l as u, T as V, al as v, a8 as N, b as w } from "./index-
|
|
1
|
+
import { o as l, j as h, E as m, aj as p, n as c, ak as d, ad as g, l as u, T as V, al as v, a8 as N, b as w } from "./index-bMBtI-WR.js";
|
|
2
2
|
import { s as f } from "./index-C4L8Cm77.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -4030,7 +4030,7 @@ export {
|
|
|
4030
4030
|
ne as Z,
|
|
4031
4031
|
dr as _,
|
|
4032
4032
|
M as a,
|
|
4033
|
-
|
|
4033
|
+
va as a$,
|
|
4034
4034
|
oa as a0,
|
|
4035
4035
|
xe as a1,
|
|
4036
4036
|
ns as a2,
|
|
@@ -4041,33 +4041,33 @@ export {
|
|
|
4041
4041
|
qr as a7,
|
|
4042
4042
|
S as a8,
|
|
4043
4043
|
la as a9,
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4044
|
+
oo as aA,
|
|
4045
|
+
yo as aB,
|
|
4046
|
+
_a as aC,
|
|
4047
|
+
er as aD,
|
|
4048
|
+
Pa as aE,
|
|
4049
|
+
Ar as aF,
|
|
4050
|
+
Rr as aG,
|
|
4051
|
+
_r as aH,
|
|
4052
|
+
Or as aI,
|
|
4053
|
+
Gr as aJ,
|
|
4054
|
+
jr as aK,
|
|
4055
|
+
Kr as aL,
|
|
4056
|
+
ha as aM,
|
|
4057
|
+
Jr as aN,
|
|
4058
|
+
ia as aO,
|
|
4059
|
+
Ta as aP,
|
|
4060
|
+
$a as aQ,
|
|
4061
|
+
Ds as aR,
|
|
4062
|
+
no as aS,
|
|
4063
|
+
eo as aT,
|
|
4064
|
+
yr as aU,
|
|
4065
|
+
$r as aV,
|
|
4066
|
+
ao as aW,
|
|
4067
|
+
da as aX,
|
|
4068
|
+
ma as aY,
|
|
4069
|
+
ga as aZ,
|
|
4070
|
+
Na as a_,
|
|
4071
4071
|
ua as aa,
|
|
4072
4072
|
Za as ab,
|
|
4073
4073
|
$t as ac,
|
|
@@ -4082,30 +4082,30 @@ export {
|
|
|
4082
4082
|
x as al,
|
|
4083
4083
|
jt as am,
|
|
4084
4084
|
ue as an,
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4085
|
+
xs as ao,
|
|
4086
|
+
$e as ap,
|
|
4087
|
+
ho as aq,
|
|
4088
|
+
za as ar,
|
|
4089
|
+
rr as as,
|
|
4090
|
+
Br as at,
|
|
4091
|
+
Wr as au,
|
|
4092
|
+
Sa as av,
|
|
4093
|
+
Aa as aw,
|
|
4094
|
+
Ra as ax,
|
|
4095
|
+
ro as ay,
|
|
4096
|
+
Io as az,
|
|
4097
4097
|
b,
|
|
4098
4098
|
Vs as b$,
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4099
|
+
to as b0,
|
|
4100
|
+
$s as b1,
|
|
4101
|
+
ko as b2,
|
|
4102
|
+
Ps as b3,
|
|
4103
|
+
Cs as b4,
|
|
4104
|
+
Lt as b5,
|
|
4105
|
+
te as b6,
|
|
4106
|
+
uo as b7,
|
|
4107
|
+
dn as b8,
|
|
4108
|
+
Re as b9,
|
|
4109
4109
|
ya as bA,
|
|
4110
4110
|
pa as bB,
|
|
4111
4111
|
wa as bC,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { am as
|
|
2
|
-
import { u as g } from "./gpgpu_math-
|
|
1
|
+
import { am as N, an as D, Q as P, q as E, U as v, N as w } from "./index-bMBtI-WR.js";
|
|
2
|
+
import { u as g } from "./gpgpu_math-Ctc31slO.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
5
5
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -18,13 +18,13 @@ import { u as g } from "./gpgpu_math-BFbOyvk4.js";
|
|
|
18
18
|
*/
|
|
19
19
|
function B(t) {
|
|
20
20
|
try {
|
|
21
|
-
return t.map((e) =>
|
|
21
|
+
return t.map((e) => N(e));
|
|
22
22
|
} catch (e) {
|
|
23
23
|
throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function H(t) {
|
|
27
|
-
return t.map((e) =>
|
|
27
|
+
return t.map((e) => D(e));
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
@@ -42,7 +42,7 @@ function H(t) {
|
|
|
42
42
|
* limitations under the License.
|
|
43
43
|
* =============================================================================
|
|
44
44
|
*/
|
|
45
|
-
function
|
|
45
|
+
function R(t) {
|
|
46
46
|
if (t <= 1)
|
|
47
47
|
return "int";
|
|
48
48
|
if (t === 2)
|
|
@@ -73,11 +73,11 @@ function k(t) {
|
|
|
73
73
|
* limitations under the License.
|
|
74
74
|
* =============================================================================
|
|
75
75
|
*/
|
|
76
|
-
function
|
|
76
|
+
function _(t, e) {
|
|
77
77
|
return ["x", "y", "z", "w", "u", "v"].slice(0, e).map((a) => `${t}.${a}`);
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
return e === 1 ? [t] :
|
|
79
|
+
function k(t, e) {
|
|
80
|
+
return e === 1 ? [t] : _(t, e);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* @license
|
|
@@ -97,7 +97,7 @@ function z(t, e) {
|
|
|
97
97
|
*/
|
|
98
98
|
class C {
|
|
99
99
|
constructor(e, a, u) {
|
|
100
|
-
this.variableNames = ["A", "B"], this.outputShape =
|
|
100
|
+
this.variableNames = ["A", "B"], this.outputShape = P(a, u), this.enableShapeUniforms = g(this.outputShape.length), this.userCode = `
|
|
101
101
|
float binaryOperation(float a, float b) {
|
|
102
102
|
${e}
|
|
103
103
|
}
|
|
@@ -126,21 +126,21 @@ class C {
|
|
|
126
126
|
* limitations under the License.
|
|
127
127
|
* =============================================================================
|
|
128
128
|
*/
|
|
129
|
-
class
|
|
129
|
+
class z {
|
|
130
130
|
constructor(e, a, u, d = !1) {
|
|
131
|
-
this.variableNames = ["A", "B"], this.supportsBroadcasting = !0, this.packedInputs = !0, this.packedOutput = !0, this.outputShape =
|
|
131
|
+
this.variableNames = ["A", "B"], this.supportsBroadcasting = !0, this.packedInputs = !0, this.packedOutput = !0, this.outputShape = P(a, u);
|
|
132
132
|
const o = this.outputShape.length;
|
|
133
133
|
this.enableShapeUniforms = g(o);
|
|
134
134
|
let n = "";
|
|
135
135
|
if (d)
|
|
136
|
-
if (o === 0 ||
|
|
136
|
+
if (o === 0 || E(this.outputShape) === 1)
|
|
137
137
|
n = `
|
|
138
138
|
result.y = 0.;
|
|
139
139
|
result.z = 0.;
|
|
140
140
|
result.w = 0.;
|
|
141
141
|
`;
|
|
142
142
|
else if (n = `
|
|
143
|
-
${
|
|
143
|
+
${R(o)} coords = getOutputCoords();
|
|
144
144
|
`, o === 1)
|
|
145
145
|
this.enableShapeUniforms ? n += `
|
|
146
146
|
result.y = (coords + 1) >= outShape ? 0. : result.y;
|
|
@@ -152,7 +152,7 @@ class _ {
|
|
|
152
152
|
result.w = 0.;
|
|
153
153
|
`;
|
|
154
154
|
else {
|
|
155
|
-
const s =
|
|
155
|
+
const s = k("coords", o);
|
|
156
156
|
this.enableShapeUniforms ? n += `
|
|
157
157
|
bool nextRowOutOfBounds =
|
|
158
158
|
(${s[o - 2]} + 1) >= outShape[${o} - 2];
|
|
@@ -309,19 +309,20 @@ class L {
|
|
|
309
309
|
* limitations under the License.
|
|
310
310
|
* =============================================================================
|
|
311
311
|
*/
|
|
312
|
-
|
|
312
|
+
const Y = "if (isnan(x)) return x;";
|
|
313
|
+
function q({ opSnippet: t, packedOpSnippet: e, cpuKernelImpl: a, dtype: u }) {
|
|
313
314
|
return ({ inputs: d, backend: o }) => {
|
|
314
315
|
const { x: n } = d, l = o, s = u || n.dtype;
|
|
315
316
|
if (l.shouldExecuteOnCPU([n]) && a != null) {
|
|
316
317
|
const c = l.texData.get(n.dataId), x = a(c.values, s);
|
|
317
318
|
return l.makeTensorInfo(n.shape, s, x);
|
|
318
319
|
}
|
|
319
|
-
const i =
|
|
320
|
+
const i = w().getBool("WEBGL_PACK_UNARY_OPERATIONS") && e != null;
|
|
320
321
|
let r;
|
|
321
322
|
return i ? r = new L(n.shape, e) : r = new V(n.shape, t), l.runWebGLProgram(r, [n], s);
|
|
322
323
|
};
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
+
function Q({ opSnippet: t, packedOpSnippet: e, checkOutOfBounds: a = !1, supportsComplex: u = !1, cpuKernelImpl: d, dtype: o }) {
|
|
325
326
|
return ({ inputs: n, backend: l }) => {
|
|
326
327
|
const { a: s, b: i } = n, r = l;
|
|
327
328
|
if (u && s.dtype === "complex64") {
|
|
@@ -353,17 +354,18 @@ function q({ opSnippet: t, packedOpSnippet: e, checkOutOfBounds: a = !1, support
|
|
|
353
354
|
) : f, [I, S] = d(s.shape, i.shape, y, O, c), p = r.makeTensorInfo(S, c), m = r.texData.get(p.dataId);
|
|
354
355
|
return m.values = I, p;
|
|
355
356
|
}
|
|
356
|
-
const x =
|
|
357
|
+
const x = w().getBool("WEBGL_PACK_BINARY_OPERATIONS") && e != null;
|
|
357
358
|
let b;
|
|
358
|
-
return x ? b = new
|
|
359
|
+
return x ? b = new z(e, s.shape, i.shape, a) : b = new C(t, s.shape, i.shape), r.runWebGLProgram(b, [s, i], c);
|
|
359
360
|
};
|
|
360
361
|
}
|
|
361
362
|
export {
|
|
362
363
|
K as C,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
_ as a,
|
|
365
|
+
Q as b,
|
|
366
|
+
H as c,
|
|
367
|
+
Y as d,
|
|
366
368
|
B as f,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
+
R as g,
|
|
370
|
+
q as u
|
|
369
371
|
};
|
package/dist/layers/BaseLayer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as g, c as p, e as o, i as v } from "../index-
|
|
2
|
-
import { v as _ } from "../variable-
|
|
1
|
+
import { T as g, c as p, e as o, i as v } from "../index-bMBtI-WR.js";
|
|
2
|
+
import { v as _ } from "../variable-CdRKKp8x.js";
|
|
3
3
|
class M {
|
|
4
4
|
parent;
|
|
5
5
|
config;
|
|
@@ -3,13 +3,13 @@ import O from "./BaseLayer.js";
|
|
|
3
3
|
import { qkv as P } from "../ops/qkv.js";
|
|
4
4
|
import { rope as v } from "../ops/rope.js";
|
|
5
5
|
import { appendCache as V } from "../ops/appendCache.js";
|
|
6
|
-
import { H as c, t as C } from "../index-
|
|
6
|
+
import { H as c, t as C } from "../index-bMBtI-WR.js";
|
|
7
7
|
import { fusedSoftmax as T } from "../ops/fusedSoftmax.js";
|
|
8
|
-
import { d as y } from "../tfjs_backend-
|
|
9
|
-
import { v as b } from "../variable-
|
|
10
|
-
import { r as k, d as L } from "../dropout-
|
|
11
|
-
import { r as N } from "../reshape-
|
|
12
|
-
import { m as R } from "../mat_mul-
|
|
8
|
+
import { d as y } from "../tfjs_backend-BDb8r9qx.js";
|
|
9
|
+
import { v as b } from "../variable-CdRKKp8x.js";
|
|
10
|
+
import { r as k, d as L } from "../dropout-CrMQPCeG.js";
|
|
11
|
+
import { r as N } from "../reshape-T4yDEqoF.js";
|
|
12
|
+
import { m as R } from "../mat_mul-BsrLfy81.js";
|
|
13
13
|
class $ extends O {
|
|
14
14
|
divisor;
|
|
15
15
|
index;
|
package/dist/layers/MLP.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as l } from "../index-
|
|
1
|
+
import { t as l } from "../index-bMBtI-WR.js";
|
|
2
2
|
import u from "./BaseLayer.js";
|
|
3
3
|
import { matMulGelu as M } from "../ops/matMulGelu.js";
|
|
4
|
-
import { v as o } from "../variable-
|
|
5
|
-
import { r as h, d as f } from "../dropout-
|
|
6
|
-
import { r as d } from "../reshape-
|
|
7
|
-
import { m as c } from "../mat_mul-
|
|
4
|
+
import { v as o } from "../variable-CdRKKp8x.js";
|
|
5
|
+
import { r as h, d as f } from "../dropout-CrMQPCeG.js";
|
|
6
|
+
import { r as d } from "../reshape-T4yDEqoF.js";
|
|
7
|
+
import { m as c } from "../mat_mul-BsrLfy81.js";
|
|
8
8
|
class V extends u {
|
|
9
9
|
index;
|
|
10
10
|
hiddenUnits;
|
package/dist/layers/RMSNorm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as s } from "../index-
|
|
1
|
+
import { t as s } from "../index-bMBtI-WR.js";
|
|
2
2
|
import e from "./BaseLayer.js";
|
|
3
3
|
import { normRMS as a } from "../ops/normRMS.js";
|
|
4
|
-
import { v as i } from "../variable-
|
|
5
|
-
import { o as m } from "../ones-
|
|
4
|
+
import { v as i } from "../variable-CdRKKp8x.js";
|
|
5
|
+
import { o as m } from "../ones-g0K8jVwm.js";
|
|
6
6
|
class f extends e {
|
|
7
7
|
GAMMA;
|
|
8
8
|
constructor(r, t = "", o) {
|
package/dist/layers/RoPECache.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as c, j as f, E as l, V as m, f as n, W as u, t as p, H as a } from "../index-
|
|
2
|
-
import { c as d, s as C } from "../sin-
|
|
3
|
-
import { r as h } from "../range-
|
|
1
|
+
import { o as c, j as f, E as l, V as m, f as n, W as u, t as p, H as a } from "../index-bMBtI-WR.js";
|
|
2
|
+
import { c as d, s as C } from "../sin-EEhbrRO_.js";
|
|
3
|
+
import { r as h } from "../range-DMaG9A3G.js";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../random_width-
|
|
2
|
-
import "../index-
|
|
3
|
-
import { T as f } from "../TiedEmbedding-
|
|
4
|
-
import "../tfjs_backend-
|
|
1
|
+
import "../random_width-BBAWzDym.js";
|
|
2
|
+
import "../index-bMBtI-WR.js";
|
|
3
|
+
import { T as f } from "../TiedEmbedding-BhxWO8QR.js";
|
|
4
|
+
import "../tfjs_backend-BDb8r9qx.js";
|
|
5
5
|
import "./BaseLayer.js";
|
|
6
|
-
import "../variable-
|
|
7
|
-
import "../gather-
|
|
6
|
+
import "../variable-CdRKKp8x.js";
|
|
7
|
+
import "../gather-DZCMHZuN.js";
|
|
8
8
|
export {
|
|
9
9
|
f as default
|
|
10
10
|
};
|
|
@@ -2,7 +2,7 @@ import l from "./CausalSelfAttention.js";
|
|
|
2
2
|
import r from "./MLP.js";
|
|
3
3
|
import o from "./RMSNorm.js";
|
|
4
4
|
import d from "./BaseLayer.js";
|
|
5
|
-
import { t as p } from "../index-
|
|
5
|
+
import { t as p } from "../index-bMBtI-WR.js";
|
|
6
6
|
class k extends d {
|
|
7
7
|
ln1;
|
|
8
8
|
attn;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { o as r, j as p, E as u, a6 as E, a7 as h, a1 as S, s as $, a8 as d } from "./index-
|
|
2
|
-
import { e as K } from "./axis_util-
|
|
3
|
-
import { m as T } from "./max-
|
|
4
|
-
import { r as m } from "./reshape-
|
|
5
|
-
import { s as _ } from "./sum-
|
|
1
|
+
import { o as r, j as p, E as u, a6 as E, a7 as h, a1 as S, s as $, a8 as d } from "./index-bMBtI-WR.js";
|
|
2
|
+
import { e as K } from "./axis_util-D17qZRQm.js";
|
|
3
|
+
import { m as T } from "./max-DechV4Bc.js";
|
|
4
|
+
import { r as m } from "./reshape-T4yDEqoF.js";
|
|
5
|
+
import { s as _ } from "./sum-CutF5lj2.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license
|
|
8
8
|
* Copyright 2018 Google LLC. All Rights Reserved.
|