@genai-fi/nanogpt 0.8.3 → 0.8.4
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/checks/gelu.js
CHANGED
|
@@ -4,12 +4,12 @@ async function m(t) {
|
|
|
4
4
|
await e(t);
|
|
5
5
|
const r = s(
|
|
6
6
|
[
|
|
7
|
-
[0.1, 0.2, 0, 0],
|
|
8
|
-
[0.1, 0.2, 0, 0],
|
|
9
|
-
[0, 0, 0, 0],
|
|
10
|
-
[0, 0, 0, 0]
|
|
7
|
+
[0.1, 0.2, 0, 0, 1230, 1232331234, -12234234],
|
|
8
|
+
[0.1, 0.2, 0, 0, -1230, -1232331234, 12234234],
|
|
9
|
+
[0, 0, 0, 0, -1, 0, 0],
|
|
10
|
+
[0, 0, 0, 0, -0.1, 1e-3, 0]
|
|
11
11
|
],
|
|
12
|
-
[4,
|
|
12
|
+
[4, 7]
|
|
13
13
|
);
|
|
14
14
|
return await o().runKernel("Gelu", { x: r }).array();
|
|
15
15
|
}
|
package/dist/checks/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { execute as gelu } from './gelu';
|
|
|
5
5
|
import { execute as normRMSGrad } from './normRMSGrad';
|
|
6
6
|
import { execute as appendCache } from './appendCache';
|
|
7
7
|
import { execute as attentionMask } from './attentionMask';
|
|
8
|
+
import { execute as matMulGelu } from './matMulGelu';
|
|
8
9
|
import { default as runCheck } from './check';
|
|
9
10
|
import { createWeightStatistics, createTensorStatistics } from './weights';
|
|
10
11
|
declare const checks: {
|
|
@@ -15,6 +16,7 @@ declare const checks: {
|
|
|
15
16
|
normRMSGrad: typeof normRMSGrad;
|
|
16
17
|
appendCache: typeof appendCache;
|
|
17
18
|
attentionMask: typeof attentionMask;
|
|
19
|
+
matMulGelu: typeof matMulGelu;
|
|
18
20
|
runCheck: typeof runCheck;
|
|
19
21
|
createLayerWeightStatistics: typeof createWeightStatistics;
|
|
20
22
|
createWeightStatistics: typeof createTensorStatistics;
|
package/dist/checks/index.js
CHANGED
|
@@ -4,9 +4,10 @@ import { execute as r } from "./qkv.js";
|
|
|
4
4
|
import { execute as c } from "./gelu.js";
|
|
5
5
|
import { execute as o } from "./normRMSGrad.js";
|
|
6
6
|
import { execute as a } from "./appendCache.js";
|
|
7
|
-
import { execute as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import { execute as m } from "./attentionMask.js";
|
|
8
|
+
import { execute as i } from "./matMulGelu.js";
|
|
9
|
+
import s from "./check.js";
|
|
10
|
+
import { createTensorStatistics as u, createWeightStatistics as x } from "./weights.js";
|
|
10
11
|
const d = {
|
|
11
12
|
rope: e,
|
|
12
13
|
qkv: r,
|
|
@@ -14,10 +15,11 @@ const d = {
|
|
|
14
15
|
normRMS: t,
|
|
15
16
|
normRMSGrad: o,
|
|
16
17
|
appendCache: a,
|
|
17
|
-
attentionMask:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
attentionMask: m,
|
|
19
|
+
matMulGelu: i,
|
|
20
|
+
runCheck: s,
|
|
21
|
+
createLayerWeightStatistics: x,
|
|
22
|
+
createWeightStatistics: u
|
|
21
23
|
};
|
|
22
24
|
export {
|
|
23
25
|
d as default
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function execute(backend: string): Promise<number | number[] | number[][] | number[][][] | number[][][][] | number[][][][][] | number[][][][][][]>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { s as n, e as s } from "../index-DdmHGZjq.js";
|
|
2
|
+
import "../random_width-DKGeiFuR.js";
|
|
3
|
+
import "../register_all_kernels-Do9VvZmo.js";
|
|
4
|
+
import "../index-Tf7vU29b.js";
|
|
5
|
+
import "../dataset-DPPl-iLT.js";
|
|
6
|
+
import { t as e } from "../tensor2d-CObBWBkW.js";
|
|
7
|
+
async function f(t) {
|
|
8
|
+
await n(t);
|
|
9
|
+
const r = e(
|
|
10
|
+
[
|
|
11
|
+
[0.1, 0.2, 9, 10, 11],
|
|
12
|
+
[0.3, 0.4, -9, -10, -11],
|
|
13
|
+
[0.3, 0.4, -9, -10, -11],
|
|
14
|
+
[0.3, 0.4, -9, -10, -11],
|
|
15
|
+
[0.3, 0.4, -9, -10, -11]
|
|
16
|
+
],
|
|
17
|
+
[5, 5]
|
|
18
|
+
), o = e(
|
|
19
|
+
[
|
|
20
|
+
[0.5, 0.6, 7e4, -8e3, 0],
|
|
21
|
+
[0.7, 0.8, -7e4, 8e4, 0],
|
|
22
|
+
[0.7, 0.8, -7e4, 8e4, 0],
|
|
23
|
+
[0.7, 0.8, -7e4, 8e4, 0],
|
|
24
|
+
[0.7, 0.8, -7e4, 8e4, 0]
|
|
25
|
+
],
|
|
26
|
+
[5, 5]
|
|
27
|
+
);
|
|
28
|
+
return await s().runKernel("MatMulGelu", { x: o, kernel: r }).array();
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
f as execute
|
|
32
|
+
};
|
package/dist/ops/webgl/gelu.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { f as a } from "../../index-DdmHGZjq.js";
|
|
2
|
-
import { u as s, C as
|
|
3
|
-
const t = 0.7978845608028654, r = 0.044715,
|
|
2
|
+
import { u as s, C as c } from "../../kernel_funcs_utils-CDfFpUab.js";
|
|
3
|
+
const t = 0.7978845608028654, r = 0.044715, d = c + `
|
|
4
4
|
float x3 = x * x * x;
|
|
5
5
|
float inner = x + ${r} * x3;
|
|
6
6
|
inner = ${t} * inner;
|
|
7
7
|
inner = tanh(inner);
|
|
8
8
|
inner = 0.5 * (1.0 + inner);
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
`,
|
|
9
|
+
inner = x * inner;
|
|
10
|
+
return inner;
|
|
11
|
+
`, i = s({ opSnippet: d }), x = {
|
|
12
12
|
kernelName: "Gelu",
|
|
13
13
|
backendName: "webgl",
|
|
14
|
-
kernelFunc:
|
|
14
|
+
kernelFunc: i
|
|
15
15
|
};
|
|
16
|
-
a(
|
|
16
|
+
a(x);
|
|
17
17
|
class f {
|
|
18
18
|
// Inputs: dy, x
|
|
19
19
|
variableNames = ["dy", "x"];
|
|
@@ -46,5 +46,5 @@ const p = {
|
|
|
46
46
|
};
|
|
47
47
|
a(p);
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
i as gelu
|
|
50
50
|
};
|