@genai-fi/nanogpt 0.17.4 → 0.18.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 +2 -15
- package/dist/Generator.js +45 -34
- package/dist/{RealDiv-CGwv0liw.js → RealDiv-ioj6Z-ox.js} +9 -9
- package/dist/{Reshape-BW__R4mZ.js → Reshape-BZC-ebeR.js} +7 -7
- package/dist/{Reshape-CPBkTIH2.js → Reshape-pwprEaej.js} +1 -1
- package/dist/TeachableLLM.d.ts +3 -8
- package/dist/TeachableLLM.js +61 -44
- package/dist/Trainer.d.ts +6 -4
- package/dist/Trainer.js +107 -92
- package/dist/{axis_util-GTVlo58H.js → axis_util-QWWgLjut.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-GaFarB78.js → backend_util-qwSFfxYx.js} +21 -21
- package/dist/{backend_webgpu-BqASlsbV.js → backend_webgpu-DI2wXEC2.js} +8 -8
- package/dist/{broadcast_to-eS93CCN_.js → broadcast_to-C_EJTVTZ.js} +2 -2
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +5 -5
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/matMulGelu.js +2 -2
- package/dist/checks/normRMS.js +6 -6
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.js +6 -6
- package/dist/checks/qkv.js +2 -2
- package/dist/checks/rope.js +2 -2
- package/dist/{clip_by_value-DDA7rrcT.js → clip_by_value-CLAD4h_I.js} +1 -1
- package/dist/complex-3DpPEG9B.js +11 -0
- package/dist/{concat-CAQpCret.js → concat-Dqk7Xk7h.js} +5 -5
- package/dist/{concat_util-D18dJ4fD.js → concat_util-C1Mxe27t.js} +1 -1
- package/dist/{dataset-CGGp1z9P.js → dataset-DlqAN81i.js} +3 -3
- package/dist/{dropout_util--NxWuYg2.js → dropout_util-N0z8Os-K.js} +1 -1
- package/dist/{expand_dims-Bkd1YD5x.js → expand_dims-D0rBtgT1.js} +4 -4
- package/dist/{exports_initializers-CYzKLjN7.js → exports_initializers-DIOZQt_L.js} +1 -1
- package/dist/{floor-BQtb-Azg.js → floor-CymuCmTO.js} +1 -1
- package/dist/{gather-qIqEqaGn.js → gather-DEyjXNb1.js} +1 -1
- package/dist/{gelu-B220X1Go.js → gelu-DpTCC3eB.js} +1 -1
- package/dist/{gpgpu_math-BwvV12df.js → gpgpu_math-3bCb5ooU.js} +25 -25
- package/dist/{index-CjOWnMXP.js → index-BQvB7LCC.js} +15 -15
- package/dist/{index-CUXkjxiT.js → index-DSGwv2Yx.js} +33 -33
- package/dist/inference/types.d.ts +16 -0
- package/dist/inference/types.js +1 -0
- package/dist/{kernel_funcs_utils-pq0CK9co.js → kernel_funcs_utils-DGqzNlHT.js} +6 -6
- package/dist/layers/BaseLayer.js +4 -4
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/LoRA.js +4 -4
- 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/layers/WeightStore.js +2 -2
- package/dist/loader/load.d.ts +2 -8
- package/dist/loader/loadTransformers.d.ts +2 -8
- package/dist/loader/loadTransformers.js +13 -11
- package/dist/loader/newZipLoad.d.ts +2 -8
- package/dist/loader/newZipLoad.js +25 -10
- package/dist/loader/oldZipLoad.js +13 -13
- package/dist/loader/save.d.ts +9 -2
- package/dist/loader/save.js +64 -55
- package/dist/loader/types.d.ts +29 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +45 -43
- package/dist/{matMul16-BcVC_E62.js → matMul16-BIT70Vya.js} +3 -3
- package/dist/{matMulGelu-JNLZqKQp.js → matMulGelu-CsZnh18H.js} +18 -18
- package/dist/mat_mul-DP86qZtZ.js +11 -0
- package/dist/mod-BXjLYwvM.js +11 -0
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/NanoGPTV2.js +2 -2
- package/dist/models/model.d.ts +3 -2
- package/dist/models/model.js +13 -13
- package/dist/{not_equal-hurPF26l.js → not_equal-CkQKkKZy.js} +15 -15
- package/dist/{ones-BytntneX.js → ones-DbVB5N58.js} +3 -3
- package/dist/ops/adamAdjust.js +3 -3
- package/dist/ops/adamMoments.js +3 -3
- package/dist/ops/add16.js +1 -1
- package/dist/ops/appendCache.js +6 -6
- package/dist/ops/attentionMask.js +3 -3
- package/dist/ops/concat16.js +3 -3
- package/dist/ops/cpu/adamAdjust.js +9 -9
- package/dist/ops/cpu/adamMoments.js +5 -5
- package/dist/ops/cpu/appendCache.js +2 -2
- package/dist/ops/cpu/attentionMask.js +6 -6
- package/dist/ops/cpu/fusedSoftmax.js +4 -4
- package/dist/ops/cpu/gatherSub.js +5 -5
- package/dist/ops/cpu/gelu.js +4 -4
- package/dist/ops/cpu/matMul16.js +2 -2
- package/dist/ops/cpu/matMulGelu.js +7 -7
- package/dist/ops/cpu/matMulMul.js +2 -2
- package/dist/ops/cpu/mulDropout.js +5 -5
- 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 +5 -5
- package/dist/ops/dot16.js +2 -2
- package/dist/ops/dropout.js +6 -6
- package/dist/ops/dropout16.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/globalNorm.js +7 -7
- package/dist/ops/grads/add16.js +1 -1
- package/dist/ops/grads/attentionMask.js +2 -2
- package/dist/ops/grads/dropout16.js +1 -1
- package/dist/ops/grads/gelu.js +2 -2
- package/dist/ops/grads/matMul16.js +3 -3
- package/dist/ops/grads/matMulGelu.js +1 -1
- package/dist/ops/grads/mul16.js +1 -1
- package/dist/ops/grads/normRMS.js +7 -7
- package/dist/ops/grads/pack16.js +3 -3
- package/dist/ops/grads/qkv.js +11 -11
- 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 +6 -6
- package/dist/ops/matMulMul.js +3 -3
- package/dist/ops/mul16.js +1 -1
- package/dist/ops/mulDrop.js +3 -3
- package/dist/ops/normRMS.js +4 -4
- package/dist/ops/pack16.js +2 -2
- package/dist/ops/qkv.js +3 -3
- 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 +6 -6
- 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 +1 -1
- package/dist/ops/webgl/dropout16.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +7 -7
- package/dist/ops/webgl/gatherSub.js +3 -3
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +3 -3
- package/dist/ops/webgl/matMul16.js +13 -13
- package/dist/ops/webgl/matMulGelu.js +4 -4
- package/dist/ops/webgl/matMulMul.js +2 -2
- 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 +2 -2
- package/dist/ops/webgpu/adamAdjust.js +3 -3
- package/dist/ops/webgpu/adamMoments.js +3 -3
- package/dist/ops/webgpu/add16.js +6 -6
- package/dist/ops/webgpu/appendCache.js +3 -3
- package/dist/ops/webgpu/attentionMask.js +2 -2
- package/dist/ops/webgpu/attentionMask32_program.js +2 -2
- package/dist/ops/webgpu/clipScale.js +7 -7
- package/dist/ops/webgpu/concat16.js +5 -5
- package/dist/ops/webgpu/dropout16.js +6 -6
- package/dist/ops/webgpu/gatherSub.js +3 -3
- package/dist/ops/webgpu/gelu.js +8 -8
- package/dist/ops/webgpu/matMul16.js +16 -16
- package/dist/ops/webgpu/matMul16_program.js +2 -2
- package/dist/ops/webgpu/mul16.js +5 -5
- package/dist/ops/webgpu/norm2.js +1 -1
- package/dist/ops/webgpu/normRMS.js +2 -2
- package/dist/ops/webgpu/normRMSGrad.js +4 -4
- package/dist/ops/webgpu/pack16.js +4 -4
- package/dist/ops/webgpu/pack16_program.js +2 -2
- package/dist/ops/webgpu/qkv.js +2 -2
- 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 +4 -4
- 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 +4 -4
- package/dist/ops/webgpu/sub16.js +6 -6
- package/dist/ops/webgpu/sum16.js +3 -3
- package/dist/ops/webgpu/transpose16.js +8 -8
- 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 +5 -5
- package/dist/{ops-CsXeTq1P.js → ops-CURIZSVt.js} +100 -100
- package/dist/{pack16-bqltoUlR.js → pack16-WlOSOuZA.js} +2 -2
- package/dist/patches/webgpu_backend.js +6 -6
- package/dist/patches/webgpu_base.js +1 -1
- package/dist/patches/webgpu_program.js +2 -2
- package/dist/{random_normal-IBRrha8a.js → random_normal-CIm8lk2-.js} +1 -1
- package/dist/{random_width-DN5ZtQkM.js → random_width-B_fVXhGx.js} +131 -131
- package/dist/{range-C-CjF-LI.js → range-BDxO73mk.js} +1 -1
- package/dist/{readers-iz5u3HBo.js → readers-17HLdxVM.js} +2 -2
- package/dist/relu-DTvZKBsZ.js +9 -0
- package/dist/{reshape-BDOuCSNW.js → reshape-BIN71H3p.js} +1 -1
- package/dist/{resize_nearest_neighbor-BojqlfRe.js → resize_nearest_neighbor-C6_0dAnK.js} +41 -41
- package/dist/{rope-0j_f1TPm.js → rope-CC5RjmKU.js} +4 -4
- package/dist/{scatter_nd_util-ByNJaL6I.js → scatter_nd_util-C-x73Cj6.js} +1 -1
- package/dist/{segment_util-Dasb2Zaf.js → segment_util-4zuHV5IG.js} +2 -2
- package/dist/{selu_util-BLhIqRkw.js → selu_util-BXdhy_W6.js} +5 -5
- package/dist/{shared-CagdqkLh.js → shared-DRWDyk9w.js} +6 -6
- package/dist/{shared-3agzAqQ_.js → shared-zTaJ5siv.js} +1 -1
- package/dist/slice-BvItlgXu.js +12 -0
- package/dist/{slice_util-CC35pLmT.js → slice_util-DPY56GzQ.js} +5 -5
- package/dist/{softmax-D4q1LJN7.js → softmax-BLGJqdwx.js} +1 -1
- package/dist/split-BN9LkEgS.js +9 -0
- package/dist/{squeeze-ho4wLUek.js → squeeze-O_YWJpw_.js} +2 -2
- package/dist/{stack-DudVrtmG.js → stack-z6QE7kmP.js} +1 -1
- package/dist/{step-BTxPtq1r.js → step-DQY6_ABw.js} +4 -4
- package/dist/{sum-BpiwSWvg.js → sum-D39FeU5h.js} +3 -3
- package/dist/{tensor-BWFldCso.js → tensor-D8e0Gd7c.js} +1 -1
- package/dist/{tensor1d-LMGMIUlr.js → tensor1d-BMl0eZYV.js} +1 -1
- package/dist/{tensor2d-BnXMKScO.js → tensor2d-DTtQ1QcT.js} +1 -1
- package/dist/{tensor4d-C6UCG_u8.js → tensor4d-Dj4rDssL.js} +1 -1
- package/dist/{tfjs_backend-BGnG-ppu.js → tfjs_backend-Bk3PmK91.js} +65 -65
- package/dist/{tile-CFy-xTO6.js → tile-CsWlVKKz.js} +1 -1
- package/dist/tokeniser/BaseTokeniser.d.ts +4 -1
- package/dist/tokeniser/BaseTokeniser.js +21 -5
- package/dist/tokeniser/CharTokeniser.d.ts +1 -1
- package/dist/tokeniser/CharTokeniser.js +62 -50
- package/dist/tokeniser/bpe.d.ts +1 -1
- package/dist/tokeniser/bpe.js +41 -35
- package/dist/tokeniser/type.d.ts +3 -1
- package/dist/training/AdamW.d.ts +3 -0
- package/dist/training/AdamW.js +59 -30
- package/dist/training/BasicTrainer.d.ts +1 -0
- package/dist/training/BasicTrainer.js +112 -92
- package/dist/training/DatasetBuilder.js +3 -3
- package/dist/training/Evaluator.js +2 -2
- package/dist/training/LRScheduler.d.ts +1 -0
- package/dist/training/LRScheduler.js +18 -12
- package/dist/training/PreTrainer.js +3 -3
- package/dist/training/SFTDatasetBuilder.js +3 -3
- package/dist/training/SFTTrainer.js +1 -1
- package/dist/training/orthoGrad.js +1 -1
- package/dist/training/sparseCrossEntropy.js +30 -30
- package/dist/training/types.d.ts +5 -3
- package/dist/training/validation.js +13 -13
- package/dist/{transpose-9kRxIXWR.js → transpose-Qxz-4os3.js} +7 -7
- package/dist/{unsorted_segment_sum-DJvk5xnh.js → unsorted_segment_sum-BfFVV9Zm.js} +20 -20
- package/dist/utilities/datasetID.d.ts +2 -0
- package/dist/utilities/datasetID.js +21 -0
- package/dist/utilities/dummy.js +6 -6
- 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-Ck482e3n.js → variable-SSATClyt.js} +1 -1
- package/dist/{webgpu_program-B4HmApL1.js → webgpu_program-CbjdYLYk.js} +1 -1
- package/dist/{webgpu_util-DYlGSwOJ.js → webgpu_util-DuofJBMo.js} +7 -7
- package/dist/{zeros-DvZpK8s6.js → zeros-Bw0puq_w.js} +2 -2
- package/dist/{zeros_like-CWjDdwr-.js → zeros_like-rOHr54NY.js} +69 -69
- package/package.json +3 -3
- package/dist/complex-DI35Q-gW.js +0 -11
- package/dist/mat_mul-DhG0Newp.js +0 -11
- package/dist/mod-CSdCpRjf.js +0 -11
- package/dist/relu-J_X6MUzx.js +0 -9
- package/dist/slice-BzS11Qh0.js +0 -12
- package/dist/split-C2Sj255c.js +0 -9
|
@@ -5,6 +5,7 @@ export default class LRScheduler {
|
|
|
5
5
|
private step;
|
|
6
6
|
private startLearningRate;
|
|
7
7
|
constructor(learningRate: number, config: LRSchedulerConfig);
|
|
8
|
+
serializeConfig(): LRSchedulerConfig;
|
|
8
9
|
updateConfig(newConfig: Partial<LRSchedulerConfig>, learningRate?: number): void;
|
|
9
10
|
get lr(): number;
|
|
10
11
|
getNextLR(): number;
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
class
|
|
2
|
-
constructor(
|
|
3
|
-
this.learningRate =
|
|
1
|
+
class o {
|
|
2
|
+
constructor(i, t) {
|
|
3
|
+
this.learningRate = i, this.config = t, this.startLearningRate = i, t.step !== void 0 && (this.step = t.step);
|
|
4
4
|
}
|
|
5
5
|
step = 0;
|
|
6
6
|
startLearningRate;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
serializeConfig() {
|
|
8
|
+
return {
|
|
9
|
+
...this.config,
|
|
10
|
+
step: this.step
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
updateConfig(i, t) {
|
|
14
|
+
this.config = { ...this.config, ...i }, t !== void 0 && (this.startLearningRate = t);
|
|
9
15
|
}
|
|
10
16
|
get lr() {
|
|
11
17
|
return this.learningRate;
|
|
12
18
|
}
|
|
13
19
|
getNextLR() {
|
|
14
|
-
const
|
|
15
|
-
if (this.config.warmupSteps > 0 &&
|
|
16
|
-
const r = (
|
|
20
|
+
const i = this.step;
|
|
21
|
+
if (this.config.warmupSteps > 0 && i < this.config.warmupSteps) {
|
|
22
|
+
const r = (i + 1) / this.config.warmupSteps, e = this.startLearningRate * r;
|
|
17
23
|
return this.learningRate = e, this.step++, e;
|
|
18
24
|
}
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
25
|
+
const t = this.config.epochSteps * this.config.decayEpochs;
|
|
26
|
+
if (i >= t || t <= this.config.warmupSteps)
|
|
21
27
|
return this.learningRate = this.config.minLearningRate, this.step++, this.config.minLearningRate;
|
|
22
|
-
const n = (
|
|
28
|
+
const n = (i - this.config.warmupSteps) / (t - this.config.warmupSteps), a = 0.5 * (1 + Math.cos(Math.PI * n)), s = this.config.minLearningRate + a * (this.startLearningRate - this.config.minLearningRate);
|
|
23
29
|
return this.learningRate = s, this.step++, s;
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
export {
|
|
27
|
-
|
|
33
|
+
o as default
|
|
28
34
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import r from "./BasicTrainer.js";
|
|
2
|
-
import { DatasetBuilder as
|
|
3
|
-
const
|
|
2
|
+
import { DatasetBuilder as n } from "./DatasetBuilder.js";
|
|
3
|
+
const s = {
|
|
4
4
|
decayEpochs: 100,
|
|
5
5
|
epochSteps: 1e4,
|
|
6
6
|
warmupSteps: 1e3,
|
|
@@ -11,7 +11,7 @@ const n = {
|
|
|
11
11
|
};
|
|
12
12
|
class m extends r {
|
|
13
13
|
constructor(i, e, t, a) {
|
|
14
|
-
super(i, e, { ...
|
|
14
|
+
super(i, e, { ...s, ...t }, a), this.tokenizer = e, this.optimizerConfig.minLearningRate = t?.minLearningRate ?? this.optimizerConfig.learningRate / 20, this.updateOptimizer(), this.datasetBuilder = new n(e, i.config.blockSize);
|
|
15
15
|
}
|
|
16
16
|
datasetBuilder;
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as y } from "../index-
|
|
2
|
-
import "../dataset-
|
|
3
|
-
import { g as I } from "../readers-
|
|
1
|
+
import { t as y } from "../index-DSGwv2Yx.js";
|
|
2
|
+
import "../dataset-DlqAN81i.js";
|
|
3
|
+
import { g as I } from "../readers-17HLdxVM.js";
|
|
4
4
|
import "../index-Cp39cXWe.js";
|
|
5
5
|
function w(p, o, t, l) {
|
|
6
6
|
const s = [t.bosToken], a = [!1], u = {
|
|
@@ -12,7 +12,7 @@ const n = {
|
|
|
12
12
|
};
|
|
13
13
|
class m extends r {
|
|
14
14
|
constructor(t, e, i, a) {
|
|
15
|
-
super(t, e, { ...n, ...i }, a), this.tokenizer = e, this.optimizerConfig.minLearningRate = this.optimizerConfig.learningRate /
|
|
15
|
+
super(t, e, { ...n, ...i }, a), this.tokenizer = e, this.optimizerConfig.minLearningRate = i?.minLearningRate ?? this.optimizerConfig.learningRate / 20, this.updateOptimizer(), this.datasetBuilder = new s(e, t.config.blockSize), this.maskedLoss = !0;
|
|
16
16
|
}
|
|
17
17
|
datasetBuilder;
|
|
18
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as d } from "../index-
|
|
1
|
+
import { t as d } from "../index-DSGwv2Yx.js";
|
|
2
2
|
function l(m, t, s) {
|
|
3
3
|
return d(() => {
|
|
4
4
|
const r = m.reshape([-1]), o = t.reshape([-1]), e = r.mul(r).sum().add(s), c = r.mul(o).sum().div(e), n = o.sub(r.mul(c)), a = o.norm(), u = n.norm().add(s);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { gatherSub as
|
|
1
|
+
import { gatherSub as j } from "../ops/gatherSub.js";
|
|
2
2
|
import { scatterSub as T } from "../ops/scatterSub.js";
|
|
3
|
-
import { t as
|
|
4
|
-
import { m as J, l as K, a as E, n as N, w as O } from "../not_equal-
|
|
5
|
-
import { s as m } from "../sum-
|
|
6
|
-
import { s as Q } from "../softmax-
|
|
7
|
-
function R(e,
|
|
8
|
-
return
|
|
9
|
-
const S = e.shape[e.shape.length - 1], i = v || e.shape.slice(0, -1),
|
|
3
|
+
import { t as H, a1 as G, h as A, m as x, d as U, a2 as D, b as q, a3 as F } from "../index-DSGwv2Yx.js";
|
|
4
|
+
import { m as J, l as K, a as E, n as N, w as O } from "../not_equal-CkQKkKZy.js";
|
|
5
|
+
import { s as m } from "../sum-D39FeU5h.js";
|
|
6
|
+
import { s as Q } from "../softmax-BLGJqdwx.js";
|
|
7
|
+
function R(e, h, t, g, v, a = 0) {
|
|
8
|
+
return H(() => {
|
|
9
|
+
const S = e.shape[e.shape.length - 1], i = v || e.shape.slice(0, -1), l = i.reduce((n, p) => n * p, 1), f = e.shape.length > 2 ? e.reshape([l, S]) : e, b = h.shape.length > 1 ? h.reshape([l]).cast("int32") : h.cast("int32"), u = J(f, -1, !0), o = G(f, u), r = K(o, -1), d = j(r, b, o);
|
|
10
10
|
let s;
|
|
11
|
-
if (
|
|
11
|
+
if (a > 0) {
|
|
12
12
|
const n = G(r, E(o, -1));
|
|
13
|
-
s = A(x(d, 1 -
|
|
13
|
+
s = A(x(d, 1 - a), x(n, a));
|
|
14
14
|
} else
|
|
15
15
|
s = d;
|
|
16
|
-
if (
|
|
17
|
-
if (s = x(s,
|
|
18
|
-
const n = m(
|
|
16
|
+
if (t)
|
|
17
|
+
if (s = x(s, t), g) {
|
|
18
|
+
const n = m(t.reshape(i), -1);
|
|
19
19
|
s = U(m(s.reshape(i), -1), n);
|
|
20
20
|
} else {
|
|
21
|
-
const n = m(
|
|
21
|
+
const n = m(t);
|
|
22
22
|
s = U(m(s), n);
|
|
23
23
|
}
|
|
24
24
|
else
|
|
@@ -26,44 +26,44 @@ function R(e, l, a, g, v, t = 0) {
|
|
|
26
26
|
return s;
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function ts(e, h, t = 0) {
|
|
30
30
|
return D(
|
|
31
31
|
// @ts-expect-error Invalid params
|
|
32
|
-
(
|
|
33
|
-
const
|
|
32
|
+
(a, S, i) => {
|
|
33
|
+
const l = a.shape[a.shape.length - 1], f = a.shape.slice(0, -1), b = f.reduce((p, c) => p * c, 1), u = a.reshape([b, l]), o = S.reshape([b]).cast("int32");
|
|
34
34
|
let r, d = null;
|
|
35
35
|
if (e) {
|
|
36
|
-
const p =
|
|
37
|
-
d = c.cast("float32"), r = O(c, o,
|
|
36
|
+
const p = q(-100, "int32"), c = N(o, p);
|
|
37
|
+
d = c.cast("float32"), r = O(c, o, F(o));
|
|
38
38
|
} else
|
|
39
39
|
r = o;
|
|
40
40
|
const s = R(
|
|
41
41
|
u,
|
|
42
42
|
r,
|
|
43
43
|
d || void 0,
|
|
44
|
-
l,
|
|
45
44
|
h,
|
|
46
|
-
|
|
45
|
+
f,
|
|
46
|
+
t
|
|
47
47
|
);
|
|
48
|
-
return i(d ? [u, r, d] : [u, r]), u.dispose(), o.dispose(), { value: s, gradFunc: (p, c) =>
|
|
49
|
-
const C = c[0], z = c[1],
|
|
48
|
+
return i(d ? [u, r, d] : [u, r]), u.dispose(), o.dispose(), { value: s, gradFunc: (p, c) => H(() => {
|
|
49
|
+
const C = c[0], z = c[1], y = e ? c[2] : void 0, w = Q(C), P = y ? m(y) : q(C.shape[0], "float32"), I = p.div(P).broadcastTo([C.shape[0]]), M = y && e ? x(I, y) : I;
|
|
50
50
|
let L;
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
51
|
+
if (t > 0) {
|
|
52
|
+
const W = t / l, $ = G(w, W);
|
|
53
53
|
L = T(
|
|
54
|
-
|
|
54
|
+
$,
|
|
55
55
|
z,
|
|
56
|
-
x(M, 1 -
|
|
56
|
+
x(M, 1 - t)
|
|
57
57
|
);
|
|
58
58
|
} else
|
|
59
59
|
L = T(w, z, M);
|
|
60
|
-
const
|
|
61
|
-
return [L.reshape(
|
|
60
|
+
const V = F(S);
|
|
61
|
+
return [L.reshape(a.shape), V];
|
|
62
62
|
}) };
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
export {
|
|
67
|
-
|
|
67
|
+
ts as createSoftmaxCrossEntropyWithGrad,
|
|
68
68
|
R as sparseSoftmaxCrossEntropy
|
|
69
69
|
};
|
package/dist/training/types.d.ts
CHANGED
|
@@ -19,21 +19,23 @@ export interface TrainingLogEntry {
|
|
|
19
19
|
weightNorm?: number;
|
|
20
20
|
weightStatistics?: Map<string, TensorStatistics>;
|
|
21
21
|
memoryUsage?: number;
|
|
22
|
-
tokensPerSecond
|
|
22
|
+
tokensPerSecond: number;
|
|
23
23
|
duration: number;
|
|
24
|
-
|
|
25
|
-
samplesPerSecond: number;
|
|
24
|
+
totalTokens: number;
|
|
26
25
|
}
|
|
27
26
|
export interface LRSchedulerConfig {
|
|
28
27
|
warmupSteps: number;
|
|
29
28
|
decayEpochs: number;
|
|
30
29
|
minLearningRate: number;
|
|
31
30
|
epochSteps: number;
|
|
31
|
+
step?: number;
|
|
32
32
|
}
|
|
33
33
|
export interface AdamWOptimizerConfig extends LRSchedulerConfig {
|
|
34
34
|
learningRate: number;
|
|
35
35
|
beta1: number;
|
|
36
36
|
beta2: number;
|
|
37
|
+
accBeta1?: number;
|
|
38
|
+
accBeta2?: number;
|
|
37
39
|
epsilon?: number;
|
|
38
40
|
weightDecay: number;
|
|
39
41
|
lossScaling: number;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import "../random_width-
|
|
3
|
-
import "../zeros_like-
|
|
1
|
+
import "../index-DSGwv2Yx.js";
|
|
2
|
+
import "../random_width-B_fVXhGx.js";
|
|
3
|
+
import "../zeros_like-rOHr54NY.js";
|
|
4
4
|
import "../Generator.js";
|
|
5
5
|
import "../index-Cp39cXWe.js";
|
|
6
|
-
import "../dataset-
|
|
6
|
+
import "../dataset-DlqAN81i.js";
|
|
7
7
|
import "../ops/cpu/attentionMask.js";
|
|
8
8
|
import "../ops/webgl/attentionMask.js";
|
|
9
9
|
import "../ops/grads/attentionMask.js";
|
|
10
10
|
import "../ops/cpu/rope.js";
|
|
11
11
|
import "../ops/webgl/rope.js";
|
|
12
|
-
import "../rope-
|
|
12
|
+
import "../rope-CC5RjmKU.js";
|
|
13
13
|
import "../ops/cpu/appendCache.js";
|
|
14
14
|
import "../ops/webgl/appendCache.js";
|
|
15
15
|
import "../ops/grads/softmax16.js";
|
|
16
|
-
import "../matMul16-
|
|
16
|
+
import "../matMul16-BIT70Vya.js";
|
|
17
17
|
import "../ops/webgl/matMul16.js";
|
|
18
18
|
import "../ops/cpu/matMul16.js";
|
|
19
|
-
import "../pack16-
|
|
19
|
+
import "../pack16-WlOSOuZA.js";
|
|
20
20
|
import "../ops/transpose16.js";
|
|
21
21
|
import "../ops/reshape16.js";
|
|
22
22
|
import "../ops/cpu/qkv.js";
|
|
@@ -30,23 +30,23 @@ import "../ops/webgl/dropout16.js";
|
|
|
30
30
|
import "../ops/grads/add16.js";
|
|
31
31
|
import "../jszip.min-BZhlzntC.js";
|
|
32
32
|
import "../index-DvYrXKkX.js";
|
|
33
|
-
import "../ops/cpu/gatherSub.js";
|
|
34
|
-
import "../ops/webgl/gatherSub.js";
|
|
35
|
-
import "../ops/cpu/scatterSub.js";
|
|
36
|
-
import "../ops/webgl/scatterSub.js";
|
|
37
33
|
import "../ops/cpu/adamAdjust.js";
|
|
38
34
|
import "../ops/webgl/adamAdjust.js";
|
|
39
35
|
import "../ops/cpu/adamMoments.js";
|
|
40
36
|
import "../ops/webgl/adamMoments.js";
|
|
37
|
+
import "../ops/cpu/gatherSub.js";
|
|
38
|
+
import "../ops/webgl/gatherSub.js";
|
|
39
|
+
import "../ops/cpu/scatterSub.js";
|
|
40
|
+
import "../ops/webgl/scatterSub.js";
|
|
41
41
|
import { PAGE_FACTOR as m, shuffle as h } from "./DatasetBuilder.js";
|
|
42
42
|
import { tokensFromTasks as k } from "./tasks/Task.js";
|
|
43
43
|
import "../papaparse.min-C0cScC2i.js";
|
|
44
44
|
import "../ops/cpu/matMulGelu.js";
|
|
45
|
-
import "../matMulGelu-
|
|
45
|
+
import "../matMulGelu-CsZnh18H.js";
|
|
46
46
|
import "../ops/grads/matMulGelu.js";
|
|
47
47
|
import "../ops/cpu/gelu.js";
|
|
48
48
|
import "../ops/webgl/gelu.js";
|
|
49
|
-
import "../gelu-
|
|
49
|
+
import "../gelu-DpTCC3eB.js";
|
|
50
50
|
import "../ops/webgl/log.js";
|
|
51
51
|
import "../checks/normRMS.js";
|
|
52
52
|
import "../checks/normRMSGrad.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as u,
|
|
2
|
-
import { c as k } from "./complex-
|
|
1
|
+
import { o as u, n as i, E as o, ao as $, ap as g, aq as m, v as l, t as x, ar as p } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { c as k } from "./complex-3DpPEG9B.js";
|
|
3
3
|
function K(r) {
|
|
4
4
|
const e = { input: i(r, "input", "imag") };
|
|
5
5
|
return o.runKernel($, e);
|
|
@@ -12,25 +12,25 @@ function E(r) {
|
|
|
12
12
|
const _ = /* @__PURE__ */ u({ neg_: E });
|
|
13
13
|
function b(r) {
|
|
14
14
|
const e = { input: i(r, "input", "real") };
|
|
15
|
-
return o.runKernel(
|
|
15
|
+
return o.runKernel(m, e);
|
|
16
16
|
}
|
|
17
17
|
const d = /* @__PURE__ */ u({ real_: b });
|
|
18
|
-
function
|
|
18
|
+
function v(r, t, e) {
|
|
19
19
|
const n = i(r, "x", "transpose");
|
|
20
20
|
if (t == null && (t = n.shape.map((s, a) => a).reverse()), l(n.rank === t.length, () => `Error in transpose: rank of input ${n.rank} must match length of perm ${t}.`), t.forEach((s) => {
|
|
21
21
|
l(s >= 0 && s < n.rank, () => `All entries in 'perm' must be between 0 and ${n.rank - 1} but got ${t}`);
|
|
22
22
|
}), n.rank <= 1)
|
|
23
23
|
return n.clone();
|
|
24
24
|
const f = { x: n }, c = { perm: t };
|
|
25
|
-
return n.dtype === "complex64" ?
|
|
25
|
+
return n.dtype === "complex64" ? x(() => {
|
|
26
26
|
let s = d(n), a = h(n);
|
|
27
27
|
return s = o.runKernel(p, { x: s }, c), a = o.runKernel(p, { x: a }, c), e && (a = _(a)), k(s, a);
|
|
28
28
|
}) : o.runKernel(p, f, c);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const y = /* @__PURE__ */ u({ transpose_: v });
|
|
31
31
|
export {
|
|
32
32
|
h as i,
|
|
33
33
|
_ as n,
|
|
34
34
|
d as r,
|
|
35
|
-
|
|
35
|
+
y as t
|
|
36
36
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { o as h,
|
|
2
|
-
import { k as C, c as g, m as D } from "./step-
|
|
3
|
-
import { r as b } from "./reshape-
|
|
4
|
-
import { m as pn, b as hn, e as w } from "./not_equal-
|
|
5
|
-
import { s as K } from "./sum-
|
|
1
|
+
import { o as h, n as c, E as d, bm as T, bn as q, bo as H, v as l, bp as P, J as _, bq as y, br as I, bs as W, bt as B, bu as A, bv as G, bw as L, bx as O, by as z, bz as F, z as M, _ as j, bA as J, bB as U, bC as V, a2 as Q, a1 as N, m as X, bD as Y, bE as Z, bF as R, bG as nn, bH as tn, bI as sn, bJ as en, bK as rn, bL as on, bM as an, bN as un, aE as cn, bO as ln } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { k as C, c as g, m as D } from "./step-DQY6_ABw.js";
|
|
3
|
+
import { r as b } from "./reshape-BIN71H3p.js";
|
|
4
|
+
import { m as pn, b as hn, e as w } from "./not_equal-CkQKkKZy.js";
|
|
5
|
+
import { s as K } from "./sum-D39FeU5h.js";
|
|
6
6
|
function fn(s, n = null, t = !1) {
|
|
7
7
|
const i = { x: c(s, "x", "all", "bool") }, o = { axis: n, keepDims: t };
|
|
8
8
|
return d.runKernel(T, i, o);
|
|
@@ -37,7 +37,7 @@ function xn(s, n, t) {
|
|
|
37
37
|
const e = c(s, "x", "batchToSpaceND"), i = n.reduce((r, a) => r * a);
|
|
38
38
|
l(e.rank >= 1 + n.length, () => `input rank is ${e.rank} but should be > than blockShape.length ${n.length}`), l(t.length === n.length, () => `crops.length is ${t.length} but should be equal to blockShape.length ${n.length}`), l(e.shape[0] % i === 0, () => `input tensor batch is ${e.shape[0]} but is not divisible by the product of the elements of blockShape ${n.join(" * ")} === ${i}`);
|
|
39
39
|
const o = { x: e }, p = { blockShape: n, crops: t };
|
|
40
|
-
return d.runKernel(
|
|
40
|
+
return d.runKernel(I, o, p);
|
|
41
41
|
}
|
|
42
42
|
const ot = /* @__PURE__ */ h({ batchToSpaceND_: xn });
|
|
43
43
|
function kn(s) {
|
|
@@ -57,7 +57,7 @@ function vn(s, n, t, e, i, o) {
|
|
|
57
57
|
offset: m,
|
|
58
58
|
mean: r,
|
|
59
59
|
variance: a
|
|
60
|
-
}, k = { varianceEpsilon: o }, $ = d.runKernel(
|
|
60
|
+
}, k = { varianceEpsilon: o }, $ = d.runKernel(W, x, k);
|
|
61
61
|
return b($, p.shape);
|
|
62
62
|
}
|
|
63
63
|
const at = /* @__PURE__ */ h({ batchNorm_: vn });
|
|
@@ -67,7 +67,7 @@ function gn(s, n, t, e, i = "NHWC", o = [1, 1], p) {
|
|
|
67
67
|
r.rank === 3 && (m = !0, u = b(r, [1, r.shape[0], r.shape[1], r.shape[2]])), l(u.rank === 4, () => `Error in conv2d: input must be rank 4, but got rank ${u.rank}.`), l(a.rank === 4, () => `Error in conv2d: filter must be rank 4, but got rank ${a.rank}.`), g("conv2d", e, p);
|
|
68
68
|
const f = i === "NHWC" ? u.shape[3] : u.shape[1];
|
|
69
69
|
l(f === a.shape[2], () => `Error in conv2d: depth of input (${f}) must match input depth for filter ${a.shape[2]}.`), l(C(t, o), () => `Error in conv2D: Either strides or dilations must be 1. Got strides ${t} and dilations '${o}'`), l(D(o), () => "Error in conv2D: Dilated rates should be larger than 0."), l(D(t), () => "Error in conv2D: Strides should be larger than 0.");
|
|
70
|
-
const x = { x: u, filter: a }, k = { strides: t, pad: e, dataFormat: i, dilations: o, dimRoundingMode: p }, $ = d.runKernel(
|
|
70
|
+
const x = { x: u, filter: a }, k = { strides: t, pad: e, dataFormat: i, dilations: o, dimRoundingMode: p }, $ = d.runKernel(B, x, k);
|
|
71
71
|
return m ? b($, [$.shape[1], $.shape[2], $.shape[3]]) : $;
|
|
72
72
|
}
|
|
73
73
|
const S = /* @__PURE__ */ h({ conv2d_: gn });
|
|
@@ -96,12 +96,12 @@ function Nn(s, n, t, e, i, o) {
|
|
|
96
96
|
const ut = /* @__PURE__ */ h({ conv2dTranspose_: Nn });
|
|
97
97
|
function _n(s) {
|
|
98
98
|
const t = { x: c(s, "x", "cos", "float32") };
|
|
99
|
-
return d.runKernel(
|
|
99
|
+
return d.runKernel(G, t);
|
|
100
100
|
}
|
|
101
101
|
const ct = /* @__PURE__ */ h({ cos_: _n });
|
|
102
102
|
function wn(s) {
|
|
103
103
|
const t = { x: c(s, "x", "cosh", "float32") };
|
|
104
|
-
return d.runKernel(
|
|
104
|
+
return d.runKernel(L, t);
|
|
105
105
|
}
|
|
106
106
|
const lt = /* @__PURE__ */ h({ cosh_: wn });
|
|
107
107
|
function Kn(s, n = 0, t = !1, e = !1) {
|
|
@@ -143,7 +143,7 @@ function yn(s) {
|
|
|
143
143
|
return d.runKernel(V, t);
|
|
144
144
|
}
|
|
145
145
|
const mt = /* @__PURE__ */ h({ softplus_: yn });
|
|
146
|
-
function
|
|
146
|
+
function In(s, n = -1) {
|
|
147
147
|
const t = c(s, "logits", "logSoftmax");
|
|
148
148
|
if (n === -1 && (n = t.rank - 1), n !== t.rank - 1)
|
|
149
149
|
throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${t.rank} and axis was ${n}`);
|
|
@@ -155,20 +155,20 @@ function Bn(s, n = -1) {
|
|
|
155
155
|
} };
|
|
156
156
|
})(t);
|
|
157
157
|
}
|
|
158
|
-
const $t = /* @__PURE__ */ h({ logSoftmax_:
|
|
159
|
-
function
|
|
158
|
+
const $t = /* @__PURE__ */ h({ logSoftmax_: In });
|
|
159
|
+
function Wn(s) {
|
|
160
160
|
const t = { x: c(s, "x", "logicalNot", "bool") };
|
|
161
161
|
return d.runKernel(Y, t);
|
|
162
162
|
}
|
|
163
|
-
const bt = /* @__PURE__ */ h({ logicalNot_:
|
|
164
|
-
function
|
|
163
|
+
const bt = /* @__PURE__ */ h({ logicalNot_: Wn });
|
|
164
|
+
function Bn(s, n, t, e, i) {
|
|
165
165
|
const o = c(s, "x", "maxPool"), p = 1;
|
|
166
166
|
let r = o, a = !1;
|
|
167
167
|
o.rank === 3 && (a = !0, r = b(o, [1, o.shape[0], o.shape[1], o.shape[2]])), l(r.rank === 4, () => `Error in maxPool: input must be rank 4 but got rank ${r.rank}.`), l(C(t, p), () => `Error in maxPool: Either strides or dilations must be 1. Got strides ${t} and dilations '${p}'`), g("maxPool", e, i);
|
|
168
168
|
const u = { x: r }, m = { filterSize: n, strides: t, pad: e, dimRoundingMode: i }, f = d.runKernel(Z, u, m);
|
|
169
169
|
return a ? b(f, [f.shape[1], f.shape[2], f.shape[3]]) : f;
|
|
170
170
|
}
|
|
171
|
-
const xt = /* @__PURE__ */ h({ maxPool_:
|
|
171
|
+
const xt = /* @__PURE__ */ h({ maxPool_: Bn });
|
|
172
172
|
function An(s, n, t = 1, e = 0, i = "int32") {
|
|
173
173
|
if (n < 2)
|
|
174
174
|
throw new Error(`Error in oneHot: depth must be >=2, but it is ${n}`);
|
|
@@ -176,19 +176,19 @@ function An(s, n, t = 1, e = 0, i = "int32") {
|
|
|
176
176
|
return d.runKernel(R, p, r);
|
|
177
177
|
}
|
|
178
178
|
const kt = /* @__PURE__ */ h({ oneHot_: An });
|
|
179
|
-
function
|
|
179
|
+
function Gn(s) {
|
|
180
180
|
const t = { x: c(s, "x", "onesLike") };
|
|
181
181
|
return d.runKernel(nn, t);
|
|
182
182
|
}
|
|
183
|
-
const vt = /* @__PURE__ */ h({ onesLike_:
|
|
184
|
-
function
|
|
183
|
+
const vt = /* @__PURE__ */ h({ onesLike_: Gn });
|
|
184
|
+
function Ln(s, n, t = 0) {
|
|
185
185
|
const e = c(s, "x", "pad");
|
|
186
186
|
if (e.rank === 0)
|
|
187
187
|
throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");
|
|
188
188
|
const i = { paddings: n, constantValue: t }, o = { x: e };
|
|
189
189
|
return d.runKernel(tn, o, i);
|
|
190
190
|
}
|
|
191
|
-
const gt = /* @__PURE__ */ h({ pad_:
|
|
191
|
+
const gt = /* @__PURE__ */ h({ pad_: Ln });
|
|
192
192
|
function On(s, n, t) {
|
|
193
193
|
const e = c(s, "x", "spaceToBatchND");
|
|
194
194
|
l(e.rank >= 1 + n.length, () => `input rank ${e.rank} should be > than [blockShape] ${n.length}`), l(t.length === n.length, () => `paddings.shape[0] ${t.length} must be equal to [blockShape] ${n.length}`), l(e.shape.reduce((p, r, a) => a > 0 && a <= n.length ? p && (r + t[a - 1][0] + t[a - 1][1]) % n[a - 1] === 0 : p, !0), () => `input spatial dimensions ${e.shape.slice(1)} with paddings ${t.toString()} must be divisible by blockShapes ${n.toString()}`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function h(s) {
|
|
2
|
+
const c = s.map((n) => String(n.id)).sort();
|
|
3
|
+
let e = 2166136261, o = 2654435769;
|
|
4
|
+
const t = (n) => {
|
|
5
|
+
e ^= n & 255, e = Math.imul(e, 16777619), o ^= n & 255, o = Math.imul(o, 2246822507);
|
|
6
|
+
}, g = (n) => {
|
|
7
|
+
const r = n.length >>> 0;
|
|
8
|
+
t(r & 255), t(r >>> 8 & 255), t(r >>> 16 & 255), t(r >>> 24 & 255);
|
|
9
|
+
for (let a = 0; a < n.length; a++) {
|
|
10
|
+
const l = n.charCodeAt(a);
|
|
11
|
+
t(l & 255), t(l >>> 8 & 255);
|
|
12
|
+
}
|
|
13
|
+
}, i = c.length >>> 0;
|
|
14
|
+
t(i & 255), t(i >>> 8 & 255), t(i >>> 16 & 255), t(i >>> 24 & 255);
|
|
15
|
+
for (const n of c)
|
|
16
|
+
g(n);
|
|
17
|
+
return "dataset__" + (e >>> 0).toString(36) + "_" + (o >>> 0).toString(36);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
h as default
|
|
21
|
+
};
|
package/dist/utilities/dummy.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z as c } from "../zeros-
|
|
1
|
+
import { Y as y, e as I, Z as P } from "../index-DSGwv2Yx.js";
|
|
2
|
+
import { z as c } from "../zeros-Bw0puq_w.js";
|
|
3
3
|
async function w(s) {
|
|
4
4
|
const t = c([1, s.config.blockSize], "int32"), n = s.forward({ training: !1 }, t);
|
|
5
5
|
await n.data(), n.dispose(), t.dispose();
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
7
|
+
async function G(s) {
|
|
8
8
|
const t = y(), n = t.numBytesInGPUAllocated ?? t.numBytesAllocatedInGPU ?? t.numBytes;
|
|
9
9
|
await w(s);
|
|
10
10
|
const a = c([1, s.config.blockSize], "int32"), e = {
|
|
@@ -32,12 +32,12 @@ async function b(s) {
|
|
|
32
32
|
}
|
|
33
33
|
return e;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function b(s) {
|
|
36
36
|
const t = c([1, s.config.blockSize], "int32");
|
|
37
37
|
s.forward({ training: !1 }, t).dispose(), t.dispose();
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
|
-
|
|
40
|
+
b as dummyPass,
|
|
41
41
|
w as dummyPassAsync,
|
|
42
|
-
|
|
42
|
+
G as dummyPassTrainAsync
|
|
43
43
|
};
|
package/dist/utilities/packed.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { m as w } from "../index-
|
|
2
|
-
import { t as f } from "../tensor2d-
|
|
3
|
-
import { e as y } from "../expand_dims-
|
|
4
|
-
import { s as g } from "../sum-
|
|
5
|
-
import { c as T } from "../concat-
|
|
1
|
+
import { m as w } from "../index-DSGwv2Yx.js";
|
|
2
|
+
import { t as f } from "../tensor2d-DTtQ1QcT.js";
|
|
3
|
+
import { e as y } from "../expand_dims-D0rBtgT1.js";
|
|
4
|
+
import { s as g } from "../sum-D39FeU5h.js";
|
|
5
|
+
import { c as T } from "../concat-Dqk7Xk7h.js";
|
|
6
6
|
const p = 16;
|
|
7
7
|
function A(o, t) {
|
|
8
8
|
if (!t)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { t as p } from "../tensor-
|
|
1
|
+
import "../index-DSGwv2Yx.js";
|
|
2
|
+
import { t as p } from "../tensor-D8e0Gd7c.js";
|
|
3
3
|
function h(n) {
|
|
4
4
|
const e = n.reduce((s, o) => s + o.length, 0), a = new Float32Array(e);
|
|
5
5
|
let t = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ad as z, ac as F, ab as E, a9 as j,
|
|
1
|
+
import { ad as z, ac as F, ab as E, a9 as j, v as A } from "./index-DSGwv2Yx.js";
|
|
2
2
|
function L(t, s) {
|
|
3
3
|
if (Math.max(...t) > 5)
|
|
4
4
|
throw new Error("Cannot symbolically compute strides for rank > 6 tensor.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as u } from "./index-DSGwv2Yx.js";
|
|
2
2
|
const c = (r) => {
|
|
3
3
|
let t = 1;
|
|
4
4
|
for (let n = 0; n < r.length; n++)
|
|
@@ -23,16 +23,16 @@ function p(r, t, n = !1) {
|
|
|
23
23
|
const a = c(r.x.map((i) => t[i])), o = c(r.y.map((i) => t[i]));
|
|
24
24
|
return a <= 4 ? [4, 16, 1] : o <= 4 ? [16, 4, 1] : [16, 16, 1];
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function M(r, t, n = !1) {
|
|
27
27
|
if (n)
|
|
28
28
|
return [4, 4, 1];
|
|
29
29
|
const a = c(r.x.map((i) => t[i])), o = c(r.y.map((i) => t[i]));
|
|
30
30
|
return a <= 4 ? [1, 2, 1] : o <= 4 ? [2, 1, 1] : [2, 2, 1];
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function h(r) {
|
|
33
33
|
return { x: r.map((t, n) => n) };
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function x(r) {
|
|
36
36
|
if (r === "float32" || r === "int32" || r === "bool" || r === "string" || r === "packedF16")
|
|
37
37
|
return 4;
|
|
38
38
|
if (r === "complex64")
|
|
@@ -52,13 +52,13 @@ var s;
|
|
|
52
52
|
r[r.MatMulReduceProgram = 0] = "MatMulReduceProgram", r[r.MatMulSplitKProgram = 1] = "MatMulSplitKProgram", r[r.MatMulSmallOutputSizeProgram = 2] = "MatMulSmallOutputSizeProgram", r[r.MatMulPackedProgram = 3] = "MatMulPackedProgram", r[r.MatMulMax = 4] = "MatMulMax";
|
|
53
53
|
})(s || (s = {}));
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
x as G,
|
|
56
56
|
s as M,
|
|
57
57
|
d as a,
|
|
58
58
|
b,
|
|
59
59
|
m as c,
|
|
60
60
|
p as d,
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
M as e,
|
|
62
|
+
h as f,
|
|
63
63
|
g as i
|
|
64
64
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as f } from "./complex-
|
|
1
|
+
import { q as n, L as m, N as i, E as c } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { c as f } from "./complex-3DpPEG9B.js";
|
|
3
3
|
function e(o, r = "float32") {
|
|
4
4
|
if (n(o), r === "complex64") {
|
|
5
5
|
const s = e(o, "float32"), t = e(o, "float32");
|