@tryhamster/gerbil 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{architectures-Ol7yUmKf.mjs → architectures-CpmH4Gha.mjs} +86 -82
- package/dist/architectures-CpmH4Gha.mjs.map +1 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/cli.mjs +8 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/frameworks/express.mjs +1 -1
- package/dist/frameworks/fastify.mjs +1 -1
- package/dist/frameworks/hono.mjs +1 -1
- package/dist/frameworks/next.d.mts +2 -2
- package/dist/frameworks/next.mjs +1 -1
- package/dist/frameworks/trpc.mjs +1 -1
- package/dist/{gerbil-_68_JSGV.d.mts → gerbil--YDNklsY.d.mts} +2 -2
- package/dist/{gerbil-_68_JSGV.d.mts.map → gerbil--YDNklsY.d.mts.map} +1 -1
- package/dist/gerbil-BPpEvMYU.mjs +4 -0
- package/dist/{gerbil-DVrdjEjm.mjs → gerbil-D13QAlk2.mjs} +2 -2
- package/dist/{gerbil-DVrdjEjm.mjs.map → gerbil-D13QAlk2.mjs.map} +1 -1
- package/dist/gpu/hooks.d.mts +1 -1
- package/dist/gpu/index.d.mts +1 -1
- package/dist/gpu/index.mjs +3 -3
- package/dist/{gpu-B3nsz-U7.mjs → gpu-DtA28rES.mjs} +12 -8
- package/dist/{gpu-B3nsz-U7.mjs.map → gpu-DtA28rES.mjs.map} +1 -1
- package/dist/{index-BdbeBDTz.d.mts → index-CZVIHkaH.d.mts} +23 -2
- package/dist/index-CZVIHkaH.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +5 -5
- package/dist/integrations/ai-sdk.mjs +1 -1
- package/dist/integrations/langchain.mjs +1 -1
- package/dist/integrations/llamaindex.mjs +1 -1
- package/dist/integrations/mcp.d.mts +2 -2
- package/dist/integrations/mcp.mjs +4 -4
- package/dist/{mcp-BmAo2Ydf.mjs → mcp-DuaxaIwt.mjs} +3 -3
- package/dist/{mcp-BmAo2Ydf.mjs.map → mcp-DuaxaIwt.mjs.map} +1 -1
- package/dist/moonshine-stt-BkU9cx2d.mjs +4 -0
- package/dist/{moonshine-stt-BeXNc7o2.mjs → moonshine-stt-BwX7NQ0O.mjs} +910 -46
- package/dist/moonshine-stt-BwX7NQ0O.mjs.map +1 -0
- package/dist/{one-liner-D-iu4TES.mjs → one-liner-CMk_GZgS.mjs} +2 -2
- package/dist/{one-liner-D-iu4TES.mjs.map → one-liner-CMk_GZgS.mjs.map} +1 -1
- package/dist/repl-CD4NDrku.mjs +9 -0
- package/dist/skills/index.d.mts +2 -2
- package/dist/skills/index.mjs +3 -3
- package/dist/{skills-CVbIAHBv.mjs → skills-CJHhljKM.mjs} +2 -2
- package/dist/{skills-CVbIAHBv.mjs.map → skills-CJHhljKM.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/architectures-Ol7yUmKf.mjs.map +0 -1
- package/dist/gerbil-Za8EdZxM.mjs +0 -4
- package/dist/index-BdbeBDTz.d.mts.map +0 -1
- package/dist/moonshine-stt-BeXNc7o2.mjs.map +0 -1
- package/dist/moonshine-stt-hjR_SKhe.mjs +0 -4
- package/dist/repl-jbL3czwC.mjs +0 -9
|
@@ -3066,34 +3066,39 @@ function generateLfm2Graph(rawConfig, dtype, groupSizeOverride, kvDtype) {
|
|
|
3066
3066
|
});
|
|
3067
3067
|
}
|
|
3068
3068
|
let prevOutput = "embed_out";
|
|
3069
|
+
let pendingNorm1Out = null;
|
|
3069
3070
|
for (let i = 0; i < num_layers; i++) {
|
|
3070
3071
|
const prefix = `layer${i}`;
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3072
|
+
let norm1Out;
|
|
3073
|
+
if (pendingNorm1Out) norm1Out = pendingNorm1Out;
|
|
3074
|
+
else {
|
|
3075
|
+
const operatorNormW = CANONICAL_KEYS.lfm2OperatorNorm(i);
|
|
3076
|
+
addTensor({
|
|
3077
|
+
name: operatorNormW,
|
|
3078
|
+
shape: [hidden_size],
|
|
3079
|
+
dtype: "f32",
|
|
3080
|
+
storage: "constant",
|
|
3081
|
+
safetensorsKey: operatorNormW
|
|
3082
|
+
});
|
|
3083
|
+
norm1Out = `${prefix}_norm1_out`;
|
|
3084
|
+
addTensor({
|
|
3085
|
+
name: norm1Out,
|
|
3086
|
+
shape: ["T", hidden_size],
|
|
3087
|
+
dtype: "f32",
|
|
3088
|
+
storage: "activation"
|
|
3089
|
+
});
|
|
3090
|
+
addNode({
|
|
3091
|
+
id: `${prefix}_norm1`,
|
|
3092
|
+
opType: "RMSNorm",
|
|
3093
|
+
inputs: [prevOutput, operatorNormW],
|
|
3094
|
+
outputs: [norm1Out],
|
|
3095
|
+
attributes: {
|
|
3096
|
+
hidden_size,
|
|
3097
|
+
eps: rms_norm_eps,
|
|
3098
|
+
seq_len_tensor: prevOutput
|
|
3099
|
+
}
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3097
3102
|
const mixerOut = isAttentionLayer(i) ? buildAttentionBlock(i, prefix, norm1Out) : buildShortConvBlock(i, prefix, norm1Out);
|
|
3098
3103
|
const resid1Out = `${prefix}_resid1`;
|
|
3099
3104
|
const ffnNormW = CANONICAL_KEYS.lfm2FfnNorm(i);
|
|
@@ -3180,16 +3185,51 @@ function generateLfm2Graph(rawConfig, dtype, groupSizeOverride, kvDtype) {
|
|
|
3180
3185
|
dtype: "f32",
|
|
3181
3186
|
storage: "activation"
|
|
3182
3187
|
});
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3188
|
+
if (i + 1 < num_layers) {
|
|
3189
|
+
const nextNormW = CANONICAL_KEYS.lfm2OperatorNorm(i + 1);
|
|
3190
|
+
addTensor({
|
|
3191
|
+
name: nextNormW,
|
|
3192
|
+
shape: [hidden_size],
|
|
3193
|
+
dtype: "f32",
|
|
3194
|
+
storage: "constant",
|
|
3195
|
+
safetensorsKey: nextNormW
|
|
3196
|
+
});
|
|
3197
|
+
const nextNorm1Out = `layer${i + 1}_norm1_out`;
|
|
3198
|
+
addTensor({
|
|
3199
|
+
name: nextNorm1Out,
|
|
3200
|
+
shape: ["T", hidden_size],
|
|
3201
|
+
dtype: "f32",
|
|
3202
|
+
storage: "activation"
|
|
3203
|
+
});
|
|
3204
|
+
addNode({
|
|
3205
|
+
id: `${prefix}_resid2_norm1`,
|
|
3206
|
+
opType: "ResidualRMSNorm",
|
|
3207
|
+
inputs: [
|
|
3208
|
+
resid1Out,
|
|
3209
|
+
mlpOut,
|
|
3210
|
+
nextNormW
|
|
3211
|
+
],
|
|
3212
|
+
outputs: [resid2Out, nextNorm1Out],
|
|
3213
|
+
attributes: {
|
|
3214
|
+
hidden_size,
|
|
3215
|
+
eps: rms_norm_eps,
|
|
3216
|
+
seq_len_tensor: resid1Out
|
|
3217
|
+
}
|
|
3218
|
+
});
|
|
3219
|
+
pendingNorm1Out = nextNorm1Out;
|
|
3220
|
+
} else {
|
|
3221
|
+
addNode({
|
|
3222
|
+
id: `${prefix}_resid2`,
|
|
3223
|
+
opType: "Add",
|
|
3224
|
+
inputs: [resid1Out, mlpOut],
|
|
3225
|
+
outputs: [resid2Out],
|
|
3226
|
+
attributes: {
|
|
3227
|
+
count_tensor: resid1Out,
|
|
3228
|
+
hidden_size
|
|
3229
|
+
}
|
|
3230
|
+
});
|
|
3231
|
+
pendingNorm1Out = null;
|
|
3232
|
+
}
|
|
3193
3233
|
prevOutput = resid2Out;
|
|
3194
3234
|
}
|
|
3195
3235
|
function buildShortConvBlock(i, prefix, norm1Out) {
|
|
@@ -3203,43 +3243,6 @@ function generateLfm2Graph(rawConfig, dtype, groupSizeOverride, kvDtype) {
|
|
|
3203
3243
|
storage: "activation"
|
|
3204
3244
|
});
|
|
3205
3245
|
addLinearOp(`${prefix}_conv_in_proj`, norm1Out, inProjW, [bcxDim, hidden_size], bcxOut, hidden_size, bcxDim);
|
|
3206
|
-
const cOut = `${prefix}_conv_C`;
|
|
3207
|
-
addTensor({
|
|
3208
|
-
name: cOut,
|
|
3209
|
-
shape: ["T", conv_dim],
|
|
3210
|
-
dtype: "f32",
|
|
3211
|
-
storage: "activation"
|
|
3212
|
-
});
|
|
3213
|
-
addNode({
|
|
3214
|
-
id: `${prefix}_conv_split_C`,
|
|
3215
|
-
opType: "SliceCols",
|
|
3216
|
-
inputs: [bcxOut],
|
|
3217
|
-
outputs: [cOut],
|
|
3218
|
-
attributes: {
|
|
3219
|
-
in_width: bcxDim,
|
|
3220
|
-
out_width: conv_dim,
|
|
3221
|
-
col_offset: conv_dim
|
|
3222
|
-
}
|
|
3223
|
-
});
|
|
3224
|
-
const bxOut = `${prefix}_conv_Bx`;
|
|
3225
|
-
addTensor({
|
|
3226
|
-
name: bxOut,
|
|
3227
|
-
shape: ["T", conv_dim],
|
|
3228
|
-
dtype: "f32",
|
|
3229
|
-
storage: "activation"
|
|
3230
|
-
});
|
|
3231
|
-
addNode({
|
|
3232
|
-
id: `${prefix}_conv_gate_in`,
|
|
3233
|
-
opType: "MulCols",
|
|
3234
|
-
inputs: [bcxOut],
|
|
3235
|
-
outputs: [bxOut],
|
|
3236
|
-
attributes: {
|
|
3237
|
-
in_width: bcxDim,
|
|
3238
|
-
out_width: conv_dim,
|
|
3239
|
-
off_a: 0,
|
|
3240
|
-
off_b: 2 * conv_dim
|
|
3241
|
-
}
|
|
3242
|
-
});
|
|
3243
3246
|
const convW = CANONICAL_KEYS.lfm2ConvWeight(i);
|
|
3244
3247
|
addTensor({
|
|
3245
3248
|
name: convW,
|
|
@@ -3264,29 +3267,30 @@ function generateLfm2Graph(rawConfig, dtype, groupSizeOverride, kvDtype) {
|
|
|
3264
3267
|
});
|
|
3265
3268
|
addNode({
|
|
3266
3269
|
id: `${prefix}_conv1d`,
|
|
3267
|
-
opType: "
|
|
3270
|
+
opType: "CausalConv1dGatedBcx",
|
|
3268
3271
|
inputs: [
|
|
3269
|
-
|
|
3272
|
+
bcxOut,
|
|
3270
3273
|
convW,
|
|
3271
|
-
convState
|
|
3272
|
-
cOut
|
|
3274
|
+
convState
|
|
3273
3275
|
],
|
|
3274
3276
|
outputs: [yOut],
|
|
3275
3277
|
attributes: {
|
|
3276
3278
|
channels: conv_dim,
|
|
3277
3279
|
kernel_size: conv_kernel,
|
|
3278
|
-
|
|
3280
|
+
in_width: bcxDim,
|
|
3281
|
+
seq_len_tensor: bcxOut
|
|
3279
3282
|
}
|
|
3280
3283
|
});
|
|
3281
3284
|
addNode({
|
|
3282
3285
|
id: `${prefix}_conv_state_update`,
|
|
3283
|
-
opType: "
|
|
3284
|
-
inputs: [
|
|
3286
|
+
opType: "ConvStateUpdateBcx",
|
|
3287
|
+
inputs: [bcxOut],
|
|
3285
3288
|
outputs: [convState],
|
|
3286
3289
|
attributes: {
|
|
3287
3290
|
channels: conv_dim,
|
|
3288
3291
|
state_size: conv_kernel - 1,
|
|
3289
|
-
|
|
3292
|
+
in_width: bcxDim,
|
|
3293
|
+
T_tensor: bcxOut
|
|
3290
3294
|
}
|
|
3291
3295
|
});
|
|
3292
3296
|
const outProjW = CANONICAL_KEYS.lfm2ConvOutProj(i);
|
|
@@ -6120,4 +6124,4 @@ function isArchitectureSupported(name) {
|
|
|
6120
6124
|
|
|
6121
6125
|
//#endregion
|
|
6122
6126
|
export { quantizeInt4 as C, createDefaultHFKeyMapper as D, GEMMA4_VIS_KEYS as E, DEFAULT_GROUP_SIZE as S, DTYPE_BYTES as T, kaniCosTensor as _, generateMoonshineEncoderGraph as a, nanoCodecWeightMap as b, KANI_END_OF_HUMAN as c, buildKaniLayerCosSin as d, computeKaniPositions as f, kaniAttentionLayerIndices as g, generateNanoCodecDecoderGraph as h, generateMoonshineDecoderGraph as i, KANI_START_OF_HUMAN as l, generateKaniTtsGraph as m, isArchitectureSupported as n, moonshineEncoderFrames as o, foldNanoCodecWeightNorm as p, MOONSHINE_REMAINING_WORK as r, parseMoonshineConfig as s, generateGraph as t, audioTokensToCodes as u, kaniLayerAlpha as v, CANONICAL_KEYS as w, parseKaniConfig as x, kaniSinTensor as y };
|
|
6123
|
-
//# sourceMappingURL=architectures-
|
|
6127
|
+
//# sourceMappingURL=architectures-CpmH4Gha.mjs.map
|