@genai-fi/nanogpt 0.10.3 → 0.11.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.d.ts +10 -5
- package/dist/Generator.js +1789 -1765
- package/dist/{RealDiv-KAPDe8zB.js → RealDiv-Ds-jvL09.js} +22 -22
- package/dist/{Reshape-BYkmUnAv.js → Reshape-Cd6e-Otn.js} +1 -1
- package/dist/{Reshape-Zt6eb7yh.js → Reshape-Ct266DEk.js} +9 -9
- package/dist/TeachableLLM.d.ts +4 -3
- package/dist/TeachableLLM.js +14 -14
- package/dist/Trainer.d.ts +2 -2
- package/dist/Trainer.js +6 -6
- package/dist/{axis_util-BaG7mf5A.js → axis_util-DofAuy0p.js} +3 -3
- package/dist/backend.js +2 -2
- package/dist/{backend_util-RCe-rHaj.js → backend_util-C7NWHpv7.js} +7 -7
- package/dist/{backend_webgpu-DE3ACOLx.js → backend_webgpu-B0Vls736.js} +10 -10
- package/dist/{broadcast_to-B3eYlZm7.js → broadcast_to-DDaNMbX7.js} +2 -2
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +3 -3
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/matMulGelu.js +2 -2
- package/dist/checks/normRMS.js +4 -4
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.js +2 -2
- package/dist/checks/qkv.js +4 -4
- package/dist/checks/rope.js +2 -2
- package/dist/{clip_by_value-BnO7-a88.js → clip_by_value-Dn5tzexi.js} +4 -4
- package/dist/complex-DClmWqJt.js +11 -0
- package/dist/{concat-BV8bt5H-.js → concat-C6X3AAlQ.js} +1 -1
- package/dist/{concat_util-DpW8mL_l.js → concat_util-CHsJFZJJ.js} +1 -1
- package/dist/{dataset-BcwmTGYc.js → dataset-DcjWqUVQ.js} +7 -7
- package/dist/{dropout-BcvN9JYi.js → dropout-OxuaJz6z.js} +11 -11
- package/dist/{expand_dims-DT4tEPwA.js → expand_dims-BzfJK2uc.js} +3 -3
- package/dist/{exports_initializers-Hta_rEnm.js → exports_initializers-eS9QJ6ut.js} +1 -1
- package/dist/{floor-D5QdR_le.js → floor-DIb-lN_u.js} +1 -1
- package/dist/gather-BcO5UQNJ.js +9 -0
- package/dist/{gelu-CjNPL4OH.js → gelu-DqTbCx5x.js} +1 -1
- package/dist/{gpgpu_math-DAOmgtXR.js → gpgpu_math-CJcbnKPC.js} +2 -2
- package/dist/{index-DOvlwCh-.js → index-D0RBWjq8.js} +52 -52
- package/dist/{index-BwexR4lA.js → index-Dj5TkmPY.js} +89 -89
- package/dist/{kernel_funcs_utils-CCzYdUZg.js → kernel_funcs_utils-CSaumNDs.js} +11 -11
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +4 -4
- 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 +6 -6
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +17 -17
- package/dist/log_sum_exp-VLZgbFAH.js +39 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +9 -9
- package/dist/{matMul16-BWRSOCWB.js → matMul16-cDxwemKj.js} +7 -7
- package/dist/{matMulGelu-CzfgT6Wq.js → matMulGelu-B2s_80-H.js} +18 -18
- package/dist/{mat_mul-SjpJRLyL.js → mat_mul-DxpNTCRz.js} +3 -3
- package/dist/{mod-AnXEvvpo.js → mod-PrOKlFxH.js} +1 -1
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/model.js +9 -9
- package/dist/{ones-D2rT0xk2.js → ones-BX_wEgzB.js} +3 -3
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.js +1 -1
- package/dist/ops/add16.js +1 -1
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/concat16.js +2 -2
- package/dist/ops/cpu/adamAdjust.js +6 -6
- package/dist/ops/cpu/adamMoments.js +2 -2
- package/dist/ops/cpu/appendCache.js +5 -5
- package/dist/ops/cpu/attentionMask.js +10 -10
- package/dist/ops/cpu/fusedSoftmax.js +2 -2
- package/dist/ops/cpu/gatherSub.js +6 -6
- package/dist/ops/cpu/gelu.js +9 -9
- package/dist/ops/cpu/matMul16.js +2 -2
- package/dist/ops/cpu/matMulGelu.js +3 -3
- package/dist/ops/cpu/matMulMul.js +1 -1
- package/dist/ops/cpu/mulDropout.js +1 -1
- package/dist/ops/cpu/normRMS.js +3 -3
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +9 -9
- package/dist/ops/cpu/scatterSub.js +11 -11
- package/dist/ops/dot16.js +2 -2
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/add16.js +4 -4
- package/dist/ops/grads/attentionMask.js +2 -2
- package/dist/ops/grads/gelu.js +2 -2
- package/dist/ops/grads/matMul16.js +3 -3
- package/dist/ops/grads/matMulGelu.js +3 -3
- package/dist/ops/grads/normRMS.js +7 -7
- package/dist/ops/grads/pack16.js +3 -3
- package/dist/ops/grads/qkv.js +6 -6
- package/dist/ops/grads/rope.js +2 -2
- package/dist/ops/grads/softmax16.js +1 -1
- package/dist/ops/grads/unpack16.js +2 -2
- package/dist/ops/matMul16.js +3 -3
- package/dist/ops/matMulGelu.js +2 -2
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mul16.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/pack16.js +2 -2
- package/dist/ops/qkv.js +1 -1
- package/dist/ops/reshape16.js +6 -6
- package/dist/ops/rope.js +2 -2
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/slice16.js +2 -2
- package/dist/ops/softmax16.js +1 -1
- package/dist/ops/sub16.js +1 -1
- package/dist/ops/sum16.js +2 -2
- package/dist/ops/transpose16.js +3 -3
- package/dist/ops/unpack16.js +2 -2
- 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 +4 -4
- package/dist/ops/webgl/fusedSoftmax.js +6 -6
- 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/matMul16.js +11 -11
- package/dist/ops/webgl/matMulGelu.js +4 -4
- package/dist/ops/webgl/matMulMul.js +7 -7
- package/dist/ops/webgl/mulDropout.js +1 -1
- package/dist/ops/webgl/normRMS.js +7 -7
- package/dist/ops/webgl/qkv.js +1 -1
- package/dist/ops/webgl/rope.js +4 -4
- 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/add16.js +1 -1
- package/dist/ops/webgpu/appendCache.js +3 -3
- package/dist/ops/webgpu/attentionMask.js +5 -5
- package/dist/ops/webgpu/attentionMask32_program.js +2 -2
- package/dist/ops/webgpu/concat16.js +5 -5
- package/dist/ops/webgpu/gatherSub.js +5 -5
- package/dist/ops/webgpu/gelu.js +3 -3
- package/dist/ops/webgpu/matMul16.js +18 -18
- package/dist/ops/webgpu/matMul16_program.js +2 -2
- package/dist/ops/webgpu/mul16.js +4 -4
- package/dist/ops/webgpu/normRMS.js +6 -6
- package/dist/ops/webgpu/normRMSGrad.js +4 -4
- package/dist/ops/webgpu/pack16.js +1 -1
- package/dist/ops/webgpu/pack16_program.js +2 -2
- package/dist/ops/webgpu/qkv.js +6 -6
- package/dist/ops/webgpu/rope.js +3 -3
- package/dist/ops/webgpu/scatterSub.js +3 -3
- package/dist/ops/webgpu/slice16.js +4 -4
- package/dist/ops/webgpu/softmax16.js +2 -2
- package/dist/ops/webgpu/softmax16_program.js +2 -2
- package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
- package/dist/ops/webgpu/softmax16grad.js +1 -1
- package/dist/ops/webgpu/sub16.js +4 -4
- package/dist/ops/webgpu/sum16.js +6 -6
- package/dist/ops/webgpu/transpose16.js +2 -2
- package/dist/ops/webgpu/transpose16_program.js +2 -2
- package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
- package/dist/ops/webgpu/unpack16.js +3 -3
- package/dist/ops/webgpu/utils/binary_op.js +3 -3
- package/dist/ops/webgpu/utils/reductions.js +4 -4
- package/dist/{ops-B5yanEdW.js → ops-FJapAPfm.js} +56 -56
- package/dist/{pack16-nQ6JaLo-.js → pack16-k4jq6aMX.js} +7 -7
- package/dist/patches/webgpu_backend.js +7 -7
- package/dist/patches/webgpu_base.js +1 -1
- package/dist/patches/webgpu_program.js +8 -8
- package/dist/{random_width-or-CEftb.js → random_width-UGQn4OWb.js} +33 -33
- package/dist/range-CuGvVN2c.js +10 -0
- package/dist/{relu-CP0ZcxWO.js → relu-Cf80uA2p.js} +1 -1
- package/dist/{reshape-ByE68wS9.js → reshape-CkjKPPqB.js} +1 -1
- package/dist/{resize_nearest_neighbor-B19mCEg2.js → resize_nearest_neighbor-DB8k9KN_.js} +43 -43
- package/dist/{rope-Ir4mTyD1.js → rope-BmZmp9uP.js} +1 -1
- package/dist/{scatter_nd_util-lvSiX8q4.js → scatter_nd_util-BY22Cc-C.js} +1 -1
- package/dist/{selu_util-kbhpTdYD.js → selu_util-BuLbmbrl.js} +5 -5
- package/dist/{shared-DT1TkE6w.js → shared-B7USJZgw.js} +1 -1
- package/dist/{shared-dntlHIDQ.js → shared-BQboIImQ.js} +86 -86
- package/dist/{slice-BfEGSH82.js → slice-Aqy7KbJh.js} +3 -3
- package/dist/{slice_util-uTKwiEpW.js → slice_util-D8CQRenR.js} +7 -7
- package/dist/{softmax-CA5jFsLR.js → softmax-faLoUZVT.js} +1 -1
- package/dist/{split-CVLc0w--.js → split-BNz5jcGc.js} +3 -3
- package/dist/{squeeze-C7Z2srUo.js → squeeze--YMgaAAf.js} +2 -2
- package/dist/{stack-Cf4n9h0N.js → stack-WJK22CFn.js} +1 -1
- package/dist/{step-CINUs5QB.js → step-dXR33iOg.js} +32 -32
- package/dist/sum-BdplSvq_.js +11 -0
- package/dist/tensor-BQqrDvpx.js +8 -0
- package/dist/tensor1d-LxP9asMm.js +11 -0
- package/dist/{tensor2d-Bs9wZRc7.js → tensor2d-BN1sSfQO.js} +3 -3
- package/dist/{tensor4d-BARPdTaS.js → tensor4d-DVwr7pLF.js} +1 -1
- package/dist/{tfjs_backend-y1cvNhLA.js → tfjs_backend-Vi4JfLzT.js} +28 -28
- package/dist/{tile-mbfagpsB.js → tile-CvN_LyVr.js} +4 -4
- package/dist/tokeniser/BaseTokeniser.d.ts +27 -0
- package/dist/tokeniser/BaseTokeniser.js +94 -0
- package/dist/tokeniser/CharTokeniser.d.ts +4 -3
- package/dist/tokeniser/CharTokeniser.js +46 -32
- package/dist/tokeniser/bpe.d.ts +4 -3
- package/dist/tokeniser/bpe.js +60 -45
- package/dist/tokeniser/type.d.ts +11 -0
- package/dist/training/Adam.js +2 -2
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.d.ts +2 -2
- package/dist/training/DatasetBuilder.js +32 -36
- package/dist/training/FullTrainer.js +1 -1
- package/dist/training/Trainer.d.ts +3 -3
- package/dist/training/Trainer.js +2 -2
- package/dist/training/sparseCrossEntropy.js +3 -3
- package/dist/{transpose-ClWiBS_b.js → transpose-JawVKyZy.js} +5 -5
- package/dist/{unsorted_segment_sum-BDDhB_E6.js → unsorted_segment_sum-LAbmE9G4.js} +78 -78
- package/dist/utilities/dummy.js +3 -3
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/packed.js +1 -1
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/sentences.js +5 -5
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-WawDEaAb.js → variable-DQ9yYgEU.js} +1 -1
- package/dist/{webgpu_program-DuOXPQol.js → webgpu_program-CAE4RICo.js} +3 -3
- package/dist/{webgpu_util-RxEF33Rj.js → webgpu_util-BdovYhXr.js} +1 -1
- package/dist/{zeros-KnWaWf-X.js → zeros-DeiE2zTa.js} +2 -2
- package/dist/{zeros_like-DvE73F4e.js → zeros_like-BAz3iKru.js} +77 -77
- package/package.json +1 -1
- package/dist/complex-DjxcVmoX.js +0 -11
- package/dist/gather-D3JcZUaI.js +0 -9
- package/dist/log_sum_exp-ngO0-4pK.js +0 -39
- package/dist/range-BklejeeW.js +0 -10
- package/dist/sum-DWAtNGez.js +0 -11
- package/dist/tensor-DJoc7gJU.js +0 -8
- package/dist/tensor1d-D11P_7Dp.js +0 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { aG as T,
|
|
2
|
-
import { r as $ } from "./Reshape-
|
|
3
|
-
import { a as A, b as k, d as C, c as N, e as R } from "./axis_util-
|
|
4
|
-
import { t as
|
|
5
|
-
import { c as
|
|
6
|
-
import { f as y } from "./gpgpu_math-
|
|
7
|
-
import { g as
|
|
1
|
+
import { aG as T, ab as E, af as O, V, aS as B, Q as F, am as G, aT as K } from "./index-D0RBWjq8.js";
|
|
2
|
+
import { r as $ } from "./Reshape-Ct266DEk.js";
|
|
3
|
+
import { a as A, b as k, d as C, c as N, e as R } from "./axis_util-DofAuy0p.js";
|
|
4
|
+
import { t as U, m as W } from "./shared-B7USJZgw.js";
|
|
5
|
+
import { c as _ } from "./backend_util-C7NWHpv7.js";
|
|
6
|
+
import { f as y } from "./gpgpu_math-CJcbnKPC.js";
|
|
7
|
+
import { g as j, b as L } from "./kernel_funcs_utils-CSaumNDs.js";
|
|
8
8
|
class w {
|
|
9
9
|
constructor(s, e) {
|
|
10
10
|
this.variableNames = ["x"];
|
|
@@ -181,10 +181,10 @@ class X {
|
|
|
181
181
|
`;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function q(a) {
|
|
185
185
|
const s = [];
|
|
186
186
|
for (; s.length === 0 || s[s.length - 1].outSize !== 1; ) {
|
|
187
|
-
const e = s.length ? s[s.length - 1].outSize : a[1], t =
|
|
187
|
+
const e = s.length ? s[s.length - 1].outSize : a[1], t = _(e);
|
|
188
188
|
s.push({
|
|
189
189
|
inSize: e,
|
|
190
190
|
windowSize: t,
|
|
@@ -194,7 +194,7 @@ function Y(a) {
|
|
|
194
194
|
return s;
|
|
195
195
|
}
|
|
196
196
|
function P(a, s, e, t) {
|
|
197
|
-
const n =
|
|
197
|
+
const n = q(a.shape);
|
|
198
198
|
let l = a;
|
|
199
199
|
for (let r = 0; r < n.length; r++) {
|
|
200
200
|
const { inSize: i, windowSize: c, outSize: o } = n[r];
|
|
@@ -203,14 +203,14 @@ function P(a, s, e, t) {
|
|
|
203
203
|
}
|
|
204
204
|
return l;
|
|
205
205
|
}
|
|
206
|
-
class
|
|
206
|
+
class Q {
|
|
207
207
|
constructor(s, e) {
|
|
208
208
|
this.variableNames = ["A"];
|
|
209
209
|
const t = new Array(s.length);
|
|
210
210
|
for (let r = 0; r < t.length; r++)
|
|
211
211
|
t[r] = s[e[r]];
|
|
212
212
|
this.outputShape = t, this.rank = t.length;
|
|
213
|
-
const n = y(this.rank), l =
|
|
213
|
+
const n = y(this.rank), l = Y(e);
|
|
214
214
|
this.userCode = `
|
|
215
215
|
void main() {
|
|
216
216
|
${n} resRC = getOutputCoords();
|
|
@@ -219,7 +219,7 @@ class q {
|
|
|
219
219
|
`;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Y(a) {
|
|
223
223
|
const s = a.length;
|
|
224
224
|
if (s > 6)
|
|
225
225
|
throw Error(`Transpose for rank ${s} is not yet supported`);
|
|
@@ -228,7 +228,7 @@ function H(a) {
|
|
|
228
228
|
t[a[n]] = e[n];
|
|
229
229
|
return t.join();
|
|
230
230
|
}
|
|
231
|
-
class
|
|
231
|
+
class H {
|
|
232
232
|
constructor(s, e) {
|
|
233
233
|
this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0;
|
|
234
234
|
const t = new Array(s.length);
|
|
@@ -236,7 +236,7 @@ class J {
|
|
|
236
236
|
t[u] = s[e[u]];
|
|
237
237
|
if (this.outputShape = t, this.rank = t.length, this.rank > 6)
|
|
238
238
|
throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);
|
|
239
|
-
const n = y(this.rank), l =
|
|
239
|
+
const n = y(this.rank), l = j("rc", this.rank), r = new Array(this.rank);
|
|
240
240
|
for (let u = 0; u < e.length; u++)
|
|
241
241
|
r[e[u]] = l[u];
|
|
242
242
|
const i = `vec2(${r.slice(-2).join()})`, c = `++${l[this.rank - 1]} < ${t[this.rank - 1]}`, o = `getChannel(getA(${r.join()}), ${i})`;
|
|
@@ -261,10 +261,10 @@ class J {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
function D(a, s, e) {
|
|
264
|
-
const t = E().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new
|
|
264
|
+
const t = E().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new H(a.shape, s) : new Q(a.shape, s);
|
|
265
265
|
return e.runWebGLProgram(t, [a], a.dtype);
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function J(a, s, e, t) {
|
|
268
268
|
const n = s, l = a.shape.length, r = O(n, a.shape);
|
|
269
269
|
let i = r;
|
|
270
270
|
const c = A(i, l), o = c != null;
|
|
@@ -278,7 +278,7 @@ function Q(a, s, e, t) {
|
|
|
278
278
|
}
|
|
279
279
|
function Z(a) {
|
|
280
280
|
const { inputs: s, backend: e, attrs: t } = a, { x: n } = s, { axis: l, keepDims: r } = t;
|
|
281
|
-
return
|
|
281
|
+
return J(n, l, r, e);
|
|
282
282
|
}
|
|
283
283
|
const pe = {
|
|
284
284
|
kernelName: F,
|
|
@@ -299,7 +299,7 @@ function te(a) {
|
|
|
299
299
|
const I = e.texData.get(d.dataId).values, m = new Array(i);
|
|
300
300
|
for (let v = 0; v < m.length; v++)
|
|
301
301
|
m[v] = n.shape[u[v]];
|
|
302
|
-
const z =
|
|
302
|
+
const z = U(I, n.shape, n.dtype, u, m);
|
|
303
303
|
d = e.makeTensorInfo(m, n.dtype);
|
|
304
304
|
const M = e.texData.get(d.dataId);
|
|
305
305
|
M.values = z;
|
|
@@ -313,7 +313,7 @@ function te(a) {
|
|
|
313
313
|
r && (g = R(f, c));
|
|
314
314
|
let x;
|
|
315
315
|
if (h) {
|
|
316
|
-
const I = e.texData.get(d.dataId).values, m =
|
|
316
|
+
const I = e.texData.get(d.dataId).values, m = W(I, V(S), g, n.dtype);
|
|
317
317
|
x = e.makeTensorInfo(g, n.dtype);
|
|
318
318
|
const z = e.texData.get(x.dataId);
|
|
319
319
|
z.values = m;
|
|
@@ -322,7 +322,7 @@ function te(a) {
|
|
|
322
322
|
return p && e.disposeIntermediateTensorInfo(d), x;
|
|
323
323
|
}
|
|
324
324
|
const he = {
|
|
325
|
-
kernelName:
|
|
325
|
+
kernelName: G,
|
|
326
326
|
backendName: "webgl",
|
|
327
327
|
kernelFunc: te
|
|
328
328
|
};
|
|
@@ -349,7 +349,7 @@ return a / b;`, se = `
|
|
|
349
349
|
|
|
350
350
|
return result;
|
|
351
351
|
`, ne = L({ opSnippet: ae, packedOpSnippet: se, checkOutOfBounds: !0 }), fe = {
|
|
352
|
-
kernelName:
|
|
352
|
+
kernelName: K,
|
|
353
353
|
backendName: "webgl",
|
|
354
354
|
kernelFunc: ne
|
|
355
355
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, ah as d,
|
|
1
|
+
import { V as h, ah as d, y as c, R as m } from "./index-D0RBWjq8.js";
|
|
2
2
|
function i(n) {
|
|
3
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
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as C,
|
|
2
|
-
import { u as g, g as I, a as x, b as F, c as $, d as u, e as
|
|
1
|
+
import { R as C, V as c, ah as R, y as f } from "./index-D0RBWjq8.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-CJcbnKPC.js";
|
|
3
3
|
class S {
|
|
4
4
|
constructor(t, i) {
|
|
5
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);
|
|
@@ -47,33 +47,33 @@ function v(s, t) {
|
|
|
47
47
|
}
|
|
48
48
|
`;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function y(s, t, i) {
|
|
51
51
|
const a = [
|
|
52
52
|
u(s.shape),
|
|
53
|
-
...
|
|
53
|
+
...m(s.shape)
|
|
54
54
|
], e = {
|
|
55
55
|
dtype: s.dtype,
|
|
56
56
|
shape: a,
|
|
57
57
|
dataId: s.dataId
|
|
58
58
|
}, o = [
|
|
59
59
|
u(t),
|
|
60
|
-
...
|
|
60
|
+
...m(t)
|
|
61
61
|
], r = new S(o, a), p = !0, n = [a], h = i.runWebGLProgram(r, [e], s.dtype, n, p);
|
|
62
62
|
return { dataId: h.dataId, shape: t, dtype: h.dtype };
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function b(s) {
|
|
65
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
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
67
|
const d = r.texData.get(e.dataId);
|
|
68
|
-
return d.isPacked && !
|
|
68
|
+
return d.isPacked && !l(e.shape, n) && !(d.texture !== null && l(d.shape, n)) ? y(e, n, r) : (r.incRef(e.dataId), { dataId: e.dataId, shape: n, dtype: e.dtype });
|
|
69
69
|
}
|
|
70
70
|
const U = {
|
|
71
71
|
kernelName: C,
|
|
72
72
|
backendName: "webgl",
|
|
73
|
-
kernelFunc:
|
|
73
|
+
kernelFunc: b
|
|
74
74
|
};
|
|
75
75
|
export {
|
|
76
76
|
S as R,
|
|
77
77
|
U as a,
|
|
78
|
-
|
|
78
|
+
b as r
|
|
79
79
|
};
|
package/dist/TeachableLLM.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GPTConfig } from './models/config';
|
|
2
|
-
import { ITokeniser } from './tokeniser/type';
|
|
2
|
+
import { Conversation, ITokeniser } from './tokeniser/type';
|
|
3
3
|
import { SaveOptions } from './loader/save';
|
|
4
4
|
import { default as Generator, IGenerateOptions } from './Generator';
|
|
5
5
|
import { default as Trainer, ITrainerOptions } from './Trainer';
|
|
@@ -41,10 +41,11 @@ export default class TeachableLLM {
|
|
|
41
41
|
set enableProfiler(value: boolean);
|
|
42
42
|
getNumParams(): number;
|
|
43
43
|
trainer(): Trainer;
|
|
44
|
-
train(text:
|
|
44
|
+
train(text: Conversation[][], options?: ITrainerOptions): Promise<void>;
|
|
45
45
|
trainTokeniser(text: string[]): Promise<number>;
|
|
46
46
|
generator(): Generator;
|
|
47
|
-
generateText(prompt
|
|
47
|
+
generateText(prompt: Conversation[], options?: IGenerateOptions): Promise<Conversation[]>;
|
|
48
|
+
generateText(options?: IGenerateOptions): Promise<Conversation[]>;
|
|
48
49
|
dispose(): void;
|
|
49
50
|
on(event: 'status', listener: (status: TeachableLLMStatus) => void): void;
|
|
50
51
|
on(event: 'error', listener: (error: Error) => void): void;
|
package/dist/TeachableLLM.js
CHANGED
|
@@ -2,27 +2,27 @@ import { defaultConfig as d } from "./models/config.js";
|
|
|
2
2
|
import { saveModel as l } from "./loader/save.js";
|
|
3
3
|
import { loadModel as _ } from "./loader/load.js";
|
|
4
4
|
import u from "./Generator.js";
|
|
5
|
-
import
|
|
6
|
-
import { E as
|
|
5
|
+
import f from "./Trainer.js";
|
|
6
|
+
import { E as p } from "./index-DvYrXKkX.js";
|
|
7
7
|
import { dummyPassTrainAsync as m } from "./utilities/dummy.js";
|
|
8
|
-
import "./index-
|
|
9
|
-
import "./random_width-
|
|
10
|
-
import "./zeros_like-
|
|
8
|
+
import "./index-D0RBWjq8.js";
|
|
9
|
+
import "./random_width-UGQn4OWb.js";
|
|
10
|
+
import "./zeros_like-BAz3iKru.js";
|
|
11
11
|
import "./index-Cp39cXWe.js";
|
|
12
|
-
import "./dataset-
|
|
12
|
+
import "./dataset-DcjWqUVQ.js";
|
|
13
13
|
import "./ops/cpu/attentionMask.js";
|
|
14
14
|
import "./ops/webgl/attentionMask.js";
|
|
15
15
|
import "./ops/grads/attentionMask.js";
|
|
16
16
|
import "./ops/cpu/rope.js";
|
|
17
17
|
import "./ops/webgl/rope.js";
|
|
18
|
-
import "./rope-
|
|
18
|
+
import "./rope-BmZmp9uP.js";
|
|
19
19
|
import "./ops/cpu/appendCache.js";
|
|
20
20
|
import "./ops/webgl/appendCache.js";
|
|
21
21
|
import "./ops/grads/softmax16.js";
|
|
22
|
-
import "./matMul16-
|
|
22
|
+
import "./matMul16-cDxwemKj.js";
|
|
23
23
|
import "./ops/webgl/matMul16.js";
|
|
24
24
|
import "./ops/cpu/matMul16.js";
|
|
25
|
-
import "./pack16-
|
|
25
|
+
import "./pack16-k4jq6aMX.js";
|
|
26
26
|
import "./ops/transpose16.js";
|
|
27
27
|
import "./ops/reshape16.js";
|
|
28
28
|
import "./ops/cpu/qkv.js";
|
|
@@ -41,11 +41,11 @@ import g from "./tokeniser/bpe.js";
|
|
|
41
41
|
import "./papaparse.min-C0cScC2i.js";
|
|
42
42
|
import "./jszip.min-Bz5-11Bk.js";
|
|
43
43
|
import "./ops/cpu/matMulGelu.js";
|
|
44
|
-
import "./matMulGelu-
|
|
44
|
+
import "./matMulGelu-B2s_80-H.js";
|
|
45
45
|
import "./ops/grads/matMulGelu.js";
|
|
46
46
|
import "./ops/cpu/gelu.js";
|
|
47
47
|
import "./ops/webgl/gelu.js";
|
|
48
|
-
import "./gelu-
|
|
48
|
+
import "./gelu-DqTbCx5x.js";
|
|
49
49
|
import "./ops/webgl/log.js";
|
|
50
50
|
import "./ops/cpu/adamMoments.js";
|
|
51
51
|
import "./ops/webgl/adamMoments.js";
|
|
@@ -56,7 +56,7 @@ import "./checks/normRMSGrad.js";
|
|
|
56
56
|
import k from "./utilities/profile.js";
|
|
57
57
|
import w from "./models/factory.js";
|
|
58
58
|
class a {
|
|
59
|
-
ee = new
|
|
59
|
+
ee = new p();
|
|
60
60
|
_config;
|
|
61
61
|
_model;
|
|
62
62
|
_tokeniser;
|
|
@@ -155,7 +155,7 @@ class a {
|
|
|
155
155
|
trainer() {
|
|
156
156
|
if (!this._model || !this._tokeniser)
|
|
157
157
|
throw new Error("model_or_tokeniser_not_initialized.");
|
|
158
|
-
const t = new
|
|
158
|
+
const t = new f(this._model, this._tokeniser);
|
|
159
159
|
return t.on("start", () => this.setStatus("training")), t.on("stop", () => this.setStatus("ready")), t.on("log", async (e, r) => {
|
|
160
160
|
const o = this.ee.listeners("trainStep");
|
|
161
161
|
for (const s of o)
|
|
@@ -183,7 +183,7 @@ class a {
|
|
|
183
183
|
}), t;
|
|
184
184
|
}
|
|
185
185
|
generateText(t, e) {
|
|
186
|
-
return this.generator().generate(t, e);
|
|
186
|
+
return Array.isArray(t) ? this.generator().generate(t, e) : this.generator().generate([], e);
|
|
187
187
|
}
|
|
188
188
|
dispose() {
|
|
189
189
|
this._model?.dispose();
|
package/dist/Trainer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITokeniser } from './tokeniser/type';
|
|
1
|
+
import { Conversation, ITokeniser } from './tokeniser/type';
|
|
2
2
|
import { default as EE } from 'eventemitter3';
|
|
3
3
|
import { TrainingLogEntry, TrainingProgress } from './training/Trainer';
|
|
4
4
|
import { default as Model, ModelForwardAttributes } from './models/model';
|
|
@@ -30,7 +30,7 @@ export default class Trainer extends EE<'start' | 'stop' | 'log'> {
|
|
|
30
30
|
constructor(model: Model<ModelForwardAttributes>, tokeniser: ITokeniser);
|
|
31
31
|
stop(): void;
|
|
32
32
|
reset(): void;
|
|
33
|
-
prepare(text:
|
|
33
|
+
prepare(text: Conversation[][], options?: ITrainerOptions): Promise<void>;
|
|
34
34
|
train(options?: ITrainerOptions): Promise<void>;
|
|
35
35
|
step(options?: ITrainerOptions): Promise<void>;
|
|
36
36
|
getLog(): TrainingLogEntry[];
|
package/dist/Trainer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import
|
|
3
|
-
class
|
|
1
|
+
import { E as o } from "./index-DvYrXKkX.js";
|
|
2
|
+
import d from "./training/FullTrainer.js";
|
|
3
|
+
class g extends o {
|
|
4
4
|
trainer;
|
|
5
5
|
hasTrained = !1;
|
|
6
6
|
trainDataset;
|
|
@@ -9,7 +9,7 @@ class m extends l {
|
|
|
9
9
|
log = [];
|
|
10
10
|
progress = null;
|
|
11
11
|
constructor(t, e) {
|
|
12
|
-
super(), this.trainer = new
|
|
12
|
+
super(), this.trainer = new d(t, e, 1e-3);
|
|
13
13
|
}
|
|
14
14
|
stop() {
|
|
15
15
|
this.trainer.stop();
|
|
@@ -22,7 +22,7 @@ class m extends l {
|
|
|
22
22
|
t,
|
|
23
23
|
e?.batchSize || 32,
|
|
24
24
|
e?.validationSplit || 0.1
|
|
25
|
-
), i = t.reduce((r, n) => r + n.length, 0) * (1 - (e?.validationSplit || 0));
|
|
25
|
+
), i = t.reduce((r, n) => r + n.reduce((l, h) => l + h.content.length, 0), 0) * (1 - (e?.validationSplit || 0));
|
|
26
26
|
this.trainDataset = a, this.validationDataset = s, this.totalSamples = i;
|
|
27
27
|
}
|
|
28
28
|
async train(t) {
|
|
@@ -91,5 +91,5 @@ class m extends l {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
94
|
-
|
|
94
|
+
g as default
|
|
95
95
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as c } from "./index-D0RBWjq8.js";
|
|
2
2
|
function i(e, n) {
|
|
3
3
|
for (let t = 0; t < e.length; ++t)
|
|
4
4
|
if (e[e.length - t - 1] !== n - 1 - t)
|
|
@@ -12,7 +12,7 @@ function a(e, n, t) {
|
|
|
12
12
|
t.indexOf(u) === -1 ? s.push(e[o++]) : s.push(n[f++]);
|
|
13
13
|
return s;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function l(e, n) {
|
|
16
16
|
const t = [], r = e.length;
|
|
17
17
|
for (let o = 0; o < r; o++)
|
|
18
18
|
n.indexOf(o) === -1 && t.push(e[o]);
|
|
@@ -46,7 +46,7 @@ function x(e, n) {
|
|
|
46
46
|
export {
|
|
47
47
|
d as a,
|
|
48
48
|
x as b,
|
|
49
|
-
|
|
49
|
+
l as c,
|
|
50
50
|
m as d,
|
|
51
51
|
h as e,
|
|
52
52
|
i as f,
|
package/dist/backend.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { g as o, s as e, r as s } from "./index-
|
|
1
|
+
import { g as o, s as e, r as s } from "./index-D0RBWjq8.js";
|
|
2
2
|
async function c(t, a) {
|
|
3
3
|
if (o() !== t) {
|
|
4
4
|
if (t === "webgpu") {
|
|
5
5
|
const { registerWebGPUBackend: i } = await import("./patches/webgpu_base.js");
|
|
6
|
-
i(a), await import("./index-
|
|
6
|
+
i(a), await import("./index-Dj5TkmPY.js"), await import("./ops/webgpu/index.js");
|
|
7
7
|
}
|
|
8
8
|
await e(t), await s(), console.log(`Backend set to ${t}`);
|
|
9
9
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as L, f as W, h as v, c as F, e as N, a as C, b as P, g as z } from "./axis_util-
|
|
3
|
-
import { a as B, c as U } from "./concat_util-
|
|
4
|
-
import { c as V, b as G, d as H, f as j, g as q, h as Z, i as k, j as J, k as K, m as X, t as Y } from "./step-
|
|
5
|
-
import { S as Q, a as ee, b as te, g as se, c as ne, s as re } from "./selu_util-
|
|
6
|
-
import { s as oe } from "./slice_util-
|
|
7
|
-
import { c as ae, v as ie, a as ue } from "./scatter_nd_util-
|
|
1
|
+
import { V as m, a9 as w, aU as I, y as d, ax as A, aB as _, $ as y, ad as M, a0 as T, aV as b, ak as D, aW as x } from "./index-D0RBWjq8.js";
|
|
2
|
+
import { d as L, f as W, h as v, c as F, e as N, a as C, b as P, g as z } from "./axis_util-DofAuy0p.js";
|
|
3
|
+
import { a as B, c as U } from "./concat_util-CHsJFZJJ.js";
|
|
4
|
+
import { c as V, b as G, d as H, f as j, g as q, h as Z, i as k, j as J, k as K, m as X, t as Y } from "./step-dXR33iOg.js";
|
|
5
|
+
import { S as Q, a as ee, b as te, g as se, c as ne, s as re } from "./selu_util-BuLbmbrl.js";
|
|
6
|
+
import { s as oe } from "./slice_util-D8CQRenR.js";
|
|
7
|
+
import { c as ae, v as ie, a as ue } from "./scatter_nd_util-BY22Cc-C.js";
|
|
8
8
|
import { a as le, c as pe, b as ce, e as he, d as fe, g as ge, m as de, s as me } from "./complex_util-Yc1A_gV1.js";
|
|
9
9
|
function Ee(e, t) {
|
|
10
10
|
const r = e.shape.length, s = t.shape.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as te, f as se, P as re } from "./webgpu_program-
|
|
3
|
-
import { i as ne, G as q } from "./webgpu_util-
|
|
1
|
+
import { ab as g, au as $, av as K, e as D, y as _, aw as O, V as x, ax as Z, at as W, ay as F, az as j, aA as X, aB as J, ae as ee, a9 as k } from "./index-D0RBWjq8.js";
|
|
2
|
+
import { m as te, f as se, P as re } from "./webgpu_program-CAE4RICo.js";
|
|
3
|
+
import { i as ne, G as q } from "./webgpu_util-BdovYhXr.js";
|
|
4
4
|
import { m as N } from "./complex_util-Yc1A_gV1.js";
|
|
5
5
|
const d = g();
|
|
6
6
|
d.registerFlag("WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE", () => 15);
|
|
@@ -264,7 +264,7 @@ class R extends $ {
|
|
|
264
264
|
alphaMode: r[B]
|
|
265
265
|
}), y.getCurrentTexture();
|
|
266
266
|
}).map((E, B) => {
|
|
267
|
-
const y = f * 4,
|
|
267
|
+
const y = f * 4, G = (P, S, v) => {
|
|
268
268
|
this.ensureCommandEncoderReady(), this.commandEncoder.copyBufferToTexture({
|
|
269
269
|
buffer: a,
|
|
270
270
|
bytesPerRow: y,
|
|
@@ -279,20 +279,20 @@ class R extends $ {
|
|
|
279
279
|
willReadFrequently: !0
|
|
280
280
|
});
|
|
281
281
|
I.clearRect(0, 0, P, S), I.drawImage(h[B], 0, 0);
|
|
282
|
-
const
|
|
282
|
+
const b = I.getImageData(0, 0, P, S).data, H = r[B], M = new Uint8ClampedArray(o, v, P * S * 4);
|
|
283
283
|
for (let p = 0; p < M.length; p += 4)
|
|
284
284
|
if (H === "premultiplied")
|
|
285
|
-
M[p + 3] =
|
|
285
|
+
M[p + 3] = b[p + 3];
|
|
286
286
|
else {
|
|
287
|
-
const V =
|
|
288
|
-
M[p] =
|
|
287
|
+
const V = b[p];
|
|
288
|
+
M[p] = b[p + 2], M[p + 1] = b[p + 1], M[p + 2] = V;
|
|
289
289
|
}
|
|
290
290
|
}, Y = Math.floor(u / (f * c));
|
|
291
291
|
let T = f, U = c, C = 0;
|
|
292
292
|
for (let P = 0; P < Y; P++)
|
|
293
|
-
|
|
293
|
+
G(T, U, C), C += f * c * 4;
|
|
294
294
|
const A = u % (f * c);
|
|
295
|
-
U = Math.floor(A / f), U > 0 && (
|
|
295
|
+
U = Math.floor(A / f), U > 0 && (G(T, U, C), C += U * (f * 4)), T = A % f, T > 0 && G(T, 1, C);
|
|
296
296
|
});
|
|
297
297
|
const w = O(o, t.dtype);
|
|
298
298
|
return this.convertAndCacheOnCPU(e, w), w;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as b } from "./reshape-
|
|
1
|
+
import { q as h, u as f, w as p, x as g, E as u, T } from "./index-D0RBWjq8.js";
|
|
2
|
+
import { r as b } from "./reshape-CkjKPPqB.js";
|
|
3
3
|
function m(e, r) {
|
|
4
4
|
let n = f(e, "broadcastTo", "x");
|
|
5
5
|
const a = n.shape;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as i, e } from "../index-
|
|
2
|
-
import { t } from "../tensor4d-
|
|
3
|
-
import { t as a } from "../tensor2d-
|
|
1
|
+
import { s as i, e } from "../index-D0RBWjq8.js";
|
|
2
|
+
import { t } from "../tensor4d-DVwr7pLF.js";
|
|
3
|
+
import { t as a } from "../tensor2d-BN1sSfQO.js";
|
|
4
4
|
async function k(n) {
|
|
5
5
|
await i(n);
|
|
6
6
|
const s = t(
|
package/dist/checks/gelu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as e, e as o } from "../index-
|
|
2
|
-
import { t as s } from "../tensor2d-
|
|
1
|
+
import { s as e, e as o } from "../index-D0RBWjq8.js";
|
|
2
|
+
import { t as s } from "../tensor2d-BN1sSfQO.js";
|
|
3
3
|
async function m(t) {
|
|
4
4
|
await e(t);
|
|
5
5
|
const r = s(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as o, e as s } from "../index-
|
|
2
|
-
import { t as e } from "../tensor2d-
|
|
1
|
+
import { s as o, e as s } from "../index-D0RBWjq8.js";
|
|
2
|
+
import { t as e } from "../tensor2d-BN1sSfQO.js";
|
|
3
3
|
async function i(t) {
|
|
4
4
|
await o(t);
|
|
5
5
|
const r = e(
|
package/dist/checks/normRMS.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as u,
|
|
2
|
-
import { a as h } from "../ops-
|
|
3
|
-
import { t as p } from "../tensor1d-
|
|
4
|
-
import { t as r } from "../tensor-
|
|
1
|
+
import { s as u, a1 as A, e as y } from "../index-D0RBWjq8.js";
|
|
2
|
+
import { a as h } from "../ops-FJapAPfm.js";
|
|
3
|
+
import { t as p } from "../tensor1d-LxP9asMm.js";
|
|
4
|
+
import { t as r } from "../tensor-BQqrDvpx.js";
|
|
5
5
|
const w = Array.from({ length: 2048 * 192 }, () => Math.random()), x = Array.from({ length: 192 }, () => Math.random()), M = Array.from({ length: 2048 * 192 }, () => Math.random());
|
|
6
6
|
async function k(t) {
|
|
7
7
|
await u(t);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as c, e as d } from "../index-
|
|
2
|
-
import { t as f } from "../tensor1d-
|
|
3
|
-
import { t as r } from "../tensor-
|
|
1
|
+
import { s as c, e as d } from "../index-D0RBWjq8.js";
|
|
2
|
+
import { t as f } from "../tensor1d-LxP9asMm.js";
|
|
3
|
+
import { t as r } from "../tensor-BQqrDvpx.js";
|
|
4
4
|
const y = Array.from({ length: 2048 * 192 }, () => Math.random()), i = Array.from({ length: 192 }, () => Math.random()), l = Array.from({ length: 2048 * 192 }, () => Math.random());
|
|
5
5
|
async function x(t) {
|
|
6
6
|
await c(t);
|
package/dist/checks/qkv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as f } from "../tensor2d-
|
|
1
|
+
import { X as i, Y as u, Z as c, s as l, e as h } from "../index-D0RBWjq8.js";
|
|
2
|
+
import { t as f } from "../tensor2d-BN1sSfQO.js";
|
|
3
3
|
function m(t, e, n) {
|
|
4
4
|
if (i(t), e != null && e.length !== 3)
|
|
5
5
|
throw new Error("tensor3d() requires shape to have three numbers");
|
|
@@ -26,8 +26,8 @@ async function y(t) {
|
|
|
26
26
|
[0.7, 0.8, 1.1, 1.2, 1.5, 1.6]
|
|
27
27
|
],
|
|
28
28
|
[2, 6]
|
|
29
|
-
), r = h().runKernel("QKV", { x: e, kernel: n }, { heads: 1 }),
|
|
30
|
-
return [
|
|
29
|
+
), r = h().runKernel("QKV", { x: e, kernel: n }, { heads: 1 }), o = await r[0].array(), a = await r[1].array(), s = await r[2].array();
|
|
30
|
+
return [o, a, s];
|
|
31
31
|
}
|
|
32
32
|
export {
|
|
33
33
|
y as execute
|
package/dist/checks/rope.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import t from "../layers/RoPECache.js";
|
|
2
|
-
import { s as c, e as i } from "../index-
|
|
3
|
-
import { t as p } from "../tensor4d-
|
|
2
|
+
import { s as c, e as i } from "../index-D0RBWjq8.js";
|
|
3
|
+
import { t as p } from "../tensor4d-DVwr7pLF.js";
|
|
4
4
|
async function y(a) {
|
|
5
5
|
await c(a);
|
|
6
6
|
const o = p(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as a, u as y, y as m, i as u, E as c, C as f } from "./index-D0RBWjq8.js";
|
|
2
2
|
function p(o, s, t) {
|
|
3
|
-
const r =
|
|
4
|
-
if (
|
|
5
|
-
return
|
|
3
|
+
const r = y(o, "x", "clipByValue");
|
|
4
|
+
if (m(s <= t, () => `Error in clip: min (${s}) must be less than or equal to max (${t}).`), s === t)
|
|
5
|
+
return u(r.shape, s, r.dtype);
|
|
6
6
|
const n = { x: r }, e = { clipValueMin: s, clipValueMax: t };
|
|
7
7
|
return c.runKernel(f, n, e);
|
|
8
8
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { q as c, u as s, a7 as n, E as m, a8 as r } from "./index-D0RBWjq8.js";
|
|
2
|
+
function l(o, p) {
|
|
3
|
+
const a = s(o, "real", "complex"), e = s(p, "imag", "complex");
|
|
4
|
+
n(a.shape, e.shape, `real and imag shapes, ${a.shape} and ${e.shape}, must match in call to tf.complex().`);
|
|
5
|
+
const t = { real: a, imag: e };
|
|
6
|
+
return m.runKernel(r, t);
|
|
7
|
+
}
|
|
8
|
+
const i = /* @__PURE__ */ c({ complex_: l });
|
|
9
|
+
export {
|
|
10
|
+
i as c
|
|
11
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as s, y as a, z as p, x as i, E as l, A as f } from "./index-D0RBWjq8.js";
|
|
2
2
|
function h(n, e = 0) {
|
|
3
3
|
a(n.length >= 1, () => "Pass at least one tensor to concat");
|
|
4
4
|
const t = p(n, "tensors", "concat", "string_or_numeric");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { aC as S,
|
|
1
|
+
import { aC as S, a4 as h, ab as N, d as v, aD as o, aE as p, aF as g, y as k, t as y } from "./index-D0RBWjq8.js";
|
|
2
2
|
import { s as R } from "./index-CieiGp4Y.js";
|
|
3
|
-
import { s as $ } from "./stack-
|
|
4
|
-
import { t as B } from "./tensor-
|
|
3
|
+
import { s as $ } from "./stack-WJK22CFn.js";
|
|
4
|
+
import { t as B } from "./tensor-BQqrDvpx.js";
|
|
5
5
|
function _(s, t) {
|
|
6
6
|
return b(s, t);
|
|
7
7
|
}
|
|
@@ -296,7 +296,7 @@ class i {
|
|
|
296
296
|
* throw an `Error`.
|
|
297
297
|
*/
|
|
298
298
|
handleErrors(t) {
|
|
299
|
-
return new
|
|
299
|
+
return new Z(this, t);
|
|
300
300
|
}
|
|
301
301
|
// TODO(soergel): Implement reduce() etc.
|
|
302
302
|
/**
|
|
@@ -623,7 +623,7 @@ class K extends i {
|
|
|
623
623
|
return { value: r, done: !1 };
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
class
|
|
626
|
+
class Z extends i {
|
|
627
627
|
constructor(t, e) {
|
|
628
628
|
super(), this.upstream = t, this.handler = e, this.count = 0, this.lastRead = Promise.resolve({ value: null, done: !1 });
|
|
629
629
|
}
|
|
@@ -660,7 +660,7 @@ class w extends i {
|
|
|
660
660
|
return { value: r, done: !1 };
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
|
-
class
|
|
663
|
+
class j extends i {
|
|
664
664
|
constructor() {
|
|
665
665
|
super(), this.outputQueue = new f(), this.lastRead = Promise.resolve({ value: null, done: !1 });
|
|
666
666
|
}
|
|
@@ -674,7 +674,7 @@ class Z extends i {
|
|
|
674
674
|
return { value: this.outputQueue.shift(), done: !1 };
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
|
-
class tt extends
|
|
677
|
+
class tt extends j {
|
|
678
678
|
constructor(t, e) {
|
|
679
679
|
super(), this.upstream = t, this.transform = e;
|
|
680
680
|
}
|