@omote/core 0.3.1 → 0.3.25
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/{chunk-T465MTDX.mjs → chunk-B6TIE56N.mjs} +63 -1153
- package/dist/chunk-B6TIE56N.mjs.map +1 -0
- package/dist/events/index.mjs +1 -1
- package/dist/index.d.mts +86 -45
- package/dist/index.d.ts +86 -45
- package/dist/index.js +313 -1428
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +241 -124
- package/dist/index.mjs.map +1 -1
- package/dist/logging/index.mjs +1 -1
- package/dist/{transformers.web-MHLR33H6.mjs → transformers.web-T5LWC34T.mjs} +3 -3
- package/package.json +2 -3
- package/dist/chunk-6W7G6WE7.mjs +0 -13
- package/dist/chunk-C3Y37HKD.mjs +0 -26378
- package/dist/chunk-C3Y37HKD.mjs.map +0 -1
- package/dist/chunk-RI6UQ7WF.mjs +0 -26378
- package/dist/chunk-RI6UQ7WF.mjs.map +0 -1
- package/dist/chunk-T465MTDX.mjs.map +0 -1
- package/dist/transformers.web-4C62MDO6.mjs +0 -1724
- package/dist/transformers.web-4C62MDO6.mjs.map +0 -1
- package/dist/transformers.web-ALDLCPHT.mjs +0 -1725
- package/dist/transformers.web-ALDLCPHT.mjs.map +0 -1
- package/dist/transformers.web-MHLR33H6.mjs.map +0 -1
- /package/dist/{chunk-6W7G6WE7.mjs.map → transformers.web-T5LWC34T.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -32,1238 +32,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
|
|
35
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/backend-impl.js
|
|
36
|
-
var backends, backendsSortedByPriority, registerBackend, tryResolveAndInitializeBackend, resolveBackendAndExecutionProviders;
|
|
37
|
-
var init_backend_impl = __esm({
|
|
38
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/backend-impl.js"() {
|
|
39
|
-
"use strict";
|
|
40
|
-
backends = /* @__PURE__ */ new Map();
|
|
41
|
-
backendsSortedByPriority = [];
|
|
42
|
-
registerBackend = (name, backend, priority) => {
|
|
43
|
-
if (backend && typeof backend.init === "function" && typeof backend.createInferenceSessionHandler === "function") {
|
|
44
|
-
const currentBackend = backends.get(name);
|
|
45
|
-
if (currentBackend === void 0) {
|
|
46
|
-
backends.set(name, { backend, priority });
|
|
47
|
-
} else if (currentBackend.priority > priority) {
|
|
48
|
-
return;
|
|
49
|
-
} else if (currentBackend.priority === priority) {
|
|
50
|
-
if (currentBackend.backend !== backend) {
|
|
51
|
-
throw new Error(`cannot register backend "${name}" using priority ${priority}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (priority >= 0) {
|
|
55
|
-
const i = backendsSortedByPriority.indexOf(name);
|
|
56
|
-
if (i !== -1) {
|
|
57
|
-
backendsSortedByPriority.splice(i, 1);
|
|
58
|
-
}
|
|
59
|
-
for (let i2 = 0; i2 < backendsSortedByPriority.length; i2++) {
|
|
60
|
-
if (backends.get(backendsSortedByPriority[i2]).priority <= priority) {
|
|
61
|
-
backendsSortedByPriority.splice(i2, 0, name);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
backendsSortedByPriority.push(name);
|
|
66
|
-
}
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
throw new TypeError("not a valid backend");
|
|
70
|
-
};
|
|
71
|
-
tryResolveAndInitializeBackend = async (backendName) => {
|
|
72
|
-
const backendInfo = backends.get(backendName);
|
|
73
|
-
if (!backendInfo) {
|
|
74
|
-
return "backend not found.";
|
|
75
|
-
}
|
|
76
|
-
if (backendInfo.initialized) {
|
|
77
|
-
return backendInfo.backend;
|
|
78
|
-
} else if (backendInfo.aborted) {
|
|
79
|
-
return backendInfo.error;
|
|
80
|
-
} else {
|
|
81
|
-
const isInitializing = !!backendInfo.initPromise;
|
|
82
|
-
try {
|
|
83
|
-
if (!isInitializing) {
|
|
84
|
-
backendInfo.initPromise = backendInfo.backend.init(backendName);
|
|
85
|
-
}
|
|
86
|
-
await backendInfo.initPromise;
|
|
87
|
-
backendInfo.initialized = true;
|
|
88
|
-
return backendInfo.backend;
|
|
89
|
-
} catch (e) {
|
|
90
|
-
if (!isInitializing) {
|
|
91
|
-
backendInfo.error = `${e}`;
|
|
92
|
-
backendInfo.aborted = true;
|
|
93
|
-
}
|
|
94
|
-
return backendInfo.error;
|
|
95
|
-
} finally {
|
|
96
|
-
delete backendInfo.initPromise;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
resolveBackendAndExecutionProviders = async (options) => {
|
|
101
|
-
const eps = options.executionProviders || [];
|
|
102
|
-
const backendHints = eps.map((i) => typeof i === "string" ? i : i.name);
|
|
103
|
-
const backendNames = backendHints.length === 0 ? backendsSortedByPriority : backendHints;
|
|
104
|
-
let backend;
|
|
105
|
-
const errors = [];
|
|
106
|
-
const availableBackendNames = /* @__PURE__ */ new Set();
|
|
107
|
-
for (const backendName of backendNames) {
|
|
108
|
-
const resolveResult = await tryResolveAndInitializeBackend(backendName);
|
|
109
|
-
if (typeof resolveResult === "string") {
|
|
110
|
-
errors.push({ name: backendName, err: resolveResult });
|
|
111
|
-
} else {
|
|
112
|
-
if (!backend) {
|
|
113
|
-
backend = resolveResult;
|
|
114
|
-
}
|
|
115
|
-
if (backend === resolveResult) {
|
|
116
|
-
availableBackendNames.add(backendName);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (!backend) {
|
|
121
|
-
throw new Error(`no available backend found. ERR: ${errors.map((e) => `[${e.name}] ${e.err}`).join(", ")}`);
|
|
122
|
-
}
|
|
123
|
-
for (const { name, err } of errors) {
|
|
124
|
-
if (backendHints.includes(name)) {
|
|
125
|
-
console.warn(`removing requested execution provider "${name}" from session options because it is not available: ${err}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const filteredEps = eps.filter((i) => availableBackendNames.has(typeof i === "string" ? i : i.name));
|
|
129
|
-
return [
|
|
130
|
-
backend,
|
|
131
|
-
new Proxy(options, {
|
|
132
|
-
get: (target, prop) => {
|
|
133
|
-
if (prop === "executionProviders") {
|
|
134
|
-
return filteredEps;
|
|
135
|
-
}
|
|
136
|
-
return Reflect.get(target, prop);
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
];
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/backend.js
|
|
145
|
-
var init_backend = __esm({
|
|
146
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/backend.js"() {
|
|
147
|
-
"use strict";
|
|
148
|
-
init_backend_impl();
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/version.js
|
|
153
|
-
var version;
|
|
154
|
-
var init_version = __esm({
|
|
155
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/version.js"() {
|
|
156
|
-
"use strict";
|
|
157
|
-
version = "1.21.0";
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/env-impl.js
|
|
162
|
-
var logLevelValue, env;
|
|
163
|
-
var init_env_impl = __esm({
|
|
164
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/env-impl.js"() {
|
|
165
|
-
"use strict";
|
|
166
|
-
init_version();
|
|
167
|
-
logLevelValue = "warning";
|
|
168
|
-
env = {
|
|
169
|
-
wasm: {},
|
|
170
|
-
webgl: {},
|
|
171
|
-
webgpu: {},
|
|
172
|
-
versions: { common: version },
|
|
173
|
-
set logLevel(value) {
|
|
174
|
-
if (value === void 0) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (typeof value !== "string" || ["verbose", "info", "warning", "error", "fatal"].indexOf(value) === -1) {
|
|
178
|
-
throw new Error(`Unsupported logging level: ${value}`);
|
|
179
|
-
}
|
|
180
|
-
logLevelValue = value;
|
|
181
|
-
},
|
|
182
|
-
get logLevel() {
|
|
183
|
-
return logLevelValue;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
Object.defineProperty(env, "logLevel", { enumerable: true });
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/env.js
|
|
191
|
-
var env2;
|
|
192
|
-
var init_env = __esm({
|
|
193
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/env.js"() {
|
|
194
|
-
"use strict";
|
|
195
|
-
init_env_impl();
|
|
196
|
-
env2 = env;
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-conversion-impl.js
|
|
201
|
-
var tensorToDataURL, tensorToImageData;
|
|
202
|
-
var init_tensor_conversion_impl = __esm({
|
|
203
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-conversion-impl.js"() {
|
|
204
|
-
"use strict";
|
|
205
|
-
tensorToDataURL = (tensor, options) => {
|
|
206
|
-
const canvas = typeof document !== "undefined" ? document.createElement("canvas") : new OffscreenCanvas(1, 1);
|
|
207
|
-
canvas.width = tensor.dims[3];
|
|
208
|
-
canvas.height = tensor.dims[2];
|
|
209
|
-
const pixels2DContext = canvas.getContext("2d");
|
|
210
|
-
if (pixels2DContext != null) {
|
|
211
|
-
let width;
|
|
212
|
-
let height;
|
|
213
|
-
if (options?.tensorLayout !== void 0 && options.tensorLayout === "NHWC") {
|
|
214
|
-
width = tensor.dims[2];
|
|
215
|
-
height = tensor.dims[3];
|
|
216
|
-
} else {
|
|
217
|
-
width = tensor.dims[3];
|
|
218
|
-
height = tensor.dims[2];
|
|
219
|
-
}
|
|
220
|
-
const inputformat = options?.format !== void 0 ? options.format : "RGB";
|
|
221
|
-
const norm = options?.norm;
|
|
222
|
-
let normMean;
|
|
223
|
-
let normBias;
|
|
224
|
-
if (norm === void 0 || norm.mean === void 0) {
|
|
225
|
-
normMean = [255, 255, 255, 255];
|
|
226
|
-
} else {
|
|
227
|
-
if (typeof norm.mean === "number") {
|
|
228
|
-
normMean = [norm.mean, norm.mean, norm.mean, norm.mean];
|
|
229
|
-
} else {
|
|
230
|
-
normMean = [norm.mean[0], norm.mean[1], norm.mean[2], 0];
|
|
231
|
-
if (norm.mean[3] !== void 0) {
|
|
232
|
-
normMean[3] = norm.mean[3];
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
if (norm === void 0 || norm.bias === void 0) {
|
|
237
|
-
normBias = [0, 0, 0, 0];
|
|
238
|
-
} else {
|
|
239
|
-
if (typeof norm.bias === "number") {
|
|
240
|
-
normBias = [norm.bias, norm.bias, norm.bias, norm.bias];
|
|
241
|
-
} else {
|
|
242
|
-
normBias = [norm.bias[0], norm.bias[1], norm.bias[2], 0];
|
|
243
|
-
if (norm.bias[3] !== void 0) {
|
|
244
|
-
normBias[3] = norm.bias[3];
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
const stride = height * width;
|
|
249
|
-
let rTensorPointer = 0, gTensorPointer = stride, bTensorPointer = stride * 2, aTensorPointer = -1;
|
|
250
|
-
if (inputformat === "RGBA") {
|
|
251
|
-
rTensorPointer = 0;
|
|
252
|
-
gTensorPointer = stride;
|
|
253
|
-
bTensorPointer = stride * 2;
|
|
254
|
-
aTensorPointer = stride * 3;
|
|
255
|
-
} else if (inputformat === "RGB") {
|
|
256
|
-
rTensorPointer = 0;
|
|
257
|
-
gTensorPointer = stride;
|
|
258
|
-
bTensorPointer = stride * 2;
|
|
259
|
-
} else if (inputformat === "RBG") {
|
|
260
|
-
rTensorPointer = 0;
|
|
261
|
-
bTensorPointer = stride;
|
|
262
|
-
gTensorPointer = stride * 2;
|
|
263
|
-
}
|
|
264
|
-
for (let i = 0; i < height; i++) {
|
|
265
|
-
for (let j = 0; j < width; j++) {
|
|
266
|
-
const R = (tensor.data[rTensorPointer++] - normBias[0]) * normMean[0];
|
|
267
|
-
const G = (tensor.data[gTensorPointer++] - normBias[1]) * normMean[1];
|
|
268
|
-
const B = (tensor.data[bTensorPointer++] - normBias[2]) * normMean[2];
|
|
269
|
-
const A = aTensorPointer === -1 ? 255 : (tensor.data[aTensorPointer++] - normBias[3]) * normMean[3];
|
|
270
|
-
pixels2DContext.fillStyle = "rgba(" + R + "," + G + "," + B + "," + A + ")";
|
|
271
|
-
pixels2DContext.fillRect(j, i, 1, 1);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if ("toDataURL" in canvas) {
|
|
275
|
-
return canvas.toDataURL();
|
|
276
|
-
} else {
|
|
277
|
-
throw new Error("toDataURL is not supported");
|
|
278
|
-
}
|
|
279
|
-
} else {
|
|
280
|
-
throw new Error("Can not access image data");
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
tensorToImageData = (tensor, options) => {
|
|
284
|
-
const pixels2DContext = typeof document !== "undefined" ? document.createElement("canvas").getContext("2d") : new OffscreenCanvas(1, 1).getContext("2d");
|
|
285
|
-
let image;
|
|
286
|
-
if (pixels2DContext != null) {
|
|
287
|
-
let width;
|
|
288
|
-
let height;
|
|
289
|
-
let channels;
|
|
290
|
-
if (options?.tensorLayout !== void 0 && options.tensorLayout === "NHWC") {
|
|
291
|
-
width = tensor.dims[2];
|
|
292
|
-
height = tensor.dims[1];
|
|
293
|
-
channels = tensor.dims[3];
|
|
294
|
-
} else {
|
|
295
|
-
width = tensor.dims[3];
|
|
296
|
-
height = tensor.dims[2];
|
|
297
|
-
channels = tensor.dims[1];
|
|
298
|
-
}
|
|
299
|
-
const inputformat = options !== void 0 ? options.format !== void 0 ? options.format : "RGB" : "RGB";
|
|
300
|
-
const norm = options?.norm;
|
|
301
|
-
let normMean;
|
|
302
|
-
let normBias;
|
|
303
|
-
if (norm === void 0 || norm.mean === void 0) {
|
|
304
|
-
normMean = [255, 255, 255, 255];
|
|
305
|
-
} else {
|
|
306
|
-
if (typeof norm.mean === "number") {
|
|
307
|
-
normMean = [norm.mean, norm.mean, norm.mean, norm.mean];
|
|
308
|
-
} else {
|
|
309
|
-
normMean = [norm.mean[0], norm.mean[1], norm.mean[2], 255];
|
|
310
|
-
if (norm.mean[3] !== void 0) {
|
|
311
|
-
normMean[3] = norm.mean[3];
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (norm === void 0 || norm.bias === void 0) {
|
|
316
|
-
normBias = [0, 0, 0, 0];
|
|
317
|
-
} else {
|
|
318
|
-
if (typeof norm.bias === "number") {
|
|
319
|
-
normBias = [norm.bias, norm.bias, norm.bias, norm.bias];
|
|
320
|
-
} else {
|
|
321
|
-
normBias = [norm.bias[0], norm.bias[1], norm.bias[2], 0];
|
|
322
|
-
if (norm.bias[3] !== void 0) {
|
|
323
|
-
normBias[3] = norm.bias[3];
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
const stride = height * width;
|
|
328
|
-
if (options !== void 0) {
|
|
329
|
-
if (options.format !== void 0 && channels === 4 && options.format !== "RGBA" || channels === 3 && options.format !== "RGB" && options.format !== "BGR") {
|
|
330
|
-
throw new Error("Tensor format doesn't match input tensor dims");
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const step = 4;
|
|
334
|
-
let rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;
|
|
335
|
-
let rTensorPointer = 0, gTensorPointer = stride, bTensorPointer = stride * 2, aTensorPointer = -1;
|
|
336
|
-
if (inputformat === "RGBA") {
|
|
337
|
-
rTensorPointer = 0;
|
|
338
|
-
gTensorPointer = stride;
|
|
339
|
-
bTensorPointer = stride * 2;
|
|
340
|
-
aTensorPointer = stride * 3;
|
|
341
|
-
} else if (inputformat === "RGB") {
|
|
342
|
-
rTensorPointer = 0;
|
|
343
|
-
gTensorPointer = stride;
|
|
344
|
-
bTensorPointer = stride * 2;
|
|
345
|
-
} else if (inputformat === "RBG") {
|
|
346
|
-
rTensorPointer = 0;
|
|
347
|
-
bTensorPointer = stride;
|
|
348
|
-
gTensorPointer = stride * 2;
|
|
349
|
-
}
|
|
350
|
-
image = pixels2DContext.createImageData(width, height);
|
|
351
|
-
for (let i = 0; i < height * width; rImagePointer += step, gImagePointer += step, bImagePointer += step, aImagePointer += step, i++) {
|
|
352
|
-
image.data[rImagePointer] = (tensor.data[rTensorPointer++] - normBias[0]) * normMean[0];
|
|
353
|
-
image.data[gImagePointer] = (tensor.data[gTensorPointer++] - normBias[1]) * normMean[1];
|
|
354
|
-
image.data[bImagePointer] = (tensor.data[bTensorPointer++] - normBias[2]) * normMean[2];
|
|
355
|
-
image.data[aImagePointer] = aTensorPointer === -1 ? 255 : (tensor.data[aTensorPointer++] - normBias[3]) * normMean[3];
|
|
356
|
-
}
|
|
357
|
-
} else {
|
|
358
|
-
throw new Error("Can not access image data");
|
|
359
|
-
}
|
|
360
|
-
return image;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-factory-impl.js
|
|
366
|
-
var bufferToTensor, tensorFromImage, tensorFromTexture, tensorFromGpuBuffer, tensorFromMLTensor, tensorFromPinnedBuffer;
|
|
367
|
-
var init_tensor_factory_impl = __esm({
|
|
368
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-factory-impl.js"() {
|
|
369
|
-
"use strict";
|
|
370
|
-
init_tensor_impl();
|
|
371
|
-
bufferToTensor = (buffer, options) => {
|
|
372
|
-
if (buffer === void 0) {
|
|
373
|
-
throw new Error("Image buffer must be defined");
|
|
374
|
-
}
|
|
375
|
-
if (options.height === void 0 || options.width === void 0) {
|
|
376
|
-
throw new Error("Image height and width must be defined");
|
|
377
|
-
}
|
|
378
|
-
if (options.tensorLayout === "NHWC") {
|
|
379
|
-
throw new Error("NHWC Tensor layout is not supported yet");
|
|
380
|
-
}
|
|
381
|
-
const { height, width } = options;
|
|
382
|
-
const norm = options.norm ?? { mean: 255, bias: 0 };
|
|
383
|
-
let normMean;
|
|
384
|
-
let normBias;
|
|
385
|
-
if (typeof norm.mean === "number") {
|
|
386
|
-
normMean = [norm.mean, norm.mean, norm.mean, norm.mean];
|
|
387
|
-
} else {
|
|
388
|
-
normMean = [norm.mean[0], norm.mean[1], norm.mean[2], norm.mean[3] ?? 255];
|
|
389
|
-
}
|
|
390
|
-
if (typeof norm.bias === "number") {
|
|
391
|
-
normBias = [norm.bias, norm.bias, norm.bias, norm.bias];
|
|
392
|
-
} else {
|
|
393
|
-
normBias = [norm.bias[0], norm.bias[1], norm.bias[2], norm.bias[3] ?? 0];
|
|
394
|
-
}
|
|
395
|
-
const inputformat = options.format !== void 0 ? options.format : "RGBA";
|
|
396
|
-
const outputformat = options.tensorFormat !== void 0 ? options.tensorFormat !== void 0 ? options.tensorFormat : "RGB" : "RGB";
|
|
397
|
-
const stride = height * width;
|
|
398
|
-
const float32Data = outputformat === "RGBA" ? new Float32Array(stride * 4) : new Float32Array(stride * 3);
|
|
399
|
-
let step = 4, rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;
|
|
400
|
-
let rTensorPointer = 0, gTensorPointer = stride, bTensorPointer = stride * 2, aTensorPointer = -1;
|
|
401
|
-
if (inputformat === "RGB") {
|
|
402
|
-
step = 3;
|
|
403
|
-
rImagePointer = 0;
|
|
404
|
-
gImagePointer = 1;
|
|
405
|
-
bImagePointer = 2;
|
|
406
|
-
aImagePointer = -1;
|
|
407
|
-
}
|
|
408
|
-
if (outputformat === "RGBA") {
|
|
409
|
-
aTensorPointer = stride * 3;
|
|
410
|
-
} else if (outputformat === "RBG") {
|
|
411
|
-
rTensorPointer = 0;
|
|
412
|
-
bTensorPointer = stride;
|
|
413
|
-
gTensorPointer = stride * 2;
|
|
414
|
-
} else if (outputformat === "BGR") {
|
|
415
|
-
bTensorPointer = 0;
|
|
416
|
-
gTensorPointer = stride;
|
|
417
|
-
rTensorPointer = stride * 2;
|
|
418
|
-
}
|
|
419
|
-
for (let i = 0; i < stride; i++, rImagePointer += step, bImagePointer += step, gImagePointer += step, aImagePointer += step) {
|
|
420
|
-
float32Data[rTensorPointer++] = (buffer[rImagePointer] + normBias[0]) / normMean[0];
|
|
421
|
-
float32Data[gTensorPointer++] = (buffer[gImagePointer] + normBias[1]) / normMean[1];
|
|
422
|
-
float32Data[bTensorPointer++] = (buffer[bImagePointer] + normBias[2]) / normMean[2];
|
|
423
|
-
if (aTensorPointer !== -1 && aImagePointer !== -1) {
|
|
424
|
-
float32Data[aTensorPointer++] = (buffer[aImagePointer] + normBias[3]) / normMean[3];
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
const outputTensor = outputformat === "RGBA" ? new Tensor("float32", float32Data, [1, 4, height, width]) : new Tensor("float32", float32Data, [1, 3, height, width]);
|
|
428
|
-
return outputTensor;
|
|
429
|
-
};
|
|
430
|
-
tensorFromImage = async (image, options) => {
|
|
431
|
-
const isHTMLImageEle = typeof HTMLImageElement !== "undefined" && image instanceof HTMLImageElement;
|
|
432
|
-
const isImageDataEle = typeof ImageData !== "undefined" && image instanceof ImageData;
|
|
433
|
-
const isImageBitmap = typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap;
|
|
434
|
-
const isString = typeof image === "string";
|
|
435
|
-
let data;
|
|
436
|
-
let bufferToTensorOptions = options ?? {};
|
|
437
|
-
const createCanvas = () => {
|
|
438
|
-
if (typeof document !== "undefined") {
|
|
439
|
-
return document.createElement("canvas");
|
|
440
|
-
} else if (typeof OffscreenCanvas !== "undefined") {
|
|
441
|
-
return new OffscreenCanvas(1, 1);
|
|
442
|
-
} else {
|
|
443
|
-
throw new Error("Canvas is not supported");
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
const createCanvasContext = (canvas) => {
|
|
447
|
-
if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
|
|
448
|
-
return canvas.getContext("2d");
|
|
449
|
-
} else if (canvas instanceof OffscreenCanvas) {
|
|
450
|
-
return canvas.getContext("2d");
|
|
451
|
-
} else {
|
|
452
|
-
return null;
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
if (isHTMLImageEle) {
|
|
456
|
-
const canvas = createCanvas();
|
|
457
|
-
canvas.width = image.width;
|
|
458
|
-
canvas.height = image.height;
|
|
459
|
-
const pixels2DContext = createCanvasContext(canvas);
|
|
460
|
-
if (pixels2DContext != null) {
|
|
461
|
-
let height = image.height;
|
|
462
|
-
let width = image.width;
|
|
463
|
-
if (options !== void 0 && options.resizedHeight !== void 0 && options.resizedWidth !== void 0) {
|
|
464
|
-
height = options.resizedHeight;
|
|
465
|
-
width = options.resizedWidth;
|
|
466
|
-
}
|
|
467
|
-
if (options !== void 0) {
|
|
468
|
-
bufferToTensorOptions = options;
|
|
469
|
-
if (options.tensorFormat !== void 0) {
|
|
470
|
-
throw new Error("Image input config format must be RGBA for HTMLImageElement");
|
|
471
|
-
} else {
|
|
472
|
-
bufferToTensorOptions.tensorFormat = "RGBA";
|
|
473
|
-
}
|
|
474
|
-
bufferToTensorOptions.height = height;
|
|
475
|
-
bufferToTensorOptions.width = width;
|
|
476
|
-
} else {
|
|
477
|
-
bufferToTensorOptions.tensorFormat = "RGBA";
|
|
478
|
-
bufferToTensorOptions.height = height;
|
|
479
|
-
bufferToTensorOptions.width = width;
|
|
480
|
-
}
|
|
481
|
-
pixels2DContext.drawImage(image, 0, 0);
|
|
482
|
-
data = pixels2DContext.getImageData(0, 0, width, height).data;
|
|
483
|
-
} else {
|
|
484
|
-
throw new Error("Can not access image data");
|
|
485
|
-
}
|
|
486
|
-
} else if (isImageDataEle) {
|
|
487
|
-
let height;
|
|
488
|
-
let width;
|
|
489
|
-
if (options !== void 0 && options.resizedWidth !== void 0 && options.resizedHeight !== void 0) {
|
|
490
|
-
height = options.resizedHeight;
|
|
491
|
-
width = options.resizedWidth;
|
|
492
|
-
} else {
|
|
493
|
-
height = image.height;
|
|
494
|
-
width = image.width;
|
|
495
|
-
}
|
|
496
|
-
if (options !== void 0) {
|
|
497
|
-
bufferToTensorOptions = options;
|
|
498
|
-
}
|
|
499
|
-
bufferToTensorOptions.format = "RGBA";
|
|
500
|
-
bufferToTensorOptions.height = height;
|
|
501
|
-
bufferToTensorOptions.width = width;
|
|
502
|
-
if (options !== void 0) {
|
|
503
|
-
const tempCanvas = createCanvas();
|
|
504
|
-
tempCanvas.width = width;
|
|
505
|
-
tempCanvas.height = height;
|
|
506
|
-
const pixels2DContext = createCanvasContext(tempCanvas);
|
|
507
|
-
if (pixels2DContext != null) {
|
|
508
|
-
pixels2DContext.putImageData(image, 0, 0);
|
|
509
|
-
data = pixels2DContext.getImageData(0, 0, width, height).data;
|
|
510
|
-
} else {
|
|
511
|
-
throw new Error("Can not access image data");
|
|
512
|
-
}
|
|
513
|
-
} else {
|
|
514
|
-
data = image.data;
|
|
515
|
-
}
|
|
516
|
-
} else if (isImageBitmap) {
|
|
517
|
-
if (options === void 0) {
|
|
518
|
-
throw new Error("Please provide image config with format for Imagebitmap");
|
|
519
|
-
}
|
|
520
|
-
const canvas = createCanvas();
|
|
521
|
-
canvas.width = image.width;
|
|
522
|
-
canvas.height = image.height;
|
|
523
|
-
const pixels2DContext = createCanvasContext(canvas);
|
|
524
|
-
if (pixels2DContext != null) {
|
|
525
|
-
const height = image.height;
|
|
526
|
-
const width = image.width;
|
|
527
|
-
pixels2DContext.drawImage(image, 0, 0, width, height);
|
|
528
|
-
data = pixels2DContext.getImageData(0, 0, width, height).data;
|
|
529
|
-
bufferToTensorOptions.height = height;
|
|
530
|
-
bufferToTensorOptions.width = width;
|
|
531
|
-
return bufferToTensor(data, bufferToTensorOptions);
|
|
532
|
-
} else {
|
|
533
|
-
throw new Error("Can not access image data");
|
|
534
|
-
}
|
|
535
|
-
} else if (isString) {
|
|
536
|
-
return new Promise((resolve, reject) => {
|
|
537
|
-
const canvas = createCanvas();
|
|
538
|
-
const context = createCanvasContext(canvas);
|
|
539
|
-
if (!image || !context) {
|
|
540
|
-
return reject();
|
|
541
|
-
}
|
|
542
|
-
const newImage = new Image();
|
|
543
|
-
newImage.crossOrigin = "Anonymous";
|
|
544
|
-
newImage.src = image;
|
|
545
|
-
newImage.onload = () => {
|
|
546
|
-
canvas.width = newImage.width;
|
|
547
|
-
canvas.height = newImage.height;
|
|
548
|
-
context.drawImage(newImage, 0, 0, canvas.width, canvas.height);
|
|
549
|
-
const img = context.getImageData(0, 0, canvas.width, canvas.height);
|
|
550
|
-
bufferToTensorOptions.height = canvas.height;
|
|
551
|
-
bufferToTensorOptions.width = canvas.width;
|
|
552
|
-
resolve(bufferToTensor(img.data, bufferToTensorOptions));
|
|
553
|
-
};
|
|
554
|
-
});
|
|
555
|
-
} else {
|
|
556
|
-
throw new Error("Input data provided is not supported - aborted tensor creation");
|
|
557
|
-
}
|
|
558
|
-
if (data !== void 0) {
|
|
559
|
-
return bufferToTensor(data, bufferToTensorOptions);
|
|
560
|
-
} else {
|
|
561
|
-
throw new Error("Input data provided is not supported - aborted tensor creation");
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
tensorFromTexture = (texture, options) => {
|
|
565
|
-
const { width, height, download, dispose } = options;
|
|
566
|
-
const dims = [1, height, width, 4];
|
|
567
|
-
return new Tensor({ location: "texture", type: "float32", texture, dims, download, dispose });
|
|
568
|
-
};
|
|
569
|
-
tensorFromGpuBuffer = (gpuBuffer, options) => {
|
|
570
|
-
const { dataType, dims, download, dispose } = options;
|
|
571
|
-
return new Tensor({ location: "gpu-buffer", type: dataType ?? "float32", gpuBuffer, dims, download, dispose });
|
|
572
|
-
};
|
|
573
|
-
tensorFromMLTensor = (mlTensor, options) => {
|
|
574
|
-
const { dataType, dims, download, dispose } = options;
|
|
575
|
-
return new Tensor({ location: "ml-tensor", type: dataType ?? "float32", mlTensor, dims, download, dispose });
|
|
576
|
-
};
|
|
577
|
-
tensorFromPinnedBuffer = (type, buffer, dims) => new Tensor({ location: "cpu-pinned", type, data: buffer, dims: dims ?? [buffer.length] });
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-impl-type-mapping.js
|
|
582
|
-
var NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP, NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP, isTypedArrayChecked, checkTypedArray;
|
|
583
|
-
var init_tensor_impl_type_mapping = __esm({
|
|
584
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-impl-type-mapping.js"() {
|
|
585
|
-
"use strict";
|
|
586
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP = /* @__PURE__ */ new Map([
|
|
587
|
-
["float32", Float32Array],
|
|
588
|
-
["uint8", Uint8Array],
|
|
589
|
-
["int8", Int8Array],
|
|
590
|
-
["uint16", Uint16Array],
|
|
591
|
-
["int16", Int16Array],
|
|
592
|
-
["int32", Int32Array],
|
|
593
|
-
["bool", Uint8Array],
|
|
594
|
-
["float64", Float64Array],
|
|
595
|
-
["uint32", Uint32Array],
|
|
596
|
-
["int4", Uint8Array],
|
|
597
|
-
["uint4", Uint8Array]
|
|
598
|
-
]);
|
|
599
|
-
NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
600
|
-
[Float32Array, "float32"],
|
|
601
|
-
[Uint8Array, "uint8"],
|
|
602
|
-
[Int8Array, "int8"],
|
|
603
|
-
[Uint16Array, "uint16"],
|
|
604
|
-
[Int16Array, "int16"],
|
|
605
|
-
[Int32Array, "int32"],
|
|
606
|
-
[Float64Array, "float64"],
|
|
607
|
-
[Uint32Array, "uint32"]
|
|
608
|
-
]);
|
|
609
|
-
isTypedArrayChecked = false;
|
|
610
|
-
checkTypedArray = () => {
|
|
611
|
-
if (!isTypedArrayChecked) {
|
|
612
|
-
isTypedArrayChecked = true;
|
|
613
|
-
const isBigInt64ArrayAvailable = typeof BigInt64Array !== "undefined" && BigInt64Array.from;
|
|
614
|
-
const isBigUint64ArrayAvailable = typeof BigUint64Array !== "undefined" && BigUint64Array.from;
|
|
615
|
-
const Float16Array2 = globalThis.Float16Array;
|
|
616
|
-
const isFloat16ArrayAvailable = typeof Float16Array2 !== "undefined" && Float16Array2.from;
|
|
617
|
-
if (isBigInt64ArrayAvailable) {
|
|
618
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("int64", BigInt64Array);
|
|
619
|
-
NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array, "int64");
|
|
620
|
-
}
|
|
621
|
-
if (isBigUint64ArrayAvailable) {
|
|
622
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("uint64", BigUint64Array);
|
|
623
|
-
NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array, "uint64");
|
|
624
|
-
}
|
|
625
|
-
if (isFloat16ArrayAvailable) {
|
|
626
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("float16", Float16Array2);
|
|
627
|
-
NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(Float16Array2, "float16");
|
|
628
|
-
} else {
|
|
629
|
-
NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set("float16", Uint16Array);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-utils-impl.js
|
|
637
|
-
var calculateSize, tensorReshape;
|
|
638
|
-
var init_tensor_utils_impl = __esm({
|
|
639
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-utils-impl.js"() {
|
|
640
|
-
"use strict";
|
|
641
|
-
init_tensor_impl();
|
|
642
|
-
calculateSize = (dims) => {
|
|
643
|
-
let size = 1;
|
|
644
|
-
for (let i = 0; i < dims.length; i++) {
|
|
645
|
-
const dim = dims[i];
|
|
646
|
-
if (typeof dim !== "number" || !Number.isSafeInteger(dim)) {
|
|
647
|
-
throw new TypeError(`dims[${i}] must be an integer, got: ${dim}`);
|
|
648
|
-
}
|
|
649
|
-
if (dim < 0) {
|
|
650
|
-
throw new RangeError(`dims[${i}] must be a non-negative integer, got: ${dim}`);
|
|
651
|
-
}
|
|
652
|
-
size *= dim;
|
|
653
|
-
}
|
|
654
|
-
return size;
|
|
655
|
-
};
|
|
656
|
-
tensorReshape = (tensor, dims) => {
|
|
657
|
-
switch (tensor.location) {
|
|
658
|
-
case "cpu":
|
|
659
|
-
return new Tensor(tensor.type, tensor.data, dims);
|
|
660
|
-
case "cpu-pinned":
|
|
661
|
-
return new Tensor({
|
|
662
|
-
location: "cpu-pinned",
|
|
663
|
-
data: tensor.data,
|
|
664
|
-
type: tensor.type,
|
|
665
|
-
dims
|
|
666
|
-
});
|
|
667
|
-
case "texture":
|
|
668
|
-
return new Tensor({
|
|
669
|
-
location: "texture",
|
|
670
|
-
texture: tensor.texture,
|
|
671
|
-
type: tensor.type,
|
|
672
|
-
dims
|
|
673
|
-
});
|
|
674
|
-
case "gpu-buffer":
|
|
675
|
-
return new Tensor({
|
|
676
|
-
location: "gpu-buffer",
|
|
677
|
-
gpuBuffer: tensor.gpuBuffer,
|
|
678
|
-
type: tensor.type,
|
|
679
|
-
dims
|
|
680
|
-
});
|
|
681
|
-
case "ml-tensor":
|
|
682
|
-
return new Tensor({
|
|
683
|
-
location: "ml-tensor",
|
|
684
|
-
mlTensor: tensor.mlTensor,
|
|
685
|
-
type: tensor.type,
|
|
686
|
-
dims
|
|
687
|
-
});
|
|
688
|
-
default:
|
|
689
|
-
throw new Error(`tensorReshape: tensor location ${tensor.location} is not supported`);
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-impl.js
|
|
696
|
-
var Tensor;
|
|
697
|
-
var init_tensor_impl = __esm({
|
|
698
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-impl.js"() {
|
|
699
|
-
"use strict";
|
|
700
|
-
init_tensor_conversion_impl();
|
|
701
|
-
init_tensor_factory_impl();
|
|
702
|
-
init_tensor_impl_type_mapping();
|
|
703
|
-
init_tensor_utils_impl();
|
|
704
|
-
Tensor = class {
|
|
705
|
-
/**
|
|
706
|
-
* implementation.
|
|
707
|
-
*/
|
|
708
|
-
constructor(arg0, arg1, arg2) {
|
|
709
|
-
checkTypedArray();
|
|
710
|
-
let type;
|
|
711
|
-
let dims;
|
|
712
|
-
if (typeof arg0 === "object" && "location" in arg0) {
|
|
713
|
-
this.dataLocation = arg0.location;
|
|
714
|
-
type = arg0.type;
|
|
715
|
-
dims = arg0.dims;
|
|
716
|
-
switch (arg0.location) {
|
|
717
|
-
case "cpu-pinned": {
|
|
718
|
-
const expectedTypedArrayConstructor = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(type);
|
|
719
|
-
if (!expectedTypedArrayConstructor) {
|
|
720
|
-
throw new TypeError(`unsupported type "${type}" to create tensor from pinned buffer`);
|
|
721
|
-
}
|
|
722
|
-
if (!(arg0.data instanceof expectedTypedArrayConstructor)) {
|
|
723
|
-
throw new TypeError(`buffer should be of type ${expectedTypedArrayConstructor.name}`);
|
|
724
|
-
}
|
|
725
|
-
this.cpuData = arg0.data;
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
728
|
-
case "texture": {
|
|
729
|
-
if (type !== "float32") {
|
|
730
|
-
throw new TypeError(`unsupported type "${type}" to create tensor from texture`);
|
|
731
|
-
}
|
|
732
|
-
this.gpuTextureData = arg0.texture;
|
|
733
|
-
this.downloader = arg0.download;
|
|
734
|
-
this.disposer = arg0.dispose;
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
case "gpu-buffer": {
|
|
738
|
-
if (type !== "float32" && type !== "float16" && type !== "int32" && type !== "int64" && type !== "uint32" && type !== "uint8" && type !== "bool" && type !== "uint4" && type !== "int4") {
|
|
739
|
-
throw new TypeError(`unsupported type "${type}" to create tensor from gpu buffer`);
|
|
740
|
-
}
|
|
741
|
-
this.gpuBufferData = arg0.gpuBuffer;
|
|
742
|
-
this.downloader = arg0.download;
|
|
743
|
-
this.disposer = arg0.dispose;
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
case "ml-tensor": {
|
|
747
|
-
if (type !== "float32" && type !== "float16" && type !== "int32" && type !== "int64" && type !== "uint32" && type !== "uint64" && type !== "int8" && type !== "uint8" && type !== "bool" && type !== "uint4" && type !== "int4") {
|
|
748
|
-
throw new TypeError(`unsupported type "${type}" to create tensor from MLTensor`);
|
|
749
|
-
}
|
|
750
|
-
this.mlTensorData = arg0.mlTensor;
|
|
751
|
-
this.downloader = arg0.download;
|
|
752
|
-
this.disposer = arg0.dispose;
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
default:
|
|
756
|
-
throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`);
|
|
757
|
-
}
|
|
758
|
-
} else {
|
|
759
|
-
let data;
|
|
760
|
-
let maybeDims;
|
|
761
|
-
if (typeof arg0 === "string") {
|
|
762
|
-
type = arg0;
|
|
763
|
-
maybeDims = arg2;
|
|
764
|
-
if (arg0 === "string") {
|
|
765
|
-
if (!Array.isArray(arg1)) {
|
|
766
|
-
throw new TypeError("A string tensor's data must be a string array.");
|
|
767
|
-
}
|
|
768
|
-
data = arg1;
|
|
769
|
-
} else {
|
|
770
|
-
const typedArrayConstructor = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(arg0);
|
|
771
|
-
if (typedArrayConstructor === void 0) {
|
|
772
|
-
throw new TypeError(`Unsupported tensor type: ${arg0}.`);
|
|
773
|
-
}
|
|
774
|
-
if (Array.isArray(arg1)) {
|
|
775
|
-
if (arg0 === "float16" && typedArrayConstructor === Uint16Array || arg0 === "uint4" || arg0 === "int4") {
|
|
776
|
-
throw new TypeError(`Creating a ${arg0} tensor from number array is not supported. Please use ${typedArrayConstructor.name} as data.`);
|
|
777
|
-
} else if (arg0 === "uint64" || arg0 === "int64") {
|
|
778
|
-
data = typedArrayConstructor.from(arg1, BigInt);
|
|
779
|
-
} else {
|
|
780
|
-
data = typedArrayConstructor.from(arg1);
|
|
781
|
-
}
|
|
782
|
-
} else if (arg1 instanceof typedArrayConstructor) {
|
|
783
|
-
data = arg1;
|
|
784
|
-
} else if (arg1 instanceof Uint8ClampedArray) {
|
|
785
|
-
if (arg0 === "uint8") {
|
|
786
|
-
data = Uint8Array.from(arg1);
|
|
787
|
-
} else {
|
|
788
|
-
throw new TypeError(`A Uint8ClampedArray tensor's data must be type of uint8`);
|
|
789
|
-
}
|
|
790
|
-
} else if (arg0 === "float16" && arg1 instanceof Uint16Array && typedArrayConstructor !== Uint16Array) {
|
|
791
|
-
data = new globalThis.Float16Array(arg1.buffer, arg1.byteOffset, arg1.length);
|
|
792
|
-
} else {
|
|
793
|
-
throw new TypeError(`A ${type} tensor's data must be type of ${typedArrayConstructor}`);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
} else {
|
|
797
|
-
maybeDims = arg1;
|
|
798
|
-
if (Array.isArray(arg0)) {
|
|
799
|
-
if (arg0.length === 0) {
|
|
800
|
-
throw new TypeError("Tensor type cannot be inferred from an empty array.");
|
|
801
|
-
}
|
|
802
|
-
const firstElementType = typeof arg0[0];
|
|
803
|
-
if (firstElementType === "string") {
|
|
804
|
-
type = "string";
|
|
805
|
-
data = arg0;
|
|
806
|
-
} else if (firstElementType === "boolean") {
|
|
807
|
-
type = "bool";
|
|
808
|
-
data = Uint8Array.from(arg0);
|
|
809
|
-
} else {
|
|
810
|
-
throw new TypeError(`Invalid element type of data array: ${firstElementType}.`);
|
|
811
|
-
}
|
|
812
|
-
} else if (arg0 instanceof Uint8ClampedArray) {
|
|
813
|
-
type = "uint8";
|
|
814
|
-
data = Uint8Array.from(arg0);
|
|
815
|
-
} else {
|
|
816
|
-
const mappedType = NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(arg0.constructor);
|
|
817
|
-
if (mappedType === void 0) {
|
|
818
|
-
throw new TypeError(`Unsupported type for tensor data: ${arg0.constructor}.`);
|
|
819
|
-
}
|
|
820
|
-
type = mappedType;
|
|
821
|
-
data = arg0;
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
if (maybeDims === void 0) {
|
|
825
|
-
maybeDims = [data.length];
|
|
826
|
-
} else if (!Array.isArray(maybeDims)) {
|
|
827
|
-
throw new TypeError("A tensor's dims must be a number array");
|
|
828
|
-
}
|
|
829
|
-
dims = maybeDims;
|
|
830
|
-
this.cpuData = data;
|
|
831
|
-
this.dataLocation = "cpu";
|
|
832
|
-
}
|
|
833
|
-
const size = calculateSize(dims);
|
|
834
|
-
if (this.cpuData && size !== this.cpuData.length) {
|
|
835
|
-
if ((type === "uint4" || type === "int4") && Math.ceil(size / 2) === this.cpuData.length) {
|
|
836
|
-
} else {
|
|
837
|
-
throw new Error(`Tensor's size(${size}) does not match data length(${this.cpuData.length}).`);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
this.type = type;
|
|
841
|
-
this.dims = dims;
|
|
842
|
-
this.size = size;
|
|
843
|
-
}
|
|
844
|
-
// #endregion
|
|
845
|
-
// #region factory
|
|
846
|
-
static async fromImage(image, options) {
|
|
847
|
-
return tensorFromImage(image, options);
|
|
848
|
-
}
|
|
849
|
-
static fromTexture(texture, options) {
|
|
850
|
-
return tensorFromTexture(texture, options);
|
|
851
|
-
}
|
|
852
|
-
static fromGpuBuffer(gpuBuffer, options) {
|
|
853
|
-
return tensorFromGpuBuffer(gpuBuffer, options);
|
|
854
|
-
}
|
|
855
|
-
static fromMLTensor(mlTensor, options) {
|
|
856
|
-
return tensorFromMLTensor(mlTensor, options);
|
|
857
|
-
}
|
|
858
|
-
static fromPinnedBuffer(type, buffer, dims) {
|
|
859
|
-
return tensorFromPinnedBuffer(type, buffer, dims);
|
|
860
|
-
}
|
|
861
|
-
// #endregion
|
|
862
|
-
// #region conversions
|
|
863
|
-
toDataURL(options) {
|
|
864
|
-
return tensorToDataURL(this, options);
|
|
865
|
-
}
|
|
866
|
-
toImageData(options) {
|
|
867
|
-
return tensorToImageData(this, options);
|
|
868
|
-
}
|
|
869
|
-
// #endregion
|
|
870
|
-
// #region properties
|
|
871
|
-
get data() {
|
|
872
|
-
this.ensureValid();
|
|
873
|
-
if (!this.cpuData) {
|
|
874
|
-
throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");
|
|
875
|
-
}
|
|
876
|
-
return this.cpuData;
|
|
877
|
-
}
|
|
878
|
-
get location() {
|
|
879
|
-
return this.dataLocation;
|
|
880
|
-
}
|
|
881
|
-
get texture() {
|
|
882
|
-
this.ensureValid();
|
|
883
|
-
if (!this.gpuTextureData) {
|
|
884
|
-
throw new Error("The data is not stored as a WebGL texture.");
|
|
885
|
-
}
|
|
886
|
-
return this.gpuTextureData;
|
|
887
|
-
}
|
|
888
|
-
get gpuBuffer() {
|
|
889
|
-
this.ensureValid();
|
|
890
|
-
if (!this.gpuBufferData) {
|
|
891
|
-
throw new Error("The data is not stored as a WebGPU buffer.");
|
|
892
|
-
}
|
|
893
|
-
return this.gpuBufferData;
|
|
894
|
-
}
|
|
895
|
-
get mlTensor() {
|
|
896
|
-
this.ensureValid();
|
|
897
|
-
if (!this.mlTensorData) {
|
|
898
|
-
throw new Error("The data is not stored as a WebNN MLTensor.");
|
|
899
|
-
}
|
|
900
|
-
return this.mlTensorData;
|
|
901
|
-
}
|
|
902
|
-
// #endregion
|
|
903
|
-
// #region methods
|
|
904
|
-
async getData(releaseData) {
|
|
905
|
-
this.ensureValid();
|
|
906
|
-
switch (this.dataLocation) {
|
|
907
|
-
case "cpu":
|
|
908
|
-
case "cpu-pinned":
|
|
909
|
-
return this.data;
|
|
910
|
-
case "texture":
|
|
911
|
-
case "gpu-buffer":
|
|
912
|
-
case "ml-tensor": {
|
|
913
|
-
if (!this.downloader) {
|
|
914
|
-
throw new Error("The current tensor is not created with a specified data downloader.");
|
|
915
|
-
}
|
|
916
|
-
if (this.isDownloading) {
|
|
917
|
-
throw new Error("The current tensor is being downloaded.");
|
|
918
|
-
}
|
|
919
|
-
try {
|
|
920
|
-
this.isDownloading = true;
|
|
921
|
-
const data = await this.downloader();
|
|
922
|
-
this.downloader = void 0;
|
|
923
|
-
this.dataLocation = "cpu";
|
|
924
|
-
this.cpuData = data;
|
|
925
|
-
if (releaseData && this.disposer) {
|
|
926
|
-
this.disposer();
|
|
927
|
-
this.disposer = void 0;
|
|
928
|
-
}
|
|
929
|
-
return data;
|
|
930
|
-
} finally {
|
|
931
|
-
this.isDownloading = false;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
default:
|
|
935
|
-
throw new Error(`cannot get data from location: ${this.dataLocation}`);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
dispose() {
|
|
939
|
-
if (this.isDownloading) {
|
|
940
|
-
throw new Error("The current tensor is being downloaded.");
|
|
941
|
-
}
|
|
942
|
-
if (this.disposer) {
|
|
943
|
-
this.disposer();
|
|
944
|
-
this.disposer = void 0;
|
|
945
|
-
}
|
|
946
|
-
this.cpuData = void 0;
|
|
947
|
-
this.gpuTextureData = void 0;
|
|
948
|
-
this.gpuBufferData = void 0;
|
|
949
|
-
this.mlTensorData = void 0;
|
|
950
|
-
this.downloader = void 0;
|
|
951
|
-
this.isDownloading = void 0;
|
|
952
|
-
this.dataLocation = "none";
|
|
953
|
-
}
|
|
954
|
-
// #endregion
|
|
955
|
-
// #region tensor utilities
|
|
956
|
-
ensureValid() {
|
|
957
|
-
if (this.dataLocation === "none") {
|
|
958
|
-
throw new Error("The tensor is disposed.");
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
reshape(dims) {
|
|
962
|
-
this.ensureValid();
|
|
963
|
-
if (this.downloader || this.disposer) {
|
|
964
|
-
throw new Error("Cannot reshape a tensor that owns GPU resource.");
|
|
965
|
-
}
|
|
966
|
-
return tensorReshape(this, dims);
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
|
|
972
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor.js
|
|
973
|
-
var Tensor2;
|
|
974
|
-
var init_tensor = __esm({
|
|
975
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor.js"() {
|
|
976
|
-
"use strict";
|
|
977
|
-
init_tensor_impl();
|
|
978
|
-
Tensor2 = Tensor;
|
|
979
|
-
}
|
|
980
|
-
});
|
|
981
|
-
|
|
982
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/trace.js
|
|
983
|
-
var TRACE, TRACE_FUNC, TRACE_FUNC_BEGIN, TRACE_FUNC_END;
|
|
984
|
-
var init_trace = __esm({
|
|
985
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/trace.js"() {
|
|
986
|
-
"use strict";
|
|
987
|
-
init_env_impl();
|
|
988
|
-
TRACE = (deviceType, label) => {
|
|
989
|
-
if (typeof env.trace === "undefined" ? !env.wasm.trace : !env.trace) {
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
console.timeStamp(`${deviceType}::ORT::${label}`);
|
|
993
|
-
};
|
|
994
|
-
TRACE_FUNC = (msg, extraMsg) => {
|
|
995
|
-
const stack = new Error().stack?.split(/\r\n|\r|\n/g) || [];
|
|
996
|
-
let hasTraceFunc = false;
|
|
997
|
-
for (let i = 0; i < stack.length; i++) {
|
|
998
|
-
if (hasTraceFunc && !stack[i].includes("TRACE_FUNC")) {
|
|
999
|
-
let label = `FUNC_${msg}::${stack[i].trim().split(" ")[1]}`;
|
|
1000
|
-
if (extraMsg) {
|
|
1001
|
-
label += `::${extraMsg}`;
|
|
1002
|
-
}
|
|
1003
|
-
TRACE("CPU", label);
|
|
1004
|
-
return;
|
|
1005
|
-
}
|
|
1006
|
-
if (stack[i].includes("TRACE_FUNC")) {
|
|
1007
|
-
hasTraceFunc = true;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
};
|
|
1011
|
-
TRACE_FUNC_BEGIN = (extraMsg) => {
|
|
1012
|
-
if (typeof env.trace === "undefined" ? !env.wasm.trace : !env.trace) {
|
|
1013
|
-
return;
|
|
1014
|
-
}
|
|
1015
|
-
TRACE_FUNC("BEGIN", extraMsg);
|
|
1016
|
-
};
|
|
1017
|
-
TRACE_FUNC_END = (extraMsg) => {
|
|
1018
|
-
if (typeof env.trace === "undefined" ? !env.wasm.trace : !env.trace) {
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
TRACE_FUNC("END", extraMsg);
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/inference-session-impl.js
|
|
1027
|
-
var InferenceSession;
|
|
1028
|
-
var init_inference_session_impl = __esm({
|
|
1029
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/inference-session-impl.js"() {
|
|
1030
|
-
"use strict";
|
|
1031
|
-
init_backend_impl();
|
|
1032
|
-
init_tensor();
|
|
1033
|
-
init_trace();
|
|
1034
|
-
InferenceSession = class _InferenceSession {
|
|
1035
|
-
constructor(handler) {
|
|
1036
|
-
this.handler = handler;
|
|
1037
|
-
}
|
|
1038
|
-
async run(feeds, arg1, arg2) {
|
|
1039
|
-
TRACE_FUNC_BEGIN();
|
|
1040
|
-
const fetches = {};
|
|
1041
|
-
let options = {};
|
|
1042
|
-
if (typeof feeds !== "object" || feeds === null || feeds instanceof Tensor2 || Array.isArray(feeds)) {
|
|
1043
|
-
throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");
|
|
1044
|
-
}
|
|
1045
|
-
let isFetchesEmpty = true;
|
|
1046
|
-
if (typeof arg1 === "object") {
|
|
1047
|
-
if (arg1 === null) {
|
|
1048
|
-
throw new TypeError("Unexpected argument[1]: cannot be null.");
|
|
1049
|
-
}
|
|
1050
|
-
if (arg1 instanceof Tensor2) {
|
|
1051
|
-
throw new TypeError("'fetches' cannot be a Tensor");
|
|
1052
|
-
}
|
|
1053
|
-
if (Array.isArray(arg1)) {
|
|
1054
|
-
if (arg1.length === 0) {
|
|
1055
|
-
throw new TypeError("'fetches' cannot be an empty array.");
|
|
1056
|
-
}
|
|
1057
|
-
isFetchesEmpty = false;
|
|
1058
|
-
for (const name of arg1) {
|
|
1059
|
-
if (typeof name !== "string") {
|
|
1060
|
-
throw new TypeError("'fetches' must be a string array or an object.");
|
|
1061
|
-
}
|
|
1062
|
-
if (this.outputNames.indexOf(name) === -1) {
|
|
1063
|
-
throw new RangeError(`'fetches' contains invalid output name: ${name}.`);
|
|
1064
|
-
}
|
|
1065
|
-
fetches[name] = null;
|
|
1066
|
-
}
|
|
1067
|
-
if (typeof arg2 === "object" && arg2 !== null) {
|
|
1068
|
-
options = arg2;
|
|
1069
|
-
} else if (typeof arg2 !== "undefined") {
|
|
1070
|
-
throw new TypeError("'options' must be an object.");
|
|
1071
|
-
}
|
|
1072
|
-
} else {
|
|
1073
|
-
let isFetches = false;
|
|
1074
|
-
const arg1Keys = Object.getOwnPropertyNames(arg1);
|
|
1075
|
-
for (const name of this.outputNames) {
|
|
1076
|
-
if (arg1Keys.indexOf(name) !== -1) {
|
|
1077
|
-
const v = arg1[name];
|
|
1078
|
-
if (v === null || v instanceof Tensor2) {
|
|
1079
|
-
isFetches = true;
|
|
1080
|
-
isFetchesEmpty = false;
|
|
1081
|
-
fetches[name] = v;
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
if (isFetches) {
|
|
1086
|
-
if (typeof arg2 === "object" && arg2 !== null) {
|
|
1087
|
-
options = arg2;
|
|
1088
|
-
} else if (typeof arg2 !== "undefined") {
|
|
1089
|
-
throw new TypeError("'options' must be an object.");
|
|
1090
|
-
}
|
|
1091
|
-
} else {
|
|
1092
|
-
options = arg1;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
} else if (typeof arg1 !== "undefined") {
|
|
1096
|
-
throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");
|
|
1097
|
-
}
|
|
1098
|
-
for (const name of this.inputNames) {
|
|
1099
|
-
if (typeof feeds[name] === "undefined") {
|
|
1100
|
-
throw new Error(`input '${name}' is missing in 'feeds'.`);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
if (isFetchesEmpty) {
|
|
1104
|
-
for (const name of this.outputNames) {
|
|
1105
|
-
fetches[name] = null;
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
const results = await this.handler.run(feeds, fetches, options);
|
|
1109
|
-
const returnValue = {};
|
|
1110
|
-
for (const key in results) {
|
|
1111
|
-
if (Object.hasOwnProperty.call(results, key)) {
|
|
1112
|
-
const result = results[key];
|
|
1113
|
-
if (result instanceof Tensor2) {
|
|
1114
|
-
returnValue[key] = result;
|
|
1115
|
-
} else {
|
|
1116
|
-
returnValue[key] = new Tensor2(result.type, result.data, result.dims);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
TRACE_FUNC_END();
|
|
1121
|
-
return returnValue;
|
|
1122
|
-
}
|
|
1123
|
-
async release() {
|
|
1124
|
-
return this.handler.dispose();
|
|
1125
|
-
}
|
|
1126
|
-
static async create(arg0, arg1, arg2, arg3) {
|
|
1127
|
-
TRACE_FUNC_BEGIN();
|
|
1128
|
-
let filePathOrUint8Array;
|
|
1129
|
-
let options = {};
|
|
1130
|
-
if (typeof arg0 === "string") {
|
|
1131
|
-
filePathOrUint8Array = arg0;
|
|
1132
|
-
if (typeof arg1 === "object" && arg1 !== null) {
|
|
1133
|
-
options = arg1;
|
|
1134
|
-
} else if (typeof arg1 !== "undefined") {
|
|
1135
|
-
throw new TypeError("'options' must be an object.");
|
|
1136
|
-
}
|
|
1137
|
-
} else if (arg0 instanceof Uint8Array) {
|
|
1138
|
-
filePathOrUint8Array = arg0;
|
|
1139
|
-
if (typeof arg1 === "object" && arg1 !== null) {
|
|
1140
|
-
options = arg1;
|
|
1141
|
-
} else if (typeof arg1 !== "undefined") {
|
|
1142
|
-
throw new TypeError("'options' must be an object.");
|
|
1143
|
-
}
|
|
1144
|
-
} else if (arg0 instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && arg0 instanceof SharedArrayBuffer) {
|
|
1145
|
-
const buffer = arg0;
|
|
1146
|
-
let byteOffset = 0;
|
|
1147
|
-
let byteLength = arg0.byteLength;
|
|
1148
|
-
if (typeof arg1 === "object" && arg1 !== null) {
|
|
1149
|
-
options = arg1;
|
|
1150
|
-
} else if (typeof arg1 === "number") {
|
|
1151
|
-
byteOffset = arg1;
|
|
1152
|
-
if (!Number.isSafeInteger(byteOffset)) {
|
|
1153
|
-
throw new RangeError("'byteOffset' must be an integer.");
|
|
1154
|
-
}
|
|
1155
|
-
if (byteOffset < 0 || byteOffset >= buffer.byteLength) {
|
|
1156
|
-
throw new RangeError(`'byteOffset' is out of range [0, ${buffer.byteLength}).`);
|
|
1157
|
-
}
|
|
1158
|
-
byteLength = arg0.byteLength - byteOffset;
|
|
1159
|
-
if (typeof arg2 === "number") {
|
|
1160
|
-
byteLength = arg2;
|
|
1161
|
-
if (!Number.isSafeInteger(byteLength)) {
|
|
1162
|
-
throw new RangeError("'byteLength' must be an integer.");
|
|
1163
|
-
}
|
|
1164
|
-
if (byteLength <= 0 || byteOffset + byteLength > buffer.byteLength) {
|
|
1165
|
-
throw new RangeError(`'byteLength' is out of range (0, ${buffer.byteLength - byteOffset}].`);
|
|
1166
|
-
}
|
|
1167
|
-
if (typeof arg3 === "object" && arg3 !== null) {
|
|
1168
|
-
options = arg3;
|
|
1169
|
-
} else if (typeof arg3 !== "undefined") {
|
|
1170
|
-
throw new TypeError("'options' must be an object.");
|
|
1171
|
-
}
|
|
1172
|
-
} else if (typeof arg2 !== "undefined") {
|
|
1173
|
-
throw new TypeError("'byteLength' must be a number.");
|
|
1174
|
-
}
|
|
1175
|
-
} else if (typeof arg1 !== "undefined") {
|
|
1176
|
-
throw new TypeError("'options' must be an object.");
|
|
1177
|
-
}
|
|
1178
|
-
filePathOrUint8Array = new Uint8Array(buffer, byteOffset, byteLength);
|
|
1179
|
-
} else {
|
|
1180
|
-
throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");
|
|
1181
|
-
}
|
|
1182
|
-
const [backend, optionsWithValidatedEPs] = await resolveBackendAndExecutionProviders(options);
|
|
1183
|
-
const handler = await backend.createInferenceSessionHandler(filePathOrUint8Array, optionsWithValidatedEPs);
|
|
1184
|
-
TRACE_FUNC_END();
|
|
1185
|
-
return new _InferenceSession(handler);
|
|
1186
|
-
}
|
|
1187
|
-
startProfiling() {
|
|
1188
|
-
this.handler.startProfiling();
|
|
1189
|
-
}
|
|
1190
|
-
endProfiling() {
|
|
1191
|
-
this.handler.endProfiling();
|
|
1192
|
-
}
|
|
1193
|
-
get inputNames() {
|
|
1194
|
-
return this.handler.inputNames;
|
|
1195
|
-
}
|
|
1196
|
-
get outputNames() {
|
|
1197
|
-
return this.handler.outputNames;
|
|
1198
|
-
}
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
});
|
|
1202
|
-
|
|
1203
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/inference-session.js
|
|
1204
|
-
var InferenceSession2;
|
|
1205
|
-
var init_inference_session = __esm({
|
|
1206
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/inference-session.js"() {
|
|
1207
|
-
"use strict";
|
|
1208
|
-
init_inference_session_impl();
|
|
1209
|
-
InferenceSession2 = InferenceSession;
|
|
1210
|
-
}
|
|
1211
|
-
});
|
|
1212
|
-
|
|
1213
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-conversion.js
|
|
1214
|
-
var init_tensor_conversion = __esm({
|
|
1215
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-conversion.js"() {
|
|
1216
|
-
"use strict";
|
|
1217
|
-
}
|
|
1218
|
-
});
|
|
1219
|
-
|
|
1220
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-factory.js
|
|
1221
|
-
var init_tensor_factory = __esm({
|
|
1222
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/tensor-factory.js"() {
|
|
1223
|
-
"use strict";
|
|
1224
|
-
}
|
|
1225
|
-
});
|
|
1226
|
-
|
|
1227
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/onnx-model.js
|
|
1228
|
-
var init_onnx_model = __esm({
|
|
1229
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/onnx-model.js"() {
|
|
1230
|
-
"use strict";
|
|
1231
|
-
}
|
|
1232
|
-
});
|
|
1233
|
-
|
|
1234
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/onnx-value.js
|
|
1235
|
-
var init_onnx_value = __esm({
|
|
1236
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/onnx-value.js"() {
|
|
1237
|
-
"use strict";
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
|
|
1241
|
-
// node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/index.js
|
|
1242
|
-
var esm_exports = {};
|
|
1243
|
-
__export(esm_exports, {
|
|
1244
|
-
InferenceSession: () => InferenceSession2,
|
|
1245
|
-
TRACE: () => TRACE,
|
|
1246
|
-
TRACE_FUNC_BEGIN: () => TRACE_FUNC_BEGIN,
|
|
1247
|
-
TRACE_FUNC_END: () => TRACE_FUNC_END,
|
|
1248
|
-
Tensor: () => Tensor2,
|
|
1249
|
-
env: () => env2,
|
|
1250
|
-
registerBackend: () => registerBackend
|
|
1251
|
-
});
|
|
1252
|
-
var init_esm = __esm({
|
|
1253
|
-
"node_modules/@huggingface/transformers/node_modules/onnxruntime-common/dist/esm/index.js"() {
|
|
1254
|
-
"use strict";
|
|
1255
|
-
init_backend();
|
|
1256
|
-
init_env();
|
|
1257
|
-
init_inference_session();
|
|
1258
|
-
init_tensor();
|
|
1259
|
-
init_tensor_conversion();
|
|
1260
|
-
init_tensor_factory();
|
|
1261
|
-
init_trace();
|
|
1262
|
-
init_onnx_model();
|
|
1263
|
-
init_onnx_value();
|
|
1264
|
-
}
|
|
1265
|
-
});
|
|
1266
|
-
|
|
1267
35
|
// node_modules/@huggingface/transformers/dist/transformers.web.js
|
|
1268
36
|
var transformers_web_exports = {};
|
|
1269
37
|
__export(transformers_web_exports, {
|
|
@@ -2141,11 +909,11 @@ function __webpack_require__(moduleId) {
|
|
|
2141
909
|
__webpack_modules__[moduleId](module2, module2.exports, __webpack_require__);
|
|
2142
910
|
return module2.exports;
|
|
2143
911
|
}
|
|
2144
|
-
var __WEBPACK_EXTERNAL_MODULE_onnxruntime_web_74d14b94__, import_meta, __webpack_modules__, __webpack_module_cache__, __webpack_exports__, __webpack_exports__ASTFeatureExtractor, __webpack_exports__ASTForAudioClassification, __webpack_exports__ASTModel, __webpack_exports__ASTPreTrainedModel, __webpack_exports__AlbertForMaskedLM, __webpack_exports__AlbertForQuestionAnswering, __webpack_exports__AlbertForSequenceClassification, __webpack_exports__AlbertModel, __webpack_exports__AlbertPreTrainedModel, __webpack_exports__AlbertTokenizer, __webpack_exports__ArceeForCausalLM, __webpack_exports__ArceeModel, __webpack_exports__ArceePreTrainedModel, __webpack_exports__AudioClassificationPipeline, __webpack_exports__AutoConfig, __webpack_exports__AutoFeatureExtractor, __webpack_exports__AutoImageProcessor, __webpack_exports__AutoModel, __webpack_exports__AutoModelForAudioClassification, __webpack_exports__AutoModelForAudioFrameClassification, __webpack_exports__AutoModelForAudioTextToText, __webpack_exports__AutoModelForCTC, __webpack_exports__AutoModelForCausalLM, __webpack_exports__AutoModelForDepthEstimation, __webpack_exports__AutoModelForDocumentQuestionAnswering, __webpack_exports__AutoModelForImageClassification, __webpack_exports__AutoModelForImageFeatureExtraction, __webpack_exports__AutoModelForImageMatting, __webpack_exports__AutoModelForImageSegmentation, __webpack_exports__AutoModelForImageTextToText, __webpack_exports__AutoModelForImageToImage, __webpack_exports__AutoModelForMaskGeneration, __webpack_exports__AutoModelForMaskedLM, __webpack_exports__AutoModelForNormalEstimation, __webpack_exports__AutoModelForObjectDetection, __webpack_exports__AutoModelForPoseEstimation, __webpack_exports__AutoModelForQuestionAnswering, __webpack_exports__AutoModelForSemanticSegmentation, __webpack_exports__AutoModelForSeq2SeqLM, __webpack_exports__AutoModelForSequenceClassification, __webpack_exports__AutoModelForSpeechSeq2Seq, __webpack_exports__AutoModelForTextToSpectrogram, __webpack_exports__AutoModelForTextToWaveform, __webpack_exports__AutoModelForTokenClassification, __webpack_exports__AutoModelForUniversalSegmentation, __webpack_exports__AutoModelForVision2Seq, __webpack_exports__AutoModelForXVector, __webpack_exports__AutoModelForZeroShotObjectDetection, __webpack_exports__AutoProcessor, __webpack_exports__AutoTokenizer, __webpack_exports__AutomaticSpeechRecognitionPipeline, __webpack_exports__BackgroundRemovalPipeline, __webpack_exports__BartForConditionalGeneration, __webpack_exports__BartForSequenceClassification, __webpack_exports__BartModel, __webpack_exports__BartPretrainedModel, __webpack_exports__BartTokenizer, __webpack_exports__BaseModelOutput, __webpack_exports__BaseStreamer, __webpack_exports__BeitFeatureExtractor, __webpack_exports__BeitForImageClassification, __webpack_exports__BeitModel, __webpack_exports__BeitPreTrainedModel, __webpack_exports__BertForMaskedLM, __webpack_exports__BertForQuestionAnswering, __webpack_exports__BertForSequenceClassification, __webpack_exports__BertForTokenClassification, __webpack_exports__BertModel, __webpack_exports__BertPreTrainedModel, __webpack_exports__BertTokenizer, __webpack_exports__BitImageProcessor, __webpack_exports__BlenderbotForConditionalGeneration, __webpack_exports__BlenderbotModel, __webpack_exports__BlenderbotPreTrainedModel, __webpack_exports__BlenderbotSmallForConditionalGeneration, __webpack_exports__BlenderbotSmallModel, __webpack_exports__BlenderbotSmallPreTrainedModel, __webpack_exports__BlenderbotSmallTokenizer, __webpack_exports__BlenderbotTokenizer, __webpack_exports__BloomForCausalLM, __webpack_exports__BloomModel, __webpack_exports__BloomPreTrainedModel, __webpack_exports__BloomTokenizer, __webpack_exports__CLIPFeatureExtractor, __webpack_exports__CLIPImageProcessor, __webpack_exports__CLIPModel, __webpack_exports__CLIPPreTrainedModel, __webpack_exports__CLIPSegForImageSegmentation, __webpack_exports__CLIPSegModel, __webpack_exports__CLIPSegPreTrainedModel, __webpack_exports__CLIPTextModel, __webpack_exports__CLIPTextModelWithProjection, __webpack_exports__CLIPTokenizer, __webpack_exports__CLIPVisionModel, __webpack_exports__CLIPVisionModelWithProjection, __webpack_exports__CamembertForMaskedLM, __webpack_exports__CamembertForQuestionAnswering, __webpack_exports__CamembertForSequenceClassification, __webpack_exports__CamembertForTokenClassification, __webpack_exports__CamembertModel, __webpack_exports__CamembertPreTrainedModel, __webpack_exports__CamembertTokenizer, __webpack_exports__CausalLMOutput, __webpack_exports__CausalLMOutputWithPast, __webpack_exports__ChineseCLIPFeatureExtractor, __webpack_exports__ChineseCLIPModel, __webpack_exports__ChineseCLIPPreTrainedModel, __webpack_exports__ClapAudioModelWithProjection, __webpack_exports__ClapFeatureExtractor, __webpack_exports__ClapModel, __webpack_exports__ClapPreTrainedModel, __webpack_exports__ClapTextModelWithProjection, __webpack_exports__ClassifierFreeGuidanceLogitsProcessor, __webpack_exports__CodeGenForCausalLM, __webpack_exports__CodeGenModel, __webpack_exports__CodeGenPreTrainedModel, __webpack_exports__CodeGenTokenizer, __webpack_exports__CodeLlamaTokenizer, __webpack_exports__CohereForCausalLM, __webpack_exports__CohereModel, __webpack_exports__CoherePreTrainedModel, __webpack_exports__CohereTokenizer, __webpack_exports__ConvBertForMaskedLM, __webpack_exports__ConvBertForQuestionAnswering, __webpack_exports__ConvBertForSequenceClassification, __webpack_exports__ConvBertForTokenClassification, __webpack_exports__ConvBertModel, __webpack_exports__ConvBertPreTrainedModel, __webpack_exports__ConvBertTokenizer, __webpack_exports__ConvNextFeatureExtractor, __webpack_exports__ConvNextForImageClassification, __webpack_exports__ConvNextImageProcessor, __webpack_exports__ConvNextModel, __webpack_exports__ConvNextPreTrainedModel, __webpack_exports__ConvNextV2ForImageClassification, __webpack_exports__ConvNextV2Model, __webpack_exports__ConvNextV2PreTrainedModel, __webpack_exports__DFineForObjectDetection, __webpack_exports__DFineModel, __webpack_exports__DFinePreTrainedModel, __webpack_exports__DINOv3ConvNextModel, __webpack_exports__DINOv3ConvNextPreTrainedModel, __webpack_exports__DINOv3ViTImageProcessor, __webpack_exports__DINOv3ViTModel, __webpack_exports__DINOv3ViTPreTrainedModel, __webpack_exports__DPTFeatureExtractor, __webpack_exports__DPTForDepthEstimation, __webpack_exports__DPTImageProcessor, __webpack_exports__DPTModel, __webpack_exports__DPTPreTrainedModel, __webpack_exports__DacDecoderModel, __webpack_exports__DacDecoderOutput, __webpack_exports__DacEncoderModel, __webpack_exports__DacEncoderOutput, __webpack_exports__DacFeatureExtractor, __webpack_exports__DacModel, __webpack_exports__DacPreTrainedModel, __webpack_exports__DataTypeMap, __webpack_exports__DebertaForMaskedLM, __webpack_exports__DebertaForQuestionAnswering, __webpack_exports__DebertaForSequenceClassification, __webpack_exports__DebertaForTokenClassification, __webpack_exports__DebertaModel, __webpack_exports__DebertaPreTrainedModel, __webpack_exports__DebertaTokenizer, __webpack_exports__DebertaV2ForMaskedLM, __webpack_exports__DebertaV2ForQuestionAnswering, __webpack_exports__DebertaV2ForSequenceClassification, __webpack_exports__DebertaV2ForTokenClassification, __webpack_exports__DebertaV2Model, __webpack_exports__DebertaV2PreTrainedModel, __webpack_exports__DebertaV2Tokenizer, __webpack_exports__DecisionTransformerModel, __webpack_exports__DecisionTransformerPreTrainedModel, __webpack_exports__DeiTFeatureExtractor, __webpack_exports__DeiTForImageClassification, __webpack_exports__DeiTImageProcessor, __webpack_exports__DeiTModel, __webpack_exports__DeiTPreTrainedModel, __webpack_exports__DepthAnythingForDepthEstimation, __webpack_exports__DepthAnythingPreTrainedModel, __webpack_exports__DepthEstimationPipeline, __webpack_exports__DepthProForDepthEstimation, __webpack_exports__DepthProPreTrainedModel, __webpack_exports__DetrFeatureExtractor, __webpack_exports__DetrForObjectDetection, __webpack_exports__DetrForSegmentation, __webpack_exports__DetrImageProcessor, __webpack_exports__DetrModel, __webpack_exports__DetrObjectDetectionOutput, __webpack_exports__DetrPreTrainedModel, __webpack_exports__DetrSegmentationOutput, __webpack_exports__Dinov2ForImageClassification, __webpack_exports__Dinov2Model, __webpack_exports__Dinov2PreTrainedModel, __webpack_exports__Dinov2WithRegistersForImageClassification, __webpack_exports__Dinov2WithRegistersModel, __webpack_exports__Dinov2WithRegistersPreTrainedModel, __webpack_exports__DistilBertForMaskedLM, __webpack_exports__DistilBertForQuestionAnswering, __webpack_exports__DistilBertForSequenceClassification, __webpack_exports__DistilBertForTokenClassification, __webpack_exports__DistilBertModel, __webpack_exports__DistilBertPreTrainedModel, __webpack_exports__DistilBertTokenizer, __webpack_exports__DocumentQuestionAnsweringPipeline, __webpack_exports__DonutFeatureExtractor, __webpack_exports__DonutImageProcessor, __webpack_exports__DonutSwinModel, __webpack_exports__DonutSwinPreTrainedModel, __webpack_exports__EdgeTamModel, __webpack_exports__EfficientNetForImageClassification, __webpack_exports__EfficientNetImageProcessor, __webpack_exports__EfficientNetModel, __webpack_exports__EfficientNetPreTrainedModel, __webpack_exports__ElectraForMaskedLM, __webpack_exports__ElectraForQuestionAnswering, __webpack_exports__ElectraForSequenceClassification, __webpack_exports__ElectraForTokenClassification, __webpack_exports__ElectraModel, __webpack_exports__ElectraPreTrainedModel, __webpack_exports__ElectraTokenizer, __webpack_exports__EncodecFeatureExtractor, __webpack_exports__EosTokenCriteria, __webpack_exports__Ernie4_5ForCausalLM, __webpack_exports__Ernie4_5Model, __webpack_exports__Ernie4_5PreTrainedModel, __webpack_exports__EsmForMaskedLM, __webpack_exports__EsmForSequenceClassification, __webpack_exports__EsmForTokenClassification, __webpack_exports__EsmModel, __webpack_exports__EsmPreTrainedModel, __webpack_exports__EsmTokenizer, __webpack_exports__ExaoneForCausalLM, __webpack_exports__ExaoneModel, __webpack_exports__ExaonePreTrainedModel, __webpack_exports__FFT, __webpack_exports__FalconForCausalLM, __webpack_exports__FalconModel, __webpack_exports__FalconPreTrainedModel, __webpack_exports__FalconTokenizer, __webpack_exports__FastViTForImageClassification, __webpack_exports__FastViTModel, __webpack_exports__FastViTPreTrainedModel, __webpack_exports__FeatureExtractionPipeline, __webpack_exports__FeatureExtractor, __webpack_exports__FillMaskPipeline, __webpack_exports__Florence2ForConditionalGeneration, __webpack_exports__Florence2PreTrainedModel, __webpack_exports__Florence2Processor, __webpack_exports__ForcedBOSTokenLogitsProcessor, __webpack_exports__ForcedEOSTokenLogitsProcessor, __webpack_exports__GLPNFeatureExtractor, __webpack_exports__GLPNForDepthEstimation, __webpack_exports__GLPNModel, __webpack_exports__GLPNPreTrainedModel, __webpack_exports__GPT2LMHeadModel, __webpack_exports__GPT2Model, __webpack_exports__GPT2PreTrainedModel, __webpack_exports__GPT2Tokenizer, __webpack_exports__GPTBigCodeForCausalLM, __webpack_exports__GPTBigCodeModel, __webpack_exports__GPTBigCodePreTrainedModel, __webpack_exports__GPTJForCausalLM, __webpack_exports__GPTJModel, __webpack_exports__GPTJPreTrainedModel, __webpack_exports__GPTNeoForCausalLM, __webpack_exports__GPTNeoModel, __webpack_exports__GPTNeoPreTrainedModel, __webpack_exports__GPTNeoXForCausalLM, __webpack_exports__GPTNeoXModel, __webpack_exports__GPTNeoXPreTrainedModel, __webpack_exports__GPTNeoXTokenizer, __webpack_exports__Gemma2ForCausalLM, __webpack_exports__Gemma2Model, __webpack_exports__Gemma2PreTrainedModel, __webpack_exports__Gemma3ForCausalLM, __webpack_exports__Gemma3Model, __webpack_exports__Gemma3PreTrainedModel, __webpack_exports__Gemma3nAudioFeatureExtractor, __webpack_exports__Gemma3nForConditionalGeneration, __webpack_exports__Gemma3nPreTrainedModel, __webpack_exports__Gemma3nProcessor, __webpack_exports__GemmaForCausalLM, __webpack_exports__GemmaModel, __webpack_exports__GemmaPreTrainedModel, __webpack_exports__GemmaTokenizer, __webpack_exports__GlmForCausalLM, __webpack_exports__GlmModel, __webpack_exports__GlmPreTrainedModel, __webpack_exports__GraniteForCausalLM, __webpack_exports__GraniteModel, __webpack_exports__GraniteMoeHybridForCausalLM, __webpack_exports__GraniteMoeHybridModel, __webpack_exports__GraniteMoeHybridPreTrainedModel, __webpack_exports__GranitePreTrainedModel, __webpack_exports__Grok1Tokenizer, __webpack_exports__GroundingDinoForObjectDetection, __webpack_exports__GroundingDinoImageProcessor, __webpack_exports__GroundingDinoPreTrainedModel, __webpack_exports__GroundingDinoProcessor, __webpack_exports__GroupViTModel, __webpack_exports__GroupViTPreTrainedModel, __webpack_exports__HeliumForCausalLM, __webpack_exports__HeliumModel, __webpack_exports__HeliumPreTrainedModel, __webpack_exports__HerbertTokenizer, __webpack_exports__HieraForImageClassification, __webpack_exports__HieraModel, __webpack_exports__HieraPreTrainedModel, __webpack_exports__HubertForCTC, __webpack_exports__HubertForSequenceClassification, __webpack_exports__HubertModel, __webpack_exports__HubertPreTrainedModel, __webpack_exports__IJepaForImageClassification, __webpack_exports__IJepaModel, __webpack_exports__IJepaPreTrainedModel, __webpack_exports__Idefics3ForConditionalGeneration, __webpack_exports__Idefics3ImageProcessor, __webpack_exports__Idefics3PreTrainedModel, __webpack_exports__Idefics3Processor, __webpack_exports__ImageClassificationPipeline, __webpack_exports__ImageFeatureExtractionPipeline, __webpack_exports__ImageFeatureExtractor, __webpack_exports__ImageMattingOutput, __webpack_exports__ImageProcessor, __webpack_exports__ImageSegmentationPipeline, __webpack_exports__ImageToImagePipeline, __webpack_exports__ImageToTextPipeline, __webpack_exports__InterruptableStoppingCriteria, __webpack_exports__JAISLMHeadModel, __webpack_exports__JAISModel, __webpack_exports__JAISPreTrainedModel, __webpack_exports__JinaCLIPImageProcessor, __webpack_exports__JinaCLIPModel, __webpack_exports__JinaCLIPPreTrainedModel, __webpack_exports__JinaCLIPProcessor, __webpack_exports__JinaCLIPTextModel, __webpack_exports__JinaCLIPVisionModel, __webpack_exports__Lfm2ForCausalLM, __webpack_exports__Lfm2Model, __webpack_exports__Lfm2PreTrainedModel, __webpack_exports__LiteWhisperForConditionalGeneration, __webpack_exports__Llama4ForCausalLM, __webpack_exports__Llama4PreTrainedModel, __webpack_exports__LlamaForCausalLM, __webpack_exports__LlamaModel, __webpack_exports__LlamaPreTrainedModel, __webpack_exports__LlamaTokenizer, __webpack_exports__LlavaForConditionalGeneration, __webpack_exports__LlavaOnevisionForConditionalGeneration, __webpack_exports__LlavaOnevisionImageProcessor, __webpack_exports__LlavaPreTrainedModel, __webpack_exports__LlavaProcessor, __webpack_exports__LlavaQwen2ForCausalLM, __webpack_exports__LogitsProcessor, __webpack_exports__LogitsProcessorList, __webpack_exports__LogitsWarper, __webpack_exports__LongT5ForConditionalGeneration, __webpack_exports__LongT5Model, __webpack_exports__LongT5PreTrainedModel, __webpack_exports__M2M100ForConditionalGeneration, __webpack_exports__M2M100Model, __webpack_exports__M2M100PreTrainedModel, __webpack_exports__M2M100Tokenizer, __webpack_exports__MBart50Tokenizer, __webpack_exports__MBartForCausalLM, __webpack_exports__MBartForConditionalGeneration, __webpack_exports__MBartForSequenceClassification, __webpack_exports__MBartModel, __webpack_exports__MBartPreTrainedModel, __webpack_exports__MBartTokenizer, __webpack_exports__MPNetForMaskedLM, __webpack_exports__MPNetForQuestionAnswering, __webpack_exports__MPNetForSequenceClassification, __webpack_exports__MPNetForTokenClassification, __webpack_exports__MPNetModel, __webpack_exports__MPNetPreTrainedModel, __webpack_exports__MPNetTokenizer, __webpack_exports__MT5ForConditionalGeneration, __webpack_exports__MT5Model, __webpack_exports__MT5PreTrainedModel, __webpack_exports__MarianMTModel, __webpack_exports__MarianModel, __webpack_exports__MarianPreTrainedModel, __webpack_exports__MarianTokenizer, __webpack_exports__Mask2FormerImageProcessor, __webpack_exports__MaskFormerFeatureExtractor, __webpack_exports__MaskFormerForInstanceSegmentation, __webpack_exports__MaskFormerImageProcessor, __webpack_exports__MaskFormerModel, __webpack_exports__MaskFormerPreTrainedModel, __webpack_exports__MaskedLMOutput, __webpack_exports__MaxLengthCriteria, __webpack_exports__Metric3DForDepthEstimation, __webpack_exports__Metric3DPreTrainedModel, __webpack_exports__Metric3Dv2ForDepthEstimation, __webpack_exports__Metric3Dv2PreTrainedModel, __webpack_exports__MgpstrForSceneTextRecognition, __webpack_exports__MgpstrModelOutput, __webpack_exports__MgpstrPreTrainedModel, __webpack_exports__MgpstrProcessor, __webpack_exports__MgpstrTokenizer, __webpack_exports__MimiDecoderModel, __webpack_exports__MimiDecoderOutput, __webpack_exports__MimiEncoderModel, __webpack_exports__MimiEncoderOutput, __webpack_exports__MimiModel, __webpack_exports__MimiPreTrainedModel, __webpack_exports__MinLengthLogitsProcessor, __webpack_exports__MinNewTokensLengthLogitsProcessor, __webpack_exports__Ministral3ForCausalLM, __webpack_exports__Ministral3Model, __webpack_exports__Ministral3PreTrainedModel, __webpack_exports__MinistralForCausalLM, __webpack_exports__MinistralModel, __webpack_exports__MinistralPreTrainedModel, __webpack_exports__Mistral3ForConditionalGeneration, __webpack_exports__MistralForCausalLM, __webpack_exports__MistralModel, __webpack_exports__MistralPreTrainedModel, __webpack_exports__MobileBertForMaskedLM, __webpack_exports__MobileBertForQuestionAnswering, __webpack_exports__MobileBertForSequenceClassification, __webpack_exports__MobileBertModel, __webpack_exports__MobileBertPreTrainedModel, __webpack_exports__MobileBertTokenizer, __webpack_exports__MobileLLMForCausalLM, __webpack_exports__MobileLLMModel, __webpack_exports__MobileLLMPreTrainedModel, __webpack_exports__MobileNetV1FeatureExtractor, __webpack_exports__MobileNetV1ForImageClassification, __webpack_exports__MobileNetV1ForSemanticSegmentation, __webpack_exports__MobileNetV1ImageProcessor, __webpack_exports__MobileNetV1Model, __webpack_exports__MobileNetV1PreTrainedModel, __webpack_exports__MobileNetV2FeatureExtractor, __webpack_exports__MobileNetV2ForImageClassification, __webpack_exports__MobileNetV2ForSemanticSegmentation, __webpack_exports__MobileNetV2ImageProcessor, __webpack_exports__MobileNetV2Model, __webpack_exports__MobileNetV2PreTrainedModel, __webpack_exports__MobileNetV3FeatureExtractor, __webpack_exports__MobileNetV3ForImageClassification, __webpack_exports__MobileNetV3ForSemanticSegmentation, __webpack_exports__MobileNetV3ImageProcessor, __webpack_exports__MobileNetV3Model, __webpack_exports__MobileNetV3PreTrainedModel, __webpack_exports__MobileNetV4FeatureExtractor, __webpack_exports__MobileNetV4ForImageClassification, __webpack_exports__MobileNetV4ForSemanticSegmentation, __webpack_exports__MobileNetV4ImageProcessor, __webpack_exports__MobileNetV4Model, __webpack_exports__MobileNetV4PreTrainedModel, __webpack_exports__MobileViTFeatureExtractor, __webpack_exports__MobileViTForImageClassification, __webpack_exports__MobileViTImageProcessor, __webpack_exports__MobileViTModel, __webpack_exports__MobileViTPreTrainedModel, __webpack_exports__MobileViTV2ForImageClassification, __webpack_exports__MobileViTV2Model, __webpack_exports__MobileViTV2PreTrainedModel, __webpack_exports__ModelOutput, __webpack_exports__ModernBertDecoderForCausalLM, __webpack_exports__ModernBertDecoderModel, __webpack_exports__ModernBertDecoderPreTrainedModel, __webpack_exports__ModernBertForMaskedLM, __webpack_exports__ModernBertForSequenceClassification, __webpack_exports__ModernBertForTokenClassification, __webpack_exports__ModernBertModel, __webpack_exports__ModernBertPreTrainedModel, __webpack_exports__Moondream1ForConditionalGeneration, __webpack_exports__MoonshineFeatureExtractor, __webpack_exports__MoonshineForConditionalGeneration, __webpack_exports__MoonshineModel, __webpack_exports__MoonshinePreTrainedModel, __webpack_exports__MoonshineProcessor, __webpack_exports__MptForCausalLM, __webpack_exports__MptModel, __webpack_exports__MptPreTrainedModel, __webpack_exports__MultiModalityCausalLM, __webpack_exports__MultiModalityPreTrainedModel, __webpack_exports__MusicgenForCausalLM, __webpack_exports__MusicgenForConditionalGeneration, __webpack_exports__MusicgenModel, __webpack_exports__MusicgenPreTrainedModel, __webpack_exports__NanoChatForCausalLM, __webpack_exports__NanoChatModel, __webpack_exports__NanoChatPreTrainedModel, __webpack_exports__NeoBertForMaskedLM, __webpack_exports__NeoBertForQuestionAnswering, __webpack_exports__NeoBertForSequenceClassification, __webpack_exports__NeoBertForTokenClassification, __webpack_exports__NeoBertModel, __webpack_exports__NeoBertPreTrainedModel, __webpack_exports__NllbTokenizer, __webpack_exports__NoBadWordsLogitsProcessor, __webpack_exports__NoRepeatNGramLogitsProcessor, __webpack_exports__NomicBertModel, __webpack_exports__NomicBertPreTrainedModel, __webpack_exports__NougatImageProcessor, __webpack_exports__NougatTokenizer, __webpack_exports__OPTForCausalLM, __webpack_exports__OPTModel, __webpack_exports__OPTPreTrainedModel, __webpack_exports__ObjectDetectionPipeline, __webpack_exports__Olmo2ForCausalLM, __webpack_exports__Olmo2Model, __webpack_exports__Olmo2PreTrainedModel, __webpack_exports__OlmoForCausalLM, __webpack_exports__OlmoModel, __webpack_exports__OlmoPreTrainedModel, __webpack_exports__OpenELMForCausalLM, __webpack_exports__OpenELMModel, __webpack_exports__OpenELMPreTrainedModel, __webpack_exports__OwlViTFeatureExtractor, __webpack_exports__OwlViTForObjectDetection, __webpack_exports__OwlViTImageProcessor, __webpack_exports__OwlViTModel, __webpack_exports__OwlViTPreTrainedModel, __webpack_exports__OwlViTProcessor, __webpack_exports__Owlv2ForObjectDetection, __webpack_exports__Owlv2ImageProcessor, __webpack_exports__Owlv2Model, __webpack_exports__Owlv2PreTrainedModel, __webpack_exports__PaliGemmaForConditionalGeneration, __webpack_exports__PaliGemmaPreTrainedModel, __webpack_exports__PaliGemmaProcessor, __webpack_exports__ParakeetFeatureExtractor, __webpack_exports__ParakeetForCTC, __webpack_exports__ParakeetPreTrainedModel, __webpack_exports__PatchTSMixerForPrediction, __webpack_exports__PatchTSMixerModel, __webpack_exports__PatchTSMixerPreTrainedModel, __webpack_exports__PatchTSTForPrediction, __webpack_exports__PatchTSTModel, __webpack_exports__PatchTSTPreTrainedModel, __webpack_exports__Phi3ForCausalLM, __webpack_exports__Phi3Model, __webpack_exports__Phi3PreTrainedModel, __webpack_exports__Phi3VForCausalLM, __webpack_exports__Phi3VImageProcessor, __webpack_exports__Phi3VPreTrainedModel, __webpack_exports__Phi3VProcessor, __webpack_exports__PhiForCausalLM, __webpack_exports__PhiModel, __webpack_exports__PhiPreTrainedModel, __webpack_exports__Pipeline, __webpack_exports__PixtralImageProcessor, __webpack_exports__PixtralProcessor, __webpack_exports__PreTrainedModel, __webpack_exports__PreTrainedTokenizer, __webpack_exports__PretrainedConfig, __webpack_exports__PretrainedMixin, __webpack_exports__Processor, __webpack_exports__PvtForImageClassification, __webpack_exports__PvtImageProcessor, __webpack_exports__PvtModel, __webpack_exports__PvtPreTrainedModel, __webpack_exports__PyAnnoteFeatureExtractor, __webpack_exports__PyAnnoteForAudioFrameClassification, __webpack_exports__PyAnnoteModel, __webpack_exports__PyAnnotePreTrainedModel, __webpack_exports__PyAnnoteProcessor, __webpack_exports__QuestionAnsweringModelOutput, __webpack_exports__QuestionAnsweringPipeline, __webpack_exports__Qwen2ForCausalLM, __webpack_exports__Qwen2Model, __webpack_exports__Qwen2PreTrainedModel, __webpack_exports__Qwen2Tokenizer, __webpack_exports__Qwen2VLForConditionalGeneration, __webpack_exports__Qwen2VLImageProcessor, __webpack_exports__Qwen2VLPreTrainedModel, __webpack_exports__Qwen2VLProcessor, __webpack_exports__Qwen3ForCausalLM, __webpack_exports__Qwen3Model, __webpack_exports__Qwen3PreTrainedModel, __webpack_exports__RFDetrForObjectDetection, __webpack_exports__RFDetrModel, __webpack_exports__RFDetrObjectDetectionOutput, __webpack_exports__RFDetrPreTrainedModel, __webpack_exports__RTDetrForObjectDetection, __webpack_exports__RTDetrImageProcessor, __webpack_exports__RTDetrModel, __webpack_exports__RTDetrObjectDetectionOutput, __webpack_exports__RTDetrPreTrainedModel, __webpack_exports__RTDetrV2ForObjectDetection, __webpack_exports__RTDetrV2Model, __webpack_exports__RTDetrV2ObjectDetectionOutput, __webpack_exports__RTDetrV2PreTrainedModel, __webpack_exports__RawAudio, __webpack_exports__RawImage, __webpack_exports__RawVideo, __webpack_exports__RawVideoFrame, __webpack_exports__RepetitionPenaltyLogitsProcessor, __webpack_exports__ResNetForImageClassification, __webpack_exports__ResNetModel, __webpack_exports__ResNetPreTrainedModel, __webpack_exports__RoFormerForMaskedLM, __webpack_exports__RoFormerForQuestionAnswering, __webpack_exports__RoFormerForSequenceClassification, __webpack_exports__RoFormerForTokenClassification, __webpack_exports__RoFormerModel, __webpack_exports__RoFormerPreTrainedModel, __webpack_exports__RoFormerTokenizer, __webpack_exports__RobertaForMaskedLM, __webpack_exports__RobertaForQuestionAnswering, __webpack_exports__RobertaForSequenceClassification, __webpack_exports__RobertaForTokenClassification, __webpack_exports__RobertaModel, __webpack_exports__RobertaPreTrainedModel, __webpack_exports__RobertaTokenizer, __webpack_exports__Sam2ImageProcessor, __webpack_exports__Sam2ImageSegmentationOutput, __webpack_exports__Sam2Model, __webpack_exports__Sam2PreTrainedModel, __webpack_exports__Sam2Processor, __webpack_exports__Sam2VideoProcessor, __webpack_exports__Sam3ImageProcessor, __webpack_exports__Sam3TrackerModel, __webpack_exports__SamImageProcessor, __webpack_exports__SamImageSegmentationOutput, __webpack_exports__SamModel, __webpack_exports__SamPreTrainedModel, __webpack_exports__SamProcessor, __webpack_exports__SapiensForDepthEstimation, __webpack_exports__SapiensForNormalEstimation, __webpack_exports__SapiensForSemanticSegmentation, __webpack_exports__SapiensPreTrainedModel, __webpack_exports__SeamlessM4TFeatureExtractor, __webpack_exports__SegformerFeatureExtractor, __webpack_exports__SegformerForImageClassification, __webpack_exports__SegformerForSemanticSegmentation, __webpack_exports__SegformerImageProcessor, __webpack_exports__SegformerModel, __webpack_exports__SegformerPreTrainedModel, __webpack_exports__Seq2SeqLMOutput, __webpack_exports__SequenceClassifierOutput, __webpack_exports__SiglipImageProcessor, __webpack_exports__SiglipModel, __webpack_exports__SiglipPreTrainedModel, __webpack_exports__SiglipTextModel, __webpack_exports__SiglipTokenizer, __webpack_exports__SiglipVisionModel, __webpack_exports__SmolLM3ForCausalLM, __webpack_exports__SmolLM3Model, __webpack_exports__SmolLM3PreTrainedModel, __webpack_exports__SmolVLMForConditionalGeneration, __webpack_exports__SmolVLMImageProcessor, __webpack_exports__SmolVLMProcessor, __webpack_exports__SnacDecoderModel, __webpack_exports__SnacEncoderModel, __webpack_exports__SnacFeatureExtractor, __webpack_exports__SnacModel, __webpack_exports__SnacPreTrainedModel, __webpack_exports__SpeechT5FeatureExtractor, __webpack_exports__SpeechT5ForSpeechToText, __webpack_exports__SpeechT5ForTextToSpeech, __webpack_exports__SpeechT5HifiGan, __webpack_exports__SpeechT5Model, __webpack_exports__SpeechT5PreTrainedModel, __webpack_exports__SpeechT5Processor, __webpack_exports__SpeechT5Tokenizer, __webpack_exports__SqueezeBertForMaskedLM, __webpack_exports__SqueezeBertForQuestionAnswering, __webpack_exports__SqueezeBertForSequenceClassification, __webpack_exports__SqueezeBertModel, __webpack_exports__SqueezeBertPreTrainedModel, __webpack_exports__SqueezeBertTokenizer, __webpack_exports__StableLmForCausalLM, __webpack_exports__StableLmModel, __webpack_exports__StableLmPreTrainedModel, __webpack_exports__Starcoder2ForCausalLM, __webpack_exports__Starcoder2Model, __webpack_exports__Starcoder2PreTrainedModel, __webpack_exports__StoppingCriteria, __webpack_exports__StoppingCriteriaList, __webpack_exports__StyleTextToSpeech2Model, __webpack_exports__StyleTextToSpeech2PreTrainedModel, __webpack_exports__SummarizationPipeline, __webpack_exports__SupertonicForConditionalGeneration, __webpack_exports__SupertonicPreTrainedModel, __webpack_exports__SuppressTokensAtBeginLogitsProcessor, __webpack_exports__Swin2SRForImageSuperResolution, __webpack_exports__Swin2SRImageProcessor, __webpack_exports__Swin2SRModel, __webpack_exports__Swin2SRPreTrainedModel, __webpack_exports__SwinForImageClassification, __webpack_exports__SwinForSemanticSegmentation, __webpack_exports__SwinModel, __webpack_exports__SwinPreTrainedModel, __webpack_exports__T5ForConditionalGeneration, __webpack_exports__T5Model, __webpack_exports__T5PreTrainedModel, __webpack_exports__T5Tokenizer, __webpack_exports__TableTransformerForObjectDetection, __webpack_exports__TableTransformerModel, __webpack_exports__TableTransformerObjectDetectionOutput, __webpack_exports__TableTransformerPreTrainedModel, __webpack_exports__TemperatureLogitsWarper, __webpack_exports__Tensor, __webpack_exports__Text2TextGenerationPipeline, __webpack_exports__TextClassificationPipeline, __webpack_exports__TextGenerationPipeline, __webpack_exports__TextStreamer, __webpack_exports__TextToAudioPipeline, __webpack_exports__TokenClassificationPipeline, __webpack_exports__TokenClassifierOutput, __webpack_exports__TokenizerModel, __webpack_exports__TopKLogitsWarper, __webpack_exports__TopPLogitsWarper, __webpack_exports__TrOCRForCausalLM, __webpack_exports__TrOCRPreTrainedModel, __webpack_exports__TranslationPipeline, __webpack_exports__UltravoxModel, __webpack_exports__UltravoxPreTrainedModel, __webpack_exports__UltravoxProcessor, __webpack_exports__UniSpeechForCTC, __webpack_exports__UniSpeechForSequenceClassification, __webpack_exports__UniSpeechModel, __webpack_exports__UniSpeechPreTrainedModel, __webpack_exports__UniSpeechSatForAudioFrameClassification, __webpack_exports__UniSpeechSatForCTC, __webpack_exports__UniSpeechSatForSequenceClassification, __webpack_exports__UniSpeechSatModel, __webpack_exports__UniSpeechSatPreTrainedModel, __webpack_exports__VLChatProcessor, __webpack_exports__VLMImageProcessor, __webpack_exports__VaultGemmaForCausalLM, __webpack_exports__VaultGemmaModel, __webpack_exports__VaultGemmaPreTrainedModel, __webpack_exports__ViTFeatureExtractor, __webpack_exports__ViTForImageClassification, __webpack_exports__ViTImageProcessor, __webpack_exports__ViTMAEModel, __webpack_exports__ViTMAEPreTrainedModel, __webpack_exports__ViTMSNForImageClassification, __webpack_exports__ViTMSNModel, __webpack_exports__ViTMSNPreTrainedModel, __webpack_exports__ViTModel, __webpack_exports__ViTPreTrainedModel, __webpack_exports__VisionEncoderDecoderModel, __webpack_exports__VitMatteForImageMatting, __webpack_exports__VitMatteImageProcessor, __webpack_exports__VitMattePreTrainedModel, __webpack_exports__VitPoseForPoseEstimation, __webpack_exports__VitPoseImageProcessor, __webpack_exports__VitPosePreTrainedModel, __webpack_exports__VitsModel, __webpack_exports__VitsModelOutput, __webpack_exports__VitsPreTrainedModel, __webpack_exports__VitsTokenizer, __webpack_exports__VoxtralForConditionalGeneration, __webpack_exports__VoxtralProcessor, __webpack_exports__Wav2Vec2BertForCTC, __webpack_exports__Wav2Vec2BertForSequenceClassification, __webpack_exports__Wav2Vec2BertModel, __webpack_exports__Wav2Vec2BertPreTrainedModel, __webpack_exports__Wav2Vec2CTCTokenizer, __webpack_exports__Wav2Vec2FeatureExtractor, __webpack_exports__Wav2Vec2ForAudioFrameClassification, __webpack_exports__Wav2Vec2ForCTC, __webpack_exports__Wav2Vec2ForSequenceClassification, __webpack_exports__Wav2Vec2Model, __webpack_exports__Wav2Vec2PreTrainedModel, __webpack_exports__Wav2Vec2Processor, __webpack_exports__Wav2Vec2ProcessorWithLM, __webpack_exports__WavLMForAudioFrameClassification, __webpack_exports__WavLMForCTC, __webpack_exports__WavLMForSequenceClassification, __webpack_exports__WavLMForXVector, __webpack_exports__WavLMModel, __webpack_exports__WavLMPreTrainedModel, __webpack_exports__WeSpeakerFeatureExtractor, __webpack_exports__WeSpeakerResNetModel, __webpack_exports__WeSpeakerResNetPreTrainedModel, __webpack_exports__WhisperFeatureExtractor, __webpack_exports__WhisperForConditionalGeneration, __webpack_exports__WhisperModel, __webpack_exports__WhisperPreTrainedModel, __webpack_exports__WhisperProcessor, __webpack_exports__WhisperTextStreamer, __webpack_exports__WhisperTimeStampLogitsProcessor, __webpack_exports__WhisperTokenizer, __webpack_exports__XLMForQuestionAnswering, __webpack_exports__XLMForSequenceClassification, __webpack_exports__XLMForTokenClassification, __webpack_exports__XLMModel, __webpack_exports__XLMPreTrainedModel, __webpack_exports__XLMRobertaForMaskedLM, __webpack_exports__XLMRobertaForQuestionAnswering, __webpack_exports__XLMRobertaForSequenceClassification, __webpack_exports__XLMRobertaForTokenClassification, __webpack_exports__XLMRobertaModel, __webpack_exports__XLMRobertaPreTrainedModel, __webpack_exports__XLMRobertaTokenizer, __webpack_exports__XLMTokenizer, __webpack_exports__XLMWithLMHeadModel, __webpack_exports__XVectorOutput, __webpack_exports__YolosFeatureExtractor, __webpack_exports__YolosForObjectDetection, __webpack_exports__YolosImageProcessor, __webpack_exports__YolosModel, __webpack_exports__YolosObjectDetectionOutput, __webpack_exports__YolosPreTrainedModel, __webpack_exports__ZeroShotAudioClassificationPipeline, __webpack_exports__ZeroShotClassificationPipeline, __webpack_exports__ZeroShotImageClassificationPipeline, __webpack_exports__ZeroShotObjectDetectionPipeline, __webpack_exports__bankers_round, __webpack_exports__cat, __webpack_exports__cos_sim, __webpack_exports__dot, __webpack_exports__dynamic_time_warping, __webpack_exports__env, __webpack_exports__full, __webpack_exports__full_like, __webpack_exports__getCacheShapes, __webpack_exports__hamming, __webpack_exports__hanning, __webpack_exports__interpolate, __webpack_exports__interpolate_4d, __webpack_exports__interpolate_data, __webpack_exports__is_chinese_char, __webpack_exports__layer_norm, __webpack_exports__load_image, __webpack_exports__load_video, __webpack_exports__log_softmax, __webpack_exports__magnitude, __webpack_exports__matmul, __webpack_exports__max, __webpack_exports__mean, __webpack_exports__mean_pooling, __webpack_exports__medianFilter, __webpack_exports__mel_filter_bank, __webpack_exports__min, __webpack_exports__ones, __webpack_exports__ones_like, __webpack_exports__permute, __webpack_exports__permute_data, __webpack_exports__pipeline, __webpack_exports__quantize_embeddings, __webpack_exports__rand, __webpack_exports__randn, __webpack_exports__read_audio, __webpack_exports__rfft, __webpack_exports__round, __webpack_exports__slice, __webpack_exports__softmax, __webpack_exports__spectrogram, __webpack_exports__stack, __webpack_exports__std_mean, __webpack_exports__topk, __webpack_exports__window_function, __webpack_exports__zeros, __webpack_exports__zeros_like;
|
|
912
|
+
var __WEBPACK_EXTERNAL_MODULE_onnxruntime_common_82b39e9f__, __WEBPACK_EXTERNAL_MODULE_onnxruntime_web_74d14b94__, import_meta, __webpack_modules__, __webpack_module_cache__, __webpack_exports__, __webpack_exports__ASTFeatureExtractor, __webpack_exports__ASTForAudioClassification, __webpack_exports__ASTModel, __webpack_exports__ASTPreTrainedModel, __webpack_exports__AlbertForMaskedLM, __webpack_exports__AlbertForQuestionAnswering, __webpack_exports__AlbertForSequenceClassification, __webpack_exports__AlbertModel, __webpack_exports__AlbertPreTrainedModel, __webpack_exports__AlbertTokenizer, __webpack_exports__ArceeForCausalLM, __webpack_exports__ArceeModel, __webpack_exports__ArceePreTrainedModel, __webpack_exports__AudioClassificationPipeline, __webpack_exports__AutoConfig, __webpack_exports__AutoFeatureExtractor, __webpack_exports__AutoImageProcessor, __webpack_exports__AutoModel, __webpack_exports__AutoModelForAudioClassification, __webpack_exports__AutoModelForAudioFrameClassification, __webpack_exports__AutoModelForAudioTextToText, __webpack_exports__AutoModelForCTC, __webpack_exports__AutoModelForCausalLM, __webpack_exports__AutoModelForDepthEstimation, __webpack_exports__AutoModelForDocumentQuestionAnswering, __webpack_exports__AutoModelForImageClassification, __webpack_exports__AutoModelForImageFeatureExtraction, __webpack_exports__AutoModelForImageMatting, __webpack_exports__AutoModelForImageSegmentation, __webpack_exports__AutoModelForImageTextToText, __webpack_exports__AutoModelForImageToImage, __webpack_exports__AutoModelForMaskGeneration, __webpack_exports__AutoModelForMaskedLM, __webpack_exports__AutoModelForNormalEstimation, __webpack_exports__AutoModelForObjectDetection, __webpack_exports__AutoModelForPoseEstimation, __webpack_exports__AutoModelForQuestionAnswering, __webpack_exports__AutoModelForSemanticSegmentation, __webpack_exports__AutoModelForSeq2SeqLM, __webpack_exports__AutoModelForSequenceClassification, __webpack_exports__AutoModelForSpeechSeq2Seq, __webpack_exports__AutoModelForTextToSpectrogram, __webpack_exports__AutoModelForTextToWaveform, __webpack_exports__AutoModelForTokenClassification, __webpack_exports__AutoModelForUniversalSegmentation, __webpack_exports__AutoModelForVision2Seq, __webpack_exports__AutoModelForXVector, __webpack_exports__AutoModelForZeroShotObjectDetection, __webpack_exports__AutoProcessor, __webpack_exports__AutoTokenizer, __webpack_exports__AutomaticSpeechRecognitionPipeline, __webpack_exports__BackgroundRemovalPipeline, __webpack_exports__BartForConditionalGeneration, __webpack_exports__BartForSequenceClassification, __webpack_exports__BartModel, __webpack_exports__BartPretrainedModel, __webpack_exports__BartTokenizer, __webpack_exports__BaseModelOutput, __webpack_exports__BaseStreamer, __webpack_exports__BeitFeatureExtractor, __webpack_exports__BeitForImageClassification, __webpack_exports__BeitModel, __webpack_exports__BeitPreTrainedModel, __webpack_exports__BertForMaskedLM, __webpack_exports__BertForQuestionAnswering, __webpack_exports__BertForSequenceClassification, __webpack_exports__BertForTokenClassification, __webpack_exports__BertModel, __webpack_exports__BertPreTrainedModel, __webpack_exports__BertTokenizer, __webpack_exports__BitImageProcessor, __webpack_exports__BlenderbotForConditionalGeneration, __webpack_exports__BlenderbotModel, __webpack_exports__BlenderbotPreTrainedModel, __webpack_exports__BlenderbotSmallForConditionalGeneration, __webpack_exports__BlenderbotSmallModel, __webpack_exports__BlenderbotSmallPreTrainedModel, __webpack_exports__BlenderbotSmallTokenizer, __webpack_exports__BlenderbotTokenizer, __webpack_exports__BloomForCausalLM, __webpack_exports__BloomModel, __webpack_exports__BloomPreTrainedModel, __webpack_exports__BloomTokenizer, __webpack_exports__CLIPFeatureExtractor, __webpack_exports__CLIPImageProcessor, __webpack_exports__CLIPModel, __webpack_exports__CLIPPreTrainedModel, __webpack_exports__CLIPSegForImageSegmentation, __webpack_exports__CLIPSegModel, __webpack_exports__CLIPSegPreTrainedModel, __webpack_exports__CLIPTextModel, __webpack_exports__CLIPTextModelWithProjection, __webpack_exports__CLIPTokenizer, __webpack_exports__CLIPVisionModel, __webpack_exports__CLIPVisionModelWithProjection, __webpack_exports__CamembertForMaskedLM, __webpack_exports__CamembertForQuestionAnswering, __webpack_exports__CamembertForSequenceClassification, __webpack_exports__CamembertForTokenClassification, __webpack_exports__CamembertModel, __webpack_exports__CamembertPreTrainedModel, __webpack_exports__CamembertTokenizer, __webpack_exports__CausalLMOutput, __webpack_exports__CausalLMOutputWithPast, __webpack_exports__ChineseCLIPFeatureExtractor, __webpack_exports__ChineseCLIPModel, __webpack_exports__ChineseCLIPPreTrainedModel, __webpack_exports__ClapAudioModelWithProjection, __webpack_exports__ClapFeatureExtractor, __webpack_exports__ClapModel, __webpack_exports__ClapPreTrainedModel, __webpack_exports__ClapTextModelWithProjection, __webpack_exports__ClassifierFreeGuidanceLogitsProcessor, __webpack_exports__CodeGenForCausalLM, __webpack_exports__CodeGenModel, __webpack_exports__CodeGenPreTrainedModel, __webpack_exports__CodeGenTokenizer, __webpack_exports__CodeLlamaTokenizer, __webpack_exports__CohereForCausalLM, __webpack_exports__CohereModel, __webpack_exports__CoherePreTrainedModel, __webpack_exports__CohereTokenizer, __webpack_exports__ConvBertForMaskedLM, __webpack_exports__ConvBertForQuestionAnswering, __webpack_exports__ConvBertForSequenceClassification, __webpack_exports__ConvBertForTokenClassification, __webpack_exports__ConvBertModel, __webpack_exports__ConvBertPreTrainedModel, __webpack_exports__ConvBertTokenizer, __webpack_exports__ConvNextFeatureExtractor, __webpack_exports__ConvNextForImageClassification, __webpack_exports__ConvNextImageProcessor, __webpack_exports__ConvNextModel, __webpack_exports__ConvNextPreTrainedModel, __webpack_exports__ConvNextV2ForImageClassification, __webpack_exports__ConvNextV2Model, __webpack_exports__ConvNextV2PreTrainedModel, __webpack_exports__DFineForObjectDetection, __webpack_exports__DFineModel, __webpack_exports__DFinePreTrainedModel, __webpack_exports__DINOv3ConvNextModel, __webpack_exports__DINOv3ConvNextPreTrainedModel, __webpack_exports__DINOv3ViTImageProcessor, __webpack_exports__DINOv3ViTModel, __webpack_exports__DINOv3ViTPreTrainedModel, __webpack_exports__DPTFeatureExtractor, __webpack_exports__DPTForDepthEstimation, __webpack_exports__DPTImageProcessor, __webpack_exports__DPTModel, __webpack_exports__DPTPreTrainedModel, __webpack_exports__DacDecoderModel, __webpack_exports__DacDecoderOutput, __webpack_exports__DacEncoderModel, __webpack_exports__DacEncoderOutput, __webpack_exports__DacFeatureExtractor, __webpack_exports__DacModel, __webpack_exports__DacPreTrainedModel, __webpack_exports__DataTypeMap, __webpack_exports__DebertaForMaskedLM, __webpack_exports__DebertaForQuestionAnswering, __webpack_exports__DebertaForSequenceClassification, __webpack_exports__DebertaForTokenClassification, __webpack_exports__DebertaModel, __webpack_exports__DebertaPreTrainedModel, __webpack_exports__DebertaTokenizer, __webpack_exports__DebertaV2ForMaskedLM, __webpack_exports__DebertaV2ForQuestionAnswering, __webpack_exports__DebertaV2ForSequenceClassification, __webpack_exports__DebertaV2ForTokenClassification, __webpack_exports__DebertaV2Model, __webpack_exports__DebertaV2PreTrainedModel, __webpack_exports__DebertaV2Tokenizer, __webpack_exports__DecisionTransformerModel, __webpack_exports__DecisionTransformerPreTrainedModel, __webpack_exports__DeiTFeatureExtractor, __webpack_exports__DeiTForImageClassification, __webpack_exports__DeiTImageProcessor, __webpack_exports__DeiTModel, __webpack_exports__DeiTPreTrainedModel, __webpack_exports__DepthAnythingForDepthEstimation, __webpack_exports__DepthAnythingPreTrainedModel, __webpack_exports__DepthEstimationPipeline, __webpack_exports__DepthProForDepthEstimation, __webpack_exports__DepthProPreTrainedModel, __webpack_exports__DetrFeatureExtractor, __webpack_exports__DetrForObjectDetection, __webpack_exports__DetrForSegmentation, __webpack_exports__DetrImageProcessor, __webpack_exports__DetrModel, __webpack_exports__DetrObjectDetectionOutput, __webpack_exports__DetrPreTrainedModel, __webpack_exports__DetrSegmentationOutput, __webpack_exports__Dinov2ForImageClassification, __webpack_exports__Dinov2Model, __webpack_exports__Dinov2PreTrainedModel, __webpack_exports__Dinov2WithRegistersForImageClassification, __webpack_exports__Dinov2WithRegistersModel, __webpack_exports__Dinov2WithRegistersPreTrainedModel, __webpack_exports__DistilBertForMaskedLM, __webpack_exports__DistilBertForQuestionAnswering, __webpack_exports__DistilBertForSequenceClassification, __webpack_exports__DistilBertForTokenClassification, __webpack_exports__DistilBertModel, __webpack_exports__DistilBertPreTrainedModel, __webpack_exports__DistilBertTokenizer, __webpack_exports__DocumentQuestionAnsweringPipeline, __webpack_exports__DonutFeatureExtractor, __webpack_exports__DonutImageProcessor, __webpack_exports__DonutSwinModel, __webpack_exports__DonutSwinPreTrainedModel, __webpack_exports__EdgeTamModel, __webpack_exports__EfficientNetForImageClassification, __webpack_exports__EfficientNetImageProcessor, __webpack_exports__EfficientNetModel, __webpack_exports__EfficientNetPreTrainedModel, __webpack_exports__ElectraForMaskedLM, __webpack_exports__ElectraForQuestionAnswering, __webpack_exports__ElectraForSequenceClassification, __webpack_exports__ElectraForTokenClassification, __webpack_exports__ElectraModel, __webpack_exports__ElectraPreTrainedModel, __webpack_exports__ElectraTokenizer, __webpack_exports__EncodecFeatureExtractor, __webpack_exports__EosTokenCriteria, __webpack_exports__Ernie4_5ForCausalLM, __webpack_exports__Ernie4_5Model, __webpack_exports__Ernie4_5PreTrainedModel, __webpack_exports__EsmForMaskedLM, __webpack_exports__EsmForSequenceClassification, __webpack_exports__EsmForTokenClassification, __webpack_exports__EsmModel, __webpack_exports__EsmPreTrainedModel, __webpack_exports__EsmTokenizer, __webpack_exports__ExaoneForCausalLM, __webpack_exports__ExaoneModel, __webpack_exports__ExaonePreTrainedModel, __webpack_exports__FFT, __webpack_exports__FalconForCausalLM, __webpack_exports__FalconModel, __webpack_exports__FalconPreTrainedModel, __webpack_exports__FalconTokenizer, __webpack_exports__FastViTForImageClassification, __webpack_exports__FastViTModel, __webpack_exports__FastViTPreTrainedModel, __webpack_exports__FeatureExtractionPipeline, __webpack_exports__FeatureExtractor, __webpack_exports__FillMaskPipeline, __webpack_exports__Florence2ForConditionalGeneration, __webpack_exports__Florence2PreTrainedModel, __webpack_exports__Florence2Processor, __webpack_exports__ForcedBOSTokenLogitsProcessor, __webpack_exports__ForcedEOSTokenLogitsProcessor, __webpack_exports__GLPNFeatureExtractor, __webpack_exports__GLPNForDepthEstimation, __webpack_exports__GLPNModel, __webpack_exports__GLPNPreTrainedModel, __webpack_exports__GPT2LMHeadModel, __webpack_exports__GPT2Model, __webpack_exports__GPT2PreTrainedModel, __webpack_exports__GPT2Tokenizer, __webpack_exports__GPTBigCodeForCausalLM, __webpack_exports__GPTBigCodeModel, __webpack_exports__GPTBigCodePreTrainedModel, __webpack_exports__GPTJForCausalLM, __webpack_exports__GPTJModel, __webpack_exports__GPTJPreTrainedModel, __webpack_exports__GPTNeoForCausalLM, __webpack_exports__GPTNeoModel, __webpack_exports__GPTNeoPreTrainedModel, __webpack_exports__GPTNeoXForCausalLM, __webpack_exports__GPTNeoXModel, __webpack_exports__GPTNeoXPreTrainedModel, __webpack_exports__GPTNeoXTokenizer, __webpack_exports__Gemma2ForCausalLM, __webpack_exports__Gemma2Model, __webpack_exports__Gemma2PreTrainedModel, __webpack_exports__Gemma3ForCausalLM, __webpack_exports__Gemma3Model, __webpack_exports__Gemma3PreTrainedModel, __webpack_exports__Gemma3nAudioFeatureExtractor, __webpack_exports__Gemma3nForConditionalGeneration, __webpack_exports__Gemma3nPreTrainedModel, __webpack_exports__Gemma3nProcessor, __webpack_exports__GemmaForCausalLM, __webpack_exports__GemmaModel, __webpack_exports__GemmaPreTrainedModel, __webpack_exports__GemmaTokenizer, __webpack_exports__GlmForCausalLM, __webpack_exports__GlmModel, __webpack_exports__GlmPreTrainedModel, __webpack_exports__GraniteForCausalLM, __webpack_exports__GraniteModel, __webpack_exports__GraniteMoeHybridForCausalLM, __webpack_exports__GraniteMoeHybridModel, __webpack_exports__GraniteMoeHybridPreTrainedModel, __webpack_exports__GranitePreTrainedModel, __webpack_exports__Grok1Tokenizer, __webpack_exports__GroundingDinoForObjectDetection, __webpack_exports__GroundingDinoImageProcessor, __webpack_exports__GroundingDinoPreTrainedModel, __webpack_exports__GroundingDinoProcessor, __webpack_exports__GroupViTModel, __webpack_exports__GroupViTPreTrainedModel, __webpack_exports__HeliumForCausalLM, __webpack_exports__HeliumModel, __webpack_exports__HeliumPreTrainedModel, __webpack_exports__HerbertTokenizer, __webpack_exports__HieraForImageClassification, __webpack_exports__HieraModel, __webpack_exports__HieraPreTrainedModel, __webpack_exports__HubertForCTC, __webpack_exports__HubertForSequenceClassification, __webpack_exports__HubertModel, __webpack_exports__HubertPreTrainedModel, __webpack_exports__IJepaForImageClassification, __webpack_exports__IJepaModel, __webpack_exports__IJepaPreTrainedModel, __webpack_exports__Idefics3ForConditionalGeneration, __webpack_exports__Idefics3ImageProcessor, __webpack_exports__Idefics3PreTrainedModel, __webpack_exports__Idefics3Processor, __webpack_exports__ImageClassificationPipeline, __webpack_exports__ImageFeatureExtractionPipeline, __webpack_exports__ImageFeatureExtractor, __webpack_exports__ImageMattingOutput, __webpack_exports__ImageProcessor, __webpack_exports__ImageSegmentationPipeline, __webpack_exports__ImageToImagePipeline, __webpack_exports__ImageToTextPipeline, __webpack_exports__InterruptableStoppingCriteria, __webpack_exports__JAISLMHeadModel, __webpack_exports__JAISModel, __webpack_exports__JAISPreTrainedModel, __webpack_exports__JinaCLIPImageProcessor, __webpack_exports__JinaCLIPModel, __webpack_exports__JinaCLIPPreTrainedModel, __webpack_exports__JinaCLIPProcessor, __webpack_exports__JinaCLIPTextModel, __webpack_exports__JinaCLIPVisionModel, __webpack_exports__Lfm2ForCausalLM, __webpack_exports__Lfm2Model, __webpack_exports__Lfm2PreTrainedModel, __webpack_exports__LiteWhisperForConditionalGeneration, __webpack_exports__Llama4ForCausalLM, __webpack_exports__Llama4PreTrainedModel, __webpack_exports__LlamaForCausalLM, __webpack_exports__LlamaModel, __webpack_exports__LlamaPreTrainedModel, __webpack_exports__LlamaTokenizer, __webpack_exports__LlavaForConditionalGeneration, __webpack_exports__LlavaOnevisionForConditionalGeneration, __webpack_exports__LlavaOnevisionImageProcessor, __webpack_exports__LlavaPreTrainedModel, __webpack_exports__LlavaProcessor, __webpack_exports__LlavaQwen2ForCausalLM, __webpack_exports__LogitsProcessor, __webpack_exports__LogitsProcessorList, __webpack_exports__LogitsWarper, __webpack_exports__LongT5ForConditionalGeneration, __webpack_exports__LongT5Model, __webpack_exports__LongT5PreTrainedModel, __webpack_exports__M2M100ForConditionalGeneration, __webpack_exports__M2M100Model, __webpack_exports__M2M100PreTrainedModel, __webpack_exports__M2M100Tokenizer, __webpack_exports__MBart50Tokenizer, __webpack_exports__MBartForCausalLM, __webpack_exports__MBartForConditionalGeneration, __webpack_exports__MBartForSequenceClassification, __webpack_exports__MBartModel, __webpack_exports__MBartPreTrainedModel, __webpack_exports__MBartTokenizer, __webpack_exports__MPNetForMaskedLM, __webpack_exports__MPNetForQuestionAnswering, __webpack_exports__MPNetForSequenceClassification, __webpack_exports__MPNetForTokenClassification, __webpack_exports__MPNetModel, __webpack_exports__MPNetPreTrainedModel, __webpack_exports__MPNetTokenizer, __webpack_exports__MT5ForConditionalGeneration, __webpack_exports__MT5Model, __webpack_exports__MT5PreTrainedModel, __webpack_exports__MarianMTModel, __webpack_exports__MarianModel, __webpack_exports__MarianPreTrainedModel, __webpack_exports__MarianTokenizer, __webpack_exports__Mask2FormerImageProcessor, __webpack_exports__MaskFormerFeatureExtractor, __webpack_exports__MaskFormerForInstanceSegmentation, __webpack_exports__MaskFormerImageProcessor, __webpack_exports__MaskFormerModel, __webpack_exports__MaskFormerPreTrainedModel, __webpack_exports__MaskedLMOutput, __webpack_exports__MaxLengthCriteria, __webpack_exports__Metric3DForDepthEstimation, __webpack_exports__Metric3DPreTrainedModel, __webpack_exports__Metric3Dv2ForDepthEstimation, __webpack_exports__Metric3Dv2PreTrainedModel, __webpack_exports__MgpstrForSceneTextRecognition, __webpack_exports__MgpstrModelOutput, __webpack_exports__MgpstrPreTrainedModel, __webpack_exports__MgpstrProcessor, __webpack_exports__MgpstrTokenizer, __webpack_exports__MimiDecoderModel, __webpack_exports__MimiDecoderOutput, __webpack_exports__MimiEncoderModel, __webpack_exports__MimiEncoderOutput, __webpack_exports__MimiModel, __webpack_exports__MimiPreTrainedModel, __webpack_exports__MinLengthLogitsProcessor, __webpack_exports__MinNewTokensLengthLogitsProcessor, __webpack_exports__Ministral3ForCausalLM, __webpack_exports__Ministral3Model, __webpack_exports__Ministral3PreTrainedModel, __webpack_exports__MinistralForCausalLM, __webpack_exports__MinistralModel, __webpack_exports__MinistralPreTrainedModel, __webpack_exports__Mistral3ForConditionalGeneration, __webpack_exports__MistralForCausalLM, __webpack_exports__MistralModel, __webpack_exports__MistralPreTrainedModel, __webpack_exports__MobileBertForMaskedLM, __webpack_exports__MobileBertForQuestionAnswering, __webpack_exports__MobileBertForSequenceClassification, __webpack_exports__MobileBertModel, __webpack_exports__MobileBertPreTrainedModel, __webpack_exports__MobileBertTokenizer, __webpack_exports__MobileLLMForCausalLM, __webpack_exports__MobileLLMModel, __webpack_exports__MobileLLMPreTrainedModel, __webpack_exports__MobileNetV1FeatureExtractor, __webpack_exports__MobileNetV1ForImageClassification, __webpack_exports__MobileNetV1ForSemanticSegmentation, __webpack_exports__MobileNetV1ImageProcessor, __webpack_exports__MobileNetV1Model, __webpack_exports__MobileNetV1PreTrainedModel, __webpack_exports__MobileNetV2FeatureExtractor, __webpack_exports__MobileNetV2ForImageClassification, __webpack_exports__MobileNetV2ForSemanticSegmentation, __webpack_exports__MobileNetV2ImageProcessor, __webpack_exports__MobileNetV2Model, __webpack_exports__MobileNetV2PreTrainedModel, __webpack_exports__MobileNetV3FeatureExtractor, __webpack_exports__MobileNetV3ForImageClassification, __webpack_exports__MobileNetV3ForSemanticSegmentation, __webpack_exports__MobileNetV3ImageProcessor, __webpack_exports__MobileNetV3Model, __webpack_exports__MobileNetV3PreTrainedModel, __webpack_exports__MobileNetV4FeatureExtractor, __webpack_exports__MobileNetV4ForImageClassification, __webpack_exports__MobileNetV4ForSemanticSegmentation, __webpack_exports__MobileNetV4ImageProcessor, __webpack_exports__MobileNetV4Model, __webpack_exports__MobileNetV4PreTrainedModel, __webpack_exports__MobileViTFeatureExtractor, __webpack_exports__MobileViTForImageClassification, __webpack_exports__MobileViTImageProcessor, __webpack_exports__MobileViTModel, __webpack_exports__MobileViTPreTrainedModel, __webpack_exports__MobileViTV2ForImageClassification, __webpack_exports__MobileViTV2Model, __webpack_exports__MobileViTV2PreTrainedModel, __webpack_exports__ModelOutput, __webpack_exports__ModernBertDecoderForCausalLM, __webpack_exports__ModernBertDecoderModel, __webpack_exports__ModernBertDecoderPreTrainedModel, __webpack_exports__ModernBertForMaskedLM, __webpack_exports__ModernBertForSequenceClassification, __webpack_exports__ModernBertForTokenClassification, __webpack_exports__ModernBertModel, __webpack_exports__ModernBertPreTrainedModel, __webpack_exports__Moondream1ForConditionalGeneration, __webpack_exports__MoonshineFeatureExtractor, __webpack_exports__MoonshineForConditionalGeneration, __webpack_exports__MoonshineModel, __webpack_exports__MoonshinePreTrainedModel, __webpack_exports__MoonshineProcessor, __webpack_exports__MptForCausalLM, __webpack_exports__MptModel, __webpack_exports__MptPreTrainedModel, __webpack_exports__MultiModalityCausalLM, __webpack_exports__MultiModalityPreTrainedModel, __webpack_exports__MusicgenForCausalLM, __webpack_exports__MusicgenForConditionalGeneration, __webpack_exports__MusicgenModel, __webpack_exports__MusicgenPreTrainedModel, __webpack_exports__NanoChatForCausalLM, __webpack_exports__NanoChatModel, __webpack_exports__NanoChatPreTrainedModel, __webpack_exports__NeoBertForMaskedLM, __webpack_exports__NeoBertForQuestionAnswering, __webpack_exports__NeoBertForSequenceClassification, __webpack_exports__NeoBertForTokenClassification, __webpack_exports__NeoBertModel, __webpack_exports__NeoBertPreTrainedModel, __webpack_exports__NllbTokenizer, __webpack_exports__NoBadWordsLogitsProcessor, __webpack_exports__NoRepeatNGramLogitsProcessor, __webpack_exports__NomicBertModel, __webpack_exports__NomicBertPreTrainedModel, __webpack_exports__NougatImageProcessor, __webpack_exports__NougatTokenizer, __webpack_exports__OPTForCausalLM, __webpack_exports__OPTModel, __webpack_exports__OPTPreTrainedModel, __webpack_exports__ObjectDetectionPipeline, __webpack_exports__Olmo2ForCausalLM, __webpack_exports__Olmo2Model, __webpack_exports__Olmo2PreTrainedModel, __webpack_exports__OlmoForCausalLM, __webpack_exports__OlmoModel, __webpack_exports__OlmoPreTrainedModel, __webpack_exports__OpenELMForCausalLM, __webpack_exports__OpenELMModel, __webpack_exports__OpenELMPreTrainedModel, __webpack_exports__OwlViTFeatureExtractor, __webpack_exports__OwlViTForObjectDetection, __webpack_exports__OwlViTImageProcessor, __webpack_exports__OwlViTModel, __webpack_exports__OwlViTPreTrainedModel, __webpack_exports__OwlViTProcessor, __webpack_exports__Owlv2ForObjectDetection, __webpack_exports__Owlv2ImageProcessor, __webpack_exports__Owlv2Model, __webpack_exports__Owlv2PreTrainedModel, __webpack_exports__PaliGemmaForConditionalGeneration, __webpack_exports__PaliGemmaPreTrainedModel, __webpack_exports__PaliGemmaProcessor, __webpack_exports__ParakeetFeatureExtractor, __webpack_exports__ParakeetForCTC, __webpack_exports__ParakeetPreTrainedModel, __webpack_exports__PatchTSMixerForPrediction, __webpack_exports__PatchTSMixerModel, __webpack_exports__PatchTSMixerPreTrainedModel, __webpack_exports__PatchTSTForPrediction, __webpack_exports__PatchTSTModel, __webpack_exports__PatchTSTPreTrainedModel, __webpack_exports__Phi3ForCausalLM, __webpack_exports__Phi3Model, __webpack_exports__Phi3PreTrainedModel, __webpack_exports__Phi3VForCausalLM, __webpack_exports__Phi3VImageProcessor, __webpack_exports__Phi3VPreTrainedModel, __webpack_exports__Phi3VProcessor, __webpack_exports__PhiForCausalLM, __webpack_exports__PhiModel, __webpack_exports__PhiPreTrainedModel, __webpack_exports__Pipeline, __webpack_exports__PixtralImageProcessor, __webpack_exports__PixtralProcessor, __webpack_exports__PreTrainedModel, __webpack_exports__PreTrainedTokenizer, __webpack_exports__PretrainedConfig, __webpack_exports__PretrainedMixin, __webpack_exports__Processor, __webpack_exports__PvtForImageClassification, __webpack_exports__PvtImageProcessor, __webpack_exports__PvtModel, __webpack_exports__PvtPreTrainedModel, __webpack_exports__PyAnnoteFeatureExtractor, __webpack_exports__PyAnnoteForAudioFrameClassification, __webpack_exports__PyAnnoteModel, __webpack_exports__PyAnnotePreTrainedModel, __webpack_exports__PyAnnoteProcessor, __webpack_exports__QuestionAnsweringModelOutput, __webpack_exports__QuestionAnsweringPipeline, __webpack_exports__Qwen2ForCausalLM, __webpack_exports__Qwen2Model, __webpack_exports__Qwen2PreTrainedModel, __webpack_exports__Qwen2Tokenizer, __webpack_exports__Qwen2VLForConditionalGeneration, __webpack_exports__Qwen2VLImageProcessor, __webpack_exports__Qwen2VLPreTrainedModel, __webpack_exports__Qwen2VLProcessor, __webpack_exports__Qwen3ForCausalLM, __webpack_exports__Qwen3Model, __webpack_exports__Qwen3PreTrainedModel, __webpack_exports__RFDetrForObjectDetection, __webpack_exports__RFDetrModel, __webpack_exports__RFDetrObjectDetectionOutput, __webpack_exports__RFDetrPreTrainedModel, __webpack_exports__RTDetrForObjectDetection, __webpack_exports__RTDetrImageProcessor, __webpack_exports__RTDetrModel, __webpack_exports__RTDetrObjectDetectionOutput, __webpack_exports__RTDetrPreTrainedModel, __webpack_exports__RTDetrV2ForObjectDetection, __webpack_exports__RTDetrV2Model, __webpack_exports__RTDetrV2ObjectDetectionOutput, __webpack_exports__RTDetrV2PreTrainedModel, __webpack_exports__RawAudio, __webpack_exports__RawImage, __webpack_exports__RawVideo, __webpack_exports__RawVideoFrame, __webpack_exports__RepetitionPenaltyLogitsProcessor, __webpack_exports__ResNetForImageClassification, __webpack_exports__ResNetModel, __webpack_exports__ResNetPreTrainedModel, __webpack_exports__RoFormerForMaskedLM, __webpack_exports__RoFormerForQuestionAnswering, __webpack_exports__RoFormerForSequenceClassification, __webpack_exports__RoFormerForTokenClassification, __webpack_exports__RoFormerModel, __webpack_exports__RoFormerPreTrainedModel, __webpack_exports__RoFormerTokenizer, __webpack_exports__RobertaForMaskedLM, __webpack_exports__RobertaForQuestionAnswering, __webpack_exports__RobertaForSequenceClassification, __webpack_exports__RobertaForTokenClassification, __webpack_exports__RobertaModel, __webpack_exports__RobertaPreTrainedModel, __webpack_exports__RobertaTokenizer, __webpack_exports__Sam2ImageProcessor, __webpack_exports__Sam2ImageSegmentationOutput, __webpack_exports__Sam2Model, __webpack_exports__Sam2PreTrainedModel, __webpack_exports__Sam2Processor, __webpack_exports__Sam2VideoProcessor, __webpack_exports__Sam3ImageProcessor, __webpack_exports__Sam3TrackerModel, __webpack_exports__SamImageProcessor, __webpack_exports__SamImageSegmentationOutput, __webpack_exports__SamModel, __webpack_exports__SamPreTrainedModel, __webpack_exports__SamProcessor, __webpack_exports__SapiensForDepthEstimation, __webpack_exports__SapiensForNormalEstimation, __webpack_exports__SapiensForSemanticSegmentation, __webpack_exports__SapiensPreTrainedModel, __webpack_exports__SeamlessM4TFeatureExtractor, __webpack_exports__SegformerFeatureExtractor, __webpack_exports__SegformerForImageClassification, __webpack_exports__SegformerForSemanticSegmentation, __webpack_exports__SegformerImageProcessor, __webpack_exports__SegformerModel, __webpack_exports__SegformerPreTrainedModel, __webpack_exports__Seq2SeqLMOutput, __webpack_exports__SequenceClassifierOutput, __webpack_exports__SiglipImageProcessor, __webpack_exports__SiglipModel, __webpack_exports__SiglipPreTrainedModel, __webpack_exports__SiglipTextModel, __webpack_exports__SiglipTokenizer, __webpack_exports__SiglipVisionModel, __webpack_exports__SmolLM3ForCausalLM, __webpack_exports__SmolLM3Model, __webpack_exports__SmolLM3PreTrainedModel, __webpack_exports__SmolVLMForConditionalGeneration, __webpack_exports__SmolVLMImageProcessor, __webpack_exports__SmolVLMProcessor, __webpack_exports__SnacDecoderModel, __webpack_exports__SnacEncoderModel, __webpack_exports__SnacFeatureExtractor, __webpack_exports__SnacModel, __webpack_exports__SnacPreTrainedModel, __webpack_exports__SpeechT5FeatureExtractor, __webpack_exports__SpeechT5ForSpeechToText, __webpack_exports__SpeechT5ForTextToSpeech, __webpack_exports__SpeechT5HifiGan, __webpack_exports__SpeechT5Model, __webpack_exports__SpeechT5PreTrainedModel, __webpack_exports__SpeechT5Processor, __webpack_exports__SpeechT5Tokenizer, __webpack_exports__SqueezeBertForMaskedLM, __webpack_exports__SqueezeBertForQuestionAnswering, __webpack_exports__SqueezeBertForSequenceClassification, __webpack_exports__SqueezeBertModel, __webpack_exports__SqueezeBertPreTrainedModel, __webpack_exports__SqueezeBertTokenizer, __webpack_exports__StableLmForCausalLM, __webpack_exports__StableLmModel, __webpack_exports__StableLmPreTrainedModel, __webpack_exports__Starcoder2ForCausalLM, __webpack_exports__Starcoder2Model, __webpack_exports__Starcoder2PreTrainedModel, __webpack_exports__StoppingCriteria, __webpack_exports__StoppingCriteriaList, __webpack_exports__StyleTextToSpeech2Model, __webpack_exports__StyleTextToSpeech2PreTrainedModel, __webpack_exports__SummarizationPipeline, __webpack_exports__SupertonicForConditionalGeneration, __webpack_exports__SupertonicPreTrainedModel, __webpack_exports__SuppressTokensAtBeginLogitsProcessor, __webpack_exports__Swin2SRForImageSuperResolution, __webpack_exports__Swin2SRImageProcessor, __webpack_exports__Swin2SRModel, __webpack_exports__Swin2SRPreTrainedModel, __webpack_exports__SwinForImageClassification, __webpack_exports__SwinForSemanticSegmentation, __webpack_exports__SwinModel, __webpack_exports__SwinPreTrainedModel, __webpack_exports__T5ForConditionalGeneration, __webpack_exports__T5Model, __webpack_exports__T5PreTrainedModel, __webpack_exports__T5Tokenizer, __webpack_exports__TableTransformerForObjectDetection, __webpack_exports__TableTransformerModel, __webpack_exports__TableTransformerObjectDetectionOutput, __webpack_exports__TableTransformerPreTrainedModel, __webpack_exports__TemperatureLogitsWarper, __webpack_exports__Tensor, __webpack_exports__Text2TextGenerationPipeline, __webpack_exports__TextClassificationPipeline, __webpack_exports__TextGenerationPipeline, __webpack_exports__TextStreamer, __webpack_exports__TextToAudioPipeline, __webpack_exports__TokenClassificationPipeline, __webpack_exports__TokenClassifierOutput, __webpack_exports__TokenizerModel, __webpack_exports__TopKLogitsWarper, __webpack_exports__TopPLogitsWarper, __webpack_exports__TrOCRForCausalLM, __webpack_exports__TrOCRPreTrainedModel, __webpack_exports__TranslationPipeline, __webpack_exports__UltravoxModel, __webpack_exports__UltravoxPreTrainedModel, __webpack_exports__UltravoxProcessor, __webpack_exports__UniSpeechForCTC, __webpack_exports__UniSpeechForSequenceClassification, __webpack_exports__UniSpeechModel, __webpack_exports__UniSpeechPreTrainedModel, __webpack_exports__UniSpeechSatForAudioFrameClassification, __webpack_exports__UniSpeechSatForCTC, __webpack_exports__UniSpeechSatForSequenceClassification, __webpack_exports__UniSpeechSatModel, __webpack_exports__UniSpeechSatPreTrainedModel, __webpack_exports__VLChatProcessor, __webpack_exports__VLMImageProcessor, __webpack_exports__VaultGemmaForCausalLM, __webpack_exports__VaultGemmaModel, __webpack_exports__VaultGemmaPreTrainedModel, __webpack_exports__ViTFeatureExtractor, __webpack_exports__ViTForImageClassification, __webpack_exports__ViTImageProcessor, __webpack_exports__ViTMAEModel, __webpack_exports__ViTMAEPreTrainedModel, __webpack_exports__ViTMSNForImageClassification, __webpack_exports__ViTMSNModel, __webpack_exports__ViTMSNPreTrainedModel, __webpack_exports__ViTModel, __webpack_exports__ViTPreTrainedModel, __webpack_exports__VisionEncoderDecoderModel, __webpack_exports__VitMatteForImageMatting, __webpack_exports__VitMatteImageProcessor, __webpack_exports__VitMattePreTrainedModel, __webpack_exports__VitPoseForPoseEstimation, __webpack_exports__VitPoseImageProcessor, __webpack_exports__VitPosePreTrainedModel, __webpack_exports__VitsModel, __webpack_exports__VitsModelOutput, __webpack_exports__VitsPreTrainedModel, __webpack_exports__VitsTokenizer, __webpack_exports__VoxtralForConditionalGeneration, __webpack_exports__VoxtralProcessor, __webpack_exports__Wav2Vec2BertForCTC, __webpack_exports__Wav2Vec2BertForSequenceClassification, __webpack_exports__Wav2Vec2BertModel, __webpack_exports__Wav2Vec2BertPreTrainedModel, __webpack_exports__Wav2Vec2CTCTokenizer, __webpack_exports__Wav2Vec2FeatureExtractor, __webpack_exports__Wav2Vec2ForAudioFrameClassification, __webpack_exports__Wav2Vec2ForCTC, __webpack_exports__Wav2Vec2ForSequenceClassification, __webpack_exports__Wav2Vec2Model, __webpack_exports__Wav2Vec2PreTrainedModel, __webpack_exports__Wav2Vec2Processor, __webpack_exports__Wav2Vec2ProcessorWithLM, __webpack_exports__WavLMForAudioFrameClassification, __webpack_exports__WavLMForCTC, __webpack_exports__WavLMForSequenceClassification, __webpack_exports__WavLMForXVector, __webpack_exports__WavLMModel, __webpack_exports__WavLMPreTrainedModel, __webpack_exports__WeSpeakerFeatureExtractor, __webpack_exports__WeSpeakerResNetModel, __webpack_exports__WeSpeakerResNetPreTrainedModel, __webpack_exports__WhisperFeatureExtractor, __webpack_exports__WhisperForConditionalGeneration, __webpack_exports__WhisperModel, __webpack_exports__WhisperPreTrainedModel, __webpack_exports__WhisperProcessor, __webpack_exports__WhisperTextStreamer, __webpack_exports__WhisperTimeStampLogitsProcessor, __webpack_exports__WhisperTokenizer, __webpack_exports__XLMForQuestionAnswering, __webpack_exports__XLMForSequenceClassification, __webpack_exports__XLMForTokenClassification, __webpack_exports__XLMModel, __webpack_exports__XLMPreTrainedModel, __webpack_exports__XLMRobertaForMaskedLM, __webpack_exports__XLMRobertaForQuestionAnswering, __webpack_exports__XLMRobertaForSequenceClassification, __webpack_exports__XLMRobertaForTokenClassification, __webpack_exports__XLMRobertaModel, __webpack_exports__XLMRobertaPreTrainedModel, __webpack_exports__XLMRobertaTokenizer, __webpack_exports__XLMTokenizer, __webpack_exports__XLMWithLMHeadModel, __webpack_exports__XVectorOutput, __webpack_exports__YolosFeatureExtractor, __webpack_exports__YolosForObjectDetection, __webpack_exports__YolosImageProcessor, __webpack_exports__YolosModel, __webpack_exports__YolosObjectDetectionOutput, __webpack_exports__YolosPreTrainedModel, __webpack_exports__ZeroShotAudioClassificationPipeline, __webpack_exports__ZeroShotClassificationPipeline, __webpack_exports__ZeroShotImageClassificationPipeline, __webpack_exports__ZeroShotObjectDetectionPipeline, __webpack_exports__bankers_round, __webpack_exports__cat, __webpack_exports__cos_sim, __webpack_exports__dot, __webpack_exports__dynamic_time_warping, __webpack_exports__env, __webpack_exports__full, __webpack_exports__full_like, __webpack_exports__getCacheShapes, __webpack_exports__hamming, __webpack_exports__hanning, __webpack_exports__interpolate, __webpack_exports__interpolate_4d, __webpack_exports__interpolate_data, __webpack_exports__is_chinese_char, __webpack_exports__layer_norm, __webpack_exports__load_image, __webpack_exports__load_video, __webpack_exports__log_softmax, __webpack_exports__magnitude, __webpack_exports__matmul, __webpack_exports__max, __webpack_exports__mean, __webpack_exports__mean_pooling, __webpack_exports__medianFilter, __webpack_exports__mel_filter_bank, __webpack_exports__min, __webpack_exports__ones, __webpack_exports__ones_like, __webpack_exports__permute, __webpack_exports__permute_data, __webpack_exports__pipeline, __webpack_exports__quantize_embeddings, __webpack_exports__rand, __webpack_exports__randn, __webpack_exports__read_audio, __webpack_exports__rfft, __webpack_exports__round, __webpack_exports__slice, __webpack_exports__softmax, __webpack_exports__spectrogram, __webpack_exports__stack, __webpack_exports__std_mean, __webpack_exports__topk, __webpack_exports__window_function, __webpack_exports__zeros, __webpack_exports__zeros_like;
|
|
2145
913
|
var init_transformers_web = __esm({
|
|
2146
914
|
"node_modules/@huggingface/transformers/dist/transformers.web.js"() {
|
|
2147
915
|
"use strict";
|
|
2148
|
-
|
|
916
|
+
__WEBPACK_EXTERNAL_MODULE_onnxruntime_common_82b39e9f__ = __toESM(require("onnxruntime-common"), 1);
|
|
2149
917
|
__WEBPACK_EXTERNAL_MODULE_onnxruntime_web_74d14b94__ = __toESM(require("onnxruntime-web"), 1);
|
|
2150
918
|
import_meta = {};
|
|
2151
919
|
__webpack_modules__ = {
|
|
@@ -2156,7 +924,7 @@ var init_transformers_web = __esm({
|
|
|
2156
924
|
\*************************************/
|
|
2157
925
|
/***/
|
|
2158
926
|
((module2) => {
|
|
2159
|
-
module2.exports =
|
|
927
|
+
module2.exports = __WEBPACK_EXTERNAL_MODULE_onnxruntime_common_82b39e9f__;
|
|
2160
928
|
})
|
|
2161
929
|
),
|
|
2162
930
|
/***/
|
|
@@ -3881,18 +2649,18 @@ var init_transformers_web = __esm({
|
|
|
3881
2649
|
}
|
|
3882
2650
|
}
|
|
3883
2651
|
};
|
|
3884
|
-
function setupGlobals(
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
2652
|
+
function setupGlobals(env) {
|
|
2653
|
+
env.set("false", false);
|
|
2654
|
+
env.set("true", true);
|
|
2655
|
+
env.set("none", null);
|
|
2656
|
+
env.set("raise_exception", (args) => {
|
|
3889
2657
|
throw new Error(args);
|
|
3890
2658
|
});
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
2659
|
+
env.set("range", range);
|
|
2660
|
+
env.set("strftime_now", strftime_now);
|
|
2661
|
+
env.set("True", true);
|
|
2662
|
+
env.set("False", false);
|
|
2663
|
+
env.set("None", null);
|
|
3896
2664
|
}
|
|
3897
2665
|
function getAttributeValue(item, attributePath) {
|
|
3898
2666
|
const parts = attributePath.split(".");
|
|
@@ -3956,9 +2724,9 @@ var init_transformers_web = __esm({
|
|
|
3956
2724
|
}
|
|
3957
2725
|
}
|
|
3958
2726
|
var Interpreter = class {
|
|
3959
|
-
constructor(
|
|
2727
|
+
constructor(env) {
|
|
3960
2728
|
__publicField(this, "global");
|
|
3961
|
-
this.global =
|
|
2729
|
+
this.global = env ?? new Environment();
|
|
3962
2730
|
}
|
|
3963
2731
|
/**
|
|
3964
2732
|
* Run the program.
|
|
@@ -5056,14 +3824,14 @@ var init_transformers_web = __esm({
|
|
|
5056
3824
|
this.parsed = parse(tokens);
|
|
5057
3825
|
}
|
|
5058
3826
|
render(items) {
|
|
5059
|
-
const
|
|
5060
|
-
setupGlobals(
|
|
3827
|
+
const env = new Environment();
|
|
3828
|
+
setupGlobals(env);
|
|
5061
3829
|
if (items) {
|
|
5062
3830
|
for (const [key, value] of Object.entries(items)) {
|
|
5063
|
-
|
|
3831
|
+
env.set(key, value);
|
|
5064
3832
|
}
|
|
5065
3833
|
}
|
|
5066
|
-
const interpreter = new Interpreter(
|
|
3834
|
+
const interpreter = new Interpreter(env);
|
|
5067
3835
|
const result = interpreter.run(this.parsed);
|
|
5068
3836
|
return result.value;
|
|
5069
3837
|
}
|
|
@@ -5188,7 +3956,7 @@ var init_transformers_web = __esm({
|
|
|
5188
3956
|
supportedDevices.push("wasm");
|
|
5189
3957
|
defaultDevices = ["wasm"];
|
|
5190
3958
|
}
|
|
5191
|
-
const
|
|
3959
|
+
const InferenceSession = ONNX.InferenceSession;
|
|
5192
3960
|
function deviceToExecutionProviders(device = null) {
|
|
5193
3961
|
if (!device) return defaultDevices;
|
|
5194
3962
|
switch (device) {
|
|
@@ -5209,7 +3977,7 @@ var init_transformers_web = __esm({
|
|
|
5209
3977
|
if (wasmInitPromise) {
|
|
5210
3978
|
await wasmInitPromise;
|
|
5211
3979
|
}
|
|
5212
|
-
const sessionPromise =
|
|
3980
|
+
const sessionPromise = InferenceSession.create(buffer_or_path, session_options);
|
|
5213
3981
|
wasmInitPromise ?? (wasmInitPromise = sessionPromise);
|
|
5214
3982
|
const session = await sessionPromise;
|
|
5215
3983
|
session.config = session_config;
|
|
@@ -6577,7 +5345,7 @@ var init_transformers_web = __esm({
|
|
|
6577
5345
|
/* harmony export */
|
|
6578
5346
|
env: () => (
|
|
6579
5347
|
/* binding */
|
|
6580
|
-
|
|
5348
|
+
env
|
|
6581
5349
|
)
|
|
6582
5350
|
/* harmony export */
|
|
6583
5351
|
});
|
|
@@ -6638,7 +5406,7 @@ var init_transformers_web = __esm({
|
|
|
6638
5406
|
const DEFAULT_CACHE_DIR = RUNNING_LOCALLY ? node_path__WEBPACK_IMPORTED_MODULE_1__.join(dirname__, "/.cache/") : null;
|
|
6639
5407
|
const DEFAULT_LOCAL_MODEL_PATH = "/models/";
|
|
6640
5408
|
const localModelPath = RUNNING_LOCALLY ? node_path__WEBPACK_IMPORTED_MODULE_1__.join(dirname__, DEFAULT_LOCAL_MODEL_PATH) : DEFAULT_LOCAL_MODEL_PATH;
|
|
6641
|
-
const
|
|
5409
|
+
const env = {
|
|
6642
5410
|
version: VERSION,
|
|
6643
5411
|
/////////////////// Backends settings ///////////////////
|
|
6644
5412
|
// NOTE: These will be populated later by the backends themselves.
|
|
@@ -30516,9 +29284,9 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
30516
29284
|
);
|
|
30517
29285
|
} else if (typeof process !== "undefined" && process?.release?.name === "node") {
|
|
30518
29286
|
const IS_CI = !!process.env?.TESTING_REMOTELY;
|
|
30519
|
-
const
|
|
29287
|
+
const version = _env_js__WEBPACK_IMPORTED_MODULE_2__.env.version;
|
|
30520
29288
|
const headers = new Headers();
|
|
30521
|
-
headers.set("User-Agent", `transformers.js/${
|
|
29289
|
+
headers.set("User-Agent", `transformers.js/${version}; is_ci/${IS_CI};`);
|
|
30522
29290
|
const isHFURL = isValidUrl(urlOrPath, ["http:", "https:"], ["huggingface.co", "hf.co"]);
|
|
30523
29291
|
if (isHFURL) {
|
|
30524
29292
|
const token = process.env?.HF_TOKEN ?? process.env?.HF_ACCESS_TOKEN;
|
|
@@ -32395,7 +31163,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32395
31163
|
/* harmony export */
|
|
32396
31164
|
Tensor: () => (
|
|
32397
31165
|
/* binding */
|
|
32398
|
-
|
|
31166
|
+
Tensor
|
|
32399
31167
|
),
|
|
32400
31168
|
/* harmony export */
|
|
32401
31169
|
cat: () => (
|
|
@@ -32541,7 +31309,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32541
31309
|
uint4: Uint8Array,
|
|
32542
31310
|
int4: Int8Array
|
|
32543
31311
|
});
|
|
32544
|
-
class
|
|
31312
|
+
class Tensor {
|
|
32545
31313
|
/**
|
|
32546
31314
|
* Create a new Tensor or copy an existing Tensor.
|
|
32547
31315
|
* @param {[DataType, DataArray, number[]]|[ONNXTensor]} args
|
|
@@ -32630,7 +31398,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32630
31398
|
const iterSize = iterDims.reduce((a, b) => a * b);
|
|
32631
31399
|
return this._subarray(index, iterSize, iterDims);
|
|
32632
31400
|
} else {
|
|
32633
|
-
return new
|
|
31401
|
+
return new Tensor(this.type, [this.data[index]], iterDims);
|
|
32634
31402
|
}
|
|
32635
31403
|
}
|
|
32636
31404
|
/**
|
|
@@ -32656,7 +31424,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32656
31424
|
const o1 = index * iterSize;
|
|
32657
31425
|
const o2 = (index + 1) * iterSize;
|
|
32658
31426
|
const data = "subarray" in this.data ? this.data.subarray(o1, o2) : this.data.slice(o1, o2);
|
|
32659
|
-
return new
|
|
31427
|
+
return new Tensor(this.type, data, iterDims);
|
|
32660
31428
|
}
|
|
32661
31429
|
/**
|
|
32662
31430
|
* Returns the value of this tensor as a standard JavaScript Number. This only works
|
|
@@ -32803,7 +31571,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32803
31571
|
* @returns {Tensor} A new Tensor with the same type, data, and dimensions as the original.
|
|
32804
31572
|
*/
|
|
32805
31573
|
clone() {
|
|
32806
|
-
return new
|
|
31574
|
+
return new Tensor(this.type, this.data.slice(), this.dims.slice());
|
|
32807
31575
|
}
|
|
32808
31576
|
/**
|
|
32809
31577
|
* Performs a slice operation on the Tensor along specified dimensions.
|
|
@@ -32898,7 +31666,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32898
31666
|
data[i] = this_data[originalIndex];
|
|
32899
31667
|
}
|
|
32900
31668
|
}
|
|
32901
|
-
return new
|
|
31669
|
+
return new Tensor(this.type, data, newTensorDims);
|
|
32902
31670
|
}
|
|
32903
31671
|
/**
|
|
32904
31672
|
* Return a permuted version of this Tensor, according to the provided dimensions.
|
|
@@ -32940,7 +31708,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32940
31708
|
const fn = (a, b) => a + b ** p;
|
|
32941
31709
|
if (dim === null) {
|
|
32942
31710
|
const val = this_data.reduce(fn, 0) ** (1 / p);
|
|
32943
|
-
return new
|
|
31711
|
+
return new Tensor(this.type, [val], []);
|
|
32944
31712
|
}
|
|
32945
31713
|
const [type, result, resultDims] = reduce_helper(fn, this, dim, keepdim);
|
|
32946
31714
|
if (p !== 1) {
|
|
@@ -32948,7 +31716,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
32948
31716
|
result[i] = result[i] ** (1 / p);
|
|
32949
31717
|
}
|
|
32950
31718
|
}
|
|
32951
|
-
return new
|
|
31719
|
+
return new Tensor(type, result, resultDims);
|
|
32952
31720
|
}
|
|
32953
31721
|
/**
|
|
32954
31722
|
* Performs `L_p` normalization of inputs over specified dimension. Operates in place.
|
|
@@ -33003,7 +31771,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33003
31771
|
* @returns {Tensor} The squeezed tensor
|
|
33004
31772
|
*/
|
|
33005
31773
|
squeeze(dim = null) {
|
|
33006
|
-
return new
|
|
31774
|
+
return new Tensor(
|
|
33007
31775
|
this.type,
|
|
33008
31776
|
this.data,
|
|
33009
31777
|
calc_squeeze_dims(this.dims, dim)
|
|
@@ -33025,7 +31793,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33025
31793
|
* @returns {Tensor} The unsqueezed tensor
|
|
33026
31794
|
*/
|
|
33027
31795
|
unsqueeze(dim = null) {
|
|
33028
|
-
return new
|
|
31796
|
+
return new Tensor(
|
|
33029
31797
|
this.type,
|
|
33030
31798
|
this.data,
|
|
33031
31799
|
calc_unsqueeze_dims(this.dims, dim)
|
|
@@ -33082,7 +31850,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33082
31850
|
}, 1);
|
|
33083
31851
|
dims[inferredIndex] = this_data.length / productOther;
|
|
33084
31852
|
}
|
|
33085
|
-
return new
|
|
31853
|
+
return new Tensor(this.type, this_data, dims);
|
|
33086
31854
|
}
|
|
33087
31855
|
neg_() {
|
|
33088
31856
|
const this_data = this.data;
|
|
@@ -33105,7 +31873,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33105
31873
|
for (let i = 0; i < this_data.length; ++i) {
|
|
33106
31874
|
mask[i] = this_data[i] > val ? 1 : 0;
|
|
33107
31875
|
}
|
|
33108
|
-
return new
|
|
31876
|
+
return new Tensor("bool", mask, this.dims);
|
|
33109
31877
|
}
|
|
33110
31878
|
/**
|
|
33111
31879
|
* Computes input < val element-wise.
|
|
@@ -33118,7 +31886,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33118
31886
|
for (let i = 0; i < this_data.length; ++i) {
|
|
33119
31887
|
mask[i] = this_data[i] < val ? 1 : 0;
|
|
33120
31888
|
}
|
|
33121
|
-
return new
|
|
31889
|
+
return new Tensor("bool", mask, this.dims);
|
|
33122
31890
|
}
|
|
33123
31891
|
/**
|
|
33124
31892
|
* In-place version of @see {@link Tensor.clamp}
|
|
@@ -33162,36 +31930,36 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33162
31930
|
min(dim = null, keepdim = false) {
|
|
33163
31931
|
if (dim === null) {
|
|
33164
31932
|
const val = (0, _maths_js__WEBPACK_IMPORTED_MODULE_0__.min)(this.data)[0];
|
|
33165
|
-
return new
|
|
31933
|
+
return new Tensor(this.type, [val], [
|
|
33166
31934
|
/* scalar */
|
|
33167
31935
|
]);
|
|
33168
31936
|
}
|
|
33169
31937
|
const [type, result, resultDims] = reduce_helper((a, b) => Math.min(a, b), this, dim, keepdim, Infinity);
|
|
33170
|
-
return new
|
|
31938
|
+
return new Tensor(type, result, resultDims);
|
|
33171
31939
|
}
|
|
33172
31940
|
max(dim = null, keepdim = false) {
|
|
33173
31941
|
if (dim === null) {
|
|
33174
31942
|
const val = (0, _maths_js__WEBPACK_IMPORTED_MODULE_0__.max)(this.data)[0];
|
|
33175
|
-
return new
|
|
31943
|
+
return new Tensor(this.type, [val], [
|
|
33176
31944
|
/* scalar */
|
|
33177
31945
|
]);
|
|
33178
31946
|
}
|
|
33179
31947
|
const [type, result, resultDims] = reduce_helper((a, b) => Math.max(a, b), this, dim, keepdim, -Infinity);
|
|
33180
|
-
return new
|
|
31948
|
+
return new Tensor(type, result, resultDims);
|
|
33181
31949
|
}
|
|
33182
31950
|
argmin(dim = null, keepdim = false) {
|
|
33183
31951
|
if (dim !== null) {
|
|
33184
31952
|
throw new Error("`dim !== null` not yet implemented.");
|
|
33185
31953
|
}
|
|
33186
31954
|
const index = (0, _maths_js__WEBPACK_IMPORTED_MODULE_0__.min)(this.data)[1];
|
|
33187
|
-
return new
|
|
31955
|
+
return new Tensor("int64", [BigInt(index)], []);
|
|
33188
31956
|
}
|
|
33189
31957
|
argmax(dim = null, keepdim = false) {
|
|
33190
31958
|
if (dim !== null) {
|
|
33191
31959
|
throw new Error("`dim !== null` not yet implemented.");
|
|
33192
31960
|
}
|
|
33193
31961
|
const index = (0, _maths_js__WEBPACK_IMPORTED_MODULE_0__.max)(this.data)[1];
|
|
33194
|
-
return new
|
|
31962
|
+
return new Tensor("int64", [BigInt(index)], []);
|
|
33195
31963
|
}
|
|
33196
31964
|
/**
|
|
33197
31965
|
* Performs Tensor dtype conversion.
|
|
@@ -33215,7 +31983,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33215
31983
|
map_fn = BigInt;
|
|
33216
31984
|
}
|
|
33217
31985
|
}
|
|
33218
|
-
return new
|
|
31986
|
+
return new Tensor(type, DataTypeMap[type].from(this.data, map_fn), this.dims);
|
|
33219
31987
|
}
|
|
33220
31988
|
}
|
|
33221
31989
|
function reshape(data, dimensions) {
|
|
@@ -33240,7 +32008,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33240
32008
|
}
|
|
33241
32009
|
function permute(tensor, axes) {
|
|
33242
32010
|
const [permutedData, shape] = (0, _maths_js__WEBPACK_IMPORTED_MODULE_0__.permute_data)(tensor.data, tensor.dims, axes);
|
|
33243
|
-
return new
|
|
32011
|
+
return new Tensor(tensor.type, permutedData, shape);
|
|
33244
32012
|
}
|
|
33245
32013
|
function interpolate(input, [out_height, out_width], mode = "bilinear", align_corners = false) {
|
|
33246
32014
|
const in_channels = input.dims.at(-3) ?? 1;
|
|
@@ -33254,7 +32022,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33254
32022
|
mode,
|
|
33255
32023
|
align_corners
|
|
33256
32024
|
);
|
|
33257
|
-
return new
|
|
32025
|
+
return new Tensor(input.type, output, [in_channels, out_height, out_width]);
|
|
33258
32026
|
}
|
|
33259
32027
|
async function interpolate_4d(input, {
|
|
33260
32028
|
size = null,
|
|
@@ -33286,7 +32054,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33286
32054
|
} else {
|
|
33287
32055
|
throw new Error(`Unsupported mode: ${mode}`);
|
|
33288
32056
|
}
|
|
33289
|
-
const sizeTensor = new
|
|
32057
|
+
const sizeTensor = new Tensor("int64", new BigInt64Array(targetDims.map(BigInt)), [targetDims.length]);
|
|
33290
32058
|
return await op({ x: input, s: sizeTensor });
|
|
33291
32059
|
}
|
|
33292
32060
|
async function matmul(a, b) {
|
|
@@ -33306,14 +32074,14 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33306
32074
|
}
|
|
33307
32075
|
return await op({
|
|
33308
32076
|
x,
|
|
33309
|
-
k: new
|
|
32077
|
+
k: new Tensor(
|
|
33310
32078
|
"int64",
|
|
33311
32079
|
[BigInt(k)],
|
|
33312
32080
|
[1]
|
|
33313
32081
|
)
|
|
33314
32082
|
});
|
|
33315
32083
|
}
|
|
33316
|
-
const arrayToIndexTensor = (array) => new
|
|
32084
|
+
const arrayToIndexTensor = (array) => new Tensor("int64", array, [array.length]);
|
|
33317
32085
|
async function slice(data, starts, ends, axes, steps) {
|
|
33318
32086
|
const op = await _ops_registry_js__WEBPACK_IMPORTED_MODULE_2__.TensorOpRegistry.slice;
|
|
33319
32087
|
return await op({
|
|
@@ -33347,7 +32115,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33347
32115
|
returnedData[outIndex++] = avg;
|
|
33348
32116
|
}
|
|
33349
32117
|
}
|
|
33350
|
-
return new
|
|
32118
|
+
return new Tensor(
|
|
33351
32119
|
last_hidden_state.type,
|
|
33352
32120
|
returnedData,
|
|
33353
32121
|
shape
|
|
@@ -33384,7 +32152,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33384
32152
|
returnedData[offset2] = (inputData[offset2] - meanData[i]) / (stdData[i] + eps);
|
|
33385
32153
|
}
|
|
33386
32154
|
}
|
|
33387
|
-
return new
|
|
32155
|
+
return new Tensor(input.type, returnedData, input.dims);
|
|
33388
32156
|
}
|
|
33389
32157
|
function calc_squeeze_dims(dims, dim) {
|
|
33390
32158
|
dims = dims.slice();
|
|
@@ -33455,7 +32223,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33455
32223
|
currentDim += dims[dim];
|
|
33456
32224
|
}
|
|
33457
32225
|
}
|
|
33458
|
-
return new
|
|
32226
|
+
return new Tensor(resultType, result, resultDims);
|
|
33459
32227
|
}
|
|
33460
32228
|
function stack(tensors, dim = 0) {
|
|
33461
32229
|
return cat(tensors.map((t) => t.unsqueeze(dim)), dim);
|
|
@@ -33496,10 +32264,10 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33496
32264
|
const sum = inputData.reduce((a, b) => a + b, 0);
|
|
33497
32265
|
const mean2 = sum / inputData.length;
|
|
33498
32266
|
const std = Math.sqrt(inputData.reduce((a, b) => a + (b - mean2) ** 2, 0) / (inputData.length - correction));
|
|
33499
|
-
const meanTensor2 = new
|
|
32267
|
+
const meanTensor2 = new Tensor(input.type, [mean2], [
|
|
33500
32268
|
/* scalar */
|
|
33501
32269
|
]);
|
|
33502
|
-
const stdTensor2 = new
|
|
32270
|
+
const stdTensor2 = new Tensor(input.type, [std], [
|
|
33503
32271
|
/* scalar */
|
|
33504
32272
|
]);
|
|
33505
32273
|
return [stdTensor2, meanTensor2];
|
|
@@ -33511,7 +32279,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33511
32279
|
for (let i = 0; i < result.length; ++i) {
|
|
33512
32280
|
result[i] = Math.sqrt(result[i] / (inputDims[dim] - correction));
|
|
33513
32281
|
}
|
|
33514
|
-
const stdTensor = new
|
|
32282
|
+
const stdTensor = new Tensor(type, result, resultDims);
|
|
33515
32283
|
return [stdTensor, meanTensor];
|
|
33516
32284
|
}
|
|
33517
32285
|
function mean(input, dim = null, keepdim = false) {
|
|
@@ -33522,7 +32290,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33522
32290
|
);
|
|
33523
32291
|
if (dim === null) {
|
|
33524
32292
|
const val = inputData.reduce((a, b) => a + b, 0);
|
|
33525
|
-
return new
|
|
32293
|
+
return new Tensor(input.type, [val / inputData.length], [
|
|
33526
32294
|
/* scalar */
|
|
33527
32295
|
]);
|
|
33528
32296
|
}
|
|
@@ -33533,7 +32301,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33533
32301
|
result[i] /= inputDims[dim];
|
|
33534
32302
|
}
|
|
33535
32303
|
}
|
|
33536
|
-
return new
|
|
32304
|
+
return new Tensor(type, result, resultDims);
|
|
33537
32305
|
}
|
|
33538
32306
|
function dimsToStride(dims) {
|
|
33539
32307
|
const stride = new Array(dims.length);
|
|
@@ -33545,7 +32313,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33545
32313
|
}
|
|
33546
32314
|
function fullHelper(size, fill_value, dtype, cls) {
|
|
33547
32315
|
const numElements = size.reduce((a, b) => a * b, 1);
|
|
33548
|
-
return new
|
|
32316
|
+
return new Tensor(
|
|
33549
32317
|
dtype,
|
|
33550
32318
|
new cls(numElements).fill(fill_value),
|
|
33551
32319
|
size
|
|
@@ -33585,7 +32353,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33585
32353
|
}
|
|
33586
32354
|
function rand(size) {
|
|
33587
32355
|
const length = size.reduce((a, b) => a * b, 1);
|
|
33588
|
-
return new
|
|
32356
|
+
return new Tensor(
|
|
33589
32357
|
"float32",
|
|
33590
32358
|
Float32Array.from({ length }, () => Math.random()),
|
|
33591
32359
|
size
|
|
@@ -33598,7 +32366,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33598
32366
|
const v = 1 - Math.random();
|
|
33599
32367
|
return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
|
|
33600
32368
|
}
|
|
33601
|
-
return new
|
|
32369
|
+
return new Tensor(
|
|
33602
32370
|
"float32",
|
|
33603
32371
|
Float32Array.from({ length }, () => boxMullerRandom()),
|
|
33604
32372
|
size
|
|
@@ -33629,7 +32397,7 @@ ${fake_token_around_image}${global_img_token}` + image_token.repeat(image_seq_le
|
|
|
33629
32397
|
}
|
|
33630
32398
|
}
|
|
33631
32399
|
;
|
|
33632
|
-
return new
|
|
32400
|
+
return new Tensor(dtype, outputData, [tensor.dims[0], tensor.dims[1] / 8]);
|
|
33633
32401
|
}
|
|
33634
32402
|
})
|
|
33635
32403
|
),
|
|
@@ -39125,6 +37893,7 @@ __export(index_exports, {
|
|
|
39125
37893
|
nukeBrowserCaches: () => nukeBrowserCaches,
|
|
39126
37894
|
parseHuggingFaceUrl: () => parseHuggingFaceUrl,
|
|
39127
37895
|
preloadModels: () => preloadModels,
|
|
37896
|
+
preloadOnnxRuntime: () => preloadOnnxRuntime,
|
|
39128
37897
|
remapWav2ArkitToLam: () => remapWav2ArkitToLam,
|
|
39129
37898
|
resetLoggingConfig: () => resetLoggingConfig,
|
|
39130
37899
|
resolveBackend: () => resolveBackend,
|
|
@@ -39185,6 +37954,8 @@ var MicrophoneCapture = class {
|
|
|
39185
37954
|
this.buffer = new Float32Array(0);
|
|
39186
37955
|
this._isRecording = false;
|
|
39187
37956
|
this._loggedFirstChunk = false;
|
|
37957
|
+
/** Actual AudioContext sample rate (may differ from target on Firefox) */
|
|
37958
|
+
this._nativeSampleRate = 0;
|
|
39188
37959
|
this.config = {
|
|
39189
37960
|
sampleRate: config.sampleRate ?? 16e3,
|
|
39190
37961
|
chunkSize: config.chunkSize ?? 1600
|
|
@@ -39219,10 +37990,29 @@ var MicrophoneCapture = class {
|
|
|
39219
37990
|
if (this.context.state === "suspended") {
|
|
39220
37991
|
await this.context.resume();
|
|
39221
37992
|
}
|
|
39222
|
-
|
|
37993
|
+
let source;
|
|
37994
|
+
try {
|
|
37995
|
+
source = this.context.createMediaStreamSource(this.stream);
|
|
37996
|
+
this._nativeSampleRate = this.context.sampleRate;
|
|
37997
|
+
} catch (sourceErr) {
|
|
37998
|
+
console.warn(
|
|
37999
|
+
"[MicrophoneCapture] Cannot connect stream at",
|
|
38000
|
+
this.config.sampleRate + "Hz, falling back to native rate:",
|
|
38001
|
+
sourceErr.message
|
|
38002
|
+
);
|
|
38003
|
+
await this.context.close();
|
|
38004
|
+
this.context = new AudioContext();
|
|
38005
|
+
if (this.context.state === "suspended") {
|
|
38006
|
+
await this.context.resume();
|
|
38007
|
+
}
|
|
38008
|
+
source = this.context.createMediaStreamSource(this.stream);
|
|
38009
|
+
this._nativeSampleRate = this.context.sampleRate;
|
|
38010
|
+
console.log("[MicrophoneCapture] Using native rate:", this._nativeSampleRate, "Hz \u2192 resampling to", this.config.sampleRate, "Hz");
|
|
38011
|
+
}
|
|
39223
38012
|
this.processor = this.context.createScriptProcessor(4096, 1, 1);
|
|
39224
38013
|
this.processor.onaudioprocess = (e) => {
|
|
39225
|
-
const
|
|
38014
|
+
const raw = e.inputBuffer.getChannelData(0);
|
|
38015
|
+
const input = this._nativeSampleRate !== this.config.sampleRate ? this.resample(raw, this._nativeSampleRate, this.config.sampleRate) : raw;
|
|
39226
38016
|
let rms = 0;
|
|
39227
38017
|
let peak = 0;
|
|
39228
38018
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -39280,6 +38070,25 @@ var MicrophoneCapture = class {
|
|
|
39280
38070
|
this.buffer = new Float32Array(0);
|
|
39281
38071
|
this._isRecording = false;
|
|
39282
38072
|
}
|
|
38073
|
+
/**
|
|
38074
|
+
* Resample audio using linear interpolation.
|
|
38075
|
+
* Used when the AudioContext runs at the device's native rate (e.g. 48kHz)
|
|
38076
|
+
* and we need to downsample to the target rate (e.g. 16kHz).
|
|
38077
|
+
*/
|
|
38078
|
+
resample(input, fromRate, toRate) {
|
|
38079
|
+
if (fromRate === toRate) return input;
|
|
38080
|
+
const ratio = fromRate / toRate;
|
|
38081
|
+
const outputLength = Math.floor(input.length / ratio);
|
|
38082
|
+
const output = new Float32Array(outputLength);
|
|
38083
|
+
for (let i = 0; i < outputLength; i++) {
|
|
38084
|
+
const srcIdx = i * ratio;
|
|
38085
|
+
const lo = Math.floor(srcIdx);
|
|
38086
|
+
const hi = Math.min(lo + 1, input.length - 1);
|
|
38087
|
+
const frac = srcIdx - lo;
|
|
38088
|
+
output[i] = input[lo] * (1 - frac) + input[hi] * frac;
|
|
38089
|
+
}
|
|
38090
|
+
return output;
|
|
38091
|
+
}
|
|
39283
38092
|
floatToPCM16(float32) {
|
|
39284
38093
|
const pcm = new Int16Array(float32.length);
|
|
39285
38094
|
for (let i = 0; i < float32.length; i++) {
|
|
@@ -39420,7 +38229,8 @@ var AudioScheduler = class {
|
|
|
39420
38229
|
const ctx = await this.ensureContext();
|
|
39421
38230
|
const channels = this.options.channels ?? 1;
|
|
39422
38231
|
if (!this.isPlaying) {
|
|
39423
|
-
|
|
38232
|
+
const lookahead = this.options.initialLookaheadSec ?? 0.05;
|
|
38233
|
+
this.nextPlayTime = ctx.currentTime + lookahead;
|
|
39424
38234
|
this.isPlaying = true;
|
|
39425
38235
|
}
|
|
39426
38236
|
const audioBuffer = ctx.createBuffer(channels, audioData.length, ctx.sampleRate);
|
|
@@ -39603,8 +38413,8 @@ var AudioChunkCoalescer = class {
|
|
|
39603
38413
|
var LAMPipeline = class {
|
|
39604
38414
|
constructor(options = {}) {
|
|
39605
38415
|
this.options = options;
|
|
39606
|
-
this.
|
|
39607
|
-
// 1.0s at 16kHz (
|
|
38416
|
+
this.REQUIRED_SAMPLES = 16e3;
|
|
38417
|
+
// 1.0s at 16kHz (LAM requirement)
|
|
39608
38418
|
this.FRAME_RATE = 30;
|
|
39609
38419
|
// LAM outputs 30fps
|
|
39610
38420
|
this.buffer = new Float32Array(0);
|
|
@@ -39634,20 +38444,22 @@ var LAMPipeline = class {
|
|
|
39634
38444
|
newBuffer.set(this.buffer, 0);
|
|
39635
38445
|
newBuffer.set(samples, this.buffer.length);
|
|
39636
38446
|
this.buffer = newBuffer;
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
|
|
38447
|
+
while (this.buffer.length >= this.REQUIRED_SAMPLES) {
|
|
38448
|
+
await this.processBuffer(lam);
|
|
38449
|
+
if (this.buffer.length >= this.REQUIRED_SAMPLES) {
|
|
38450
|
+
await new Promise((r) => setTimeout(r, 0));
|
|
38451
|
+
}
|
|
39640
38452
|
}
|
|
39641
38453
|
}
|
|
39642
38454
|
/**
|
|
39643
38455
|
* Process accumulated buffer through LAM inference
|
|
39644
38456
|
*/
|
|
39645
|
-
async processBuffer(lam
|
|
38457
|
+
async processBuffer(lam) {
|
|
39646
38458
|
try {
|
|
39647
|
-
const toProcess = this.buffer.slice(0,
|
|
38459
|
+
const toProcess = this.buffer.slice(0, this.REQUIRED_SAMPLES);
|
|
39648
38460
|
const processedStartTime = this.bufferStartTime;
|
|
39649
|
-
this.buffer = this.buffer.slice(
|
|
39650
|
-
const processedDuration =
|
|
38461
|
+
this.buffer = this.buffer.slice(this.REQUIRED_SAMPLES);
|
|
38462
|
+
const processedDuration = this.REQUIRED_SAMPLES / (this.options.sampleRate ?? 16e3);
|
|
39651
38463
|
this.bufferStartTime = processedStartTime + processedDuration;
|
|
39652
38464
|
const result = await lam.infer(toProcess);
|
|
39653
38465
|
const frameDuration = 1 / this.FRAME_RATE;
|
|
@@ -39666,22 +38478,35 @@ var LAMPipeline = class {
|
|
|
39666
38478
|
/**
|
|
39667
38479
|
* Get the frame that should be displayed at the current time
|
|
39668
38480
|
*
|
|
39669
|
-
*
|
|
39670
|
-
*
|
|
39671
|
-
*
|
|
38481
|
+
* Automatically removes frames that have already been displayed.
|
|
38482
|
+
* This prevents memory leaks from accumulating old frames.
|
|
38483
|
+
*
|
|
38484
|
+
* Discard Window (prevents premature frame discarding):
|
|
38485
|
+
* - WebGPU: 0.5s (LAM inference 20-100ms + RAF jitter + React stalls)
|
|
38486
|
+
* - WASM: 1.0s (LAM inference 50-500ms + higher variability)
|
|
39672
38487
|
*
|
|
39673
|
-
*
|
|
39674
|
-
*
|
|
39675
|
-
* to natural 30fps pacing via timestamp gating.
|
|
38488
|
+
* Last-Frame-Hold: Returns last valid frame instead of null to prevent
|
|
38489
|
+
* avatar freezing when between frames (RAF at 60fps vs LAM at 30fps).
|
|
39676
38490
|
*
|
|
39677
38491
|
* @param currentTime - Current AudioContext time
|
|
39678
38492
|
* @param lam - LAM inference engine (optional, for backend detection)
|
|
39679
38493
|
* @returns Current frame, or last frame as fallback, or null if no frames yet
|
|
39680
38494
|
*/
|
|
39681
38495
|
getFrameForTime(currentTime, lam) {
|
|
39682
|
-
const discardWindow = lam?.backend === "wasm" ?
|
|
38496
|
+
const discardWindow = lam?.backend === "wasm" ? 1 : 0.5;
|
|
38497
|
+
let discardedCount = 0;
|
|
39683
38498
|
while (this.frameQueue.length > 0 && this.frameQueue[0].timestamp < currentTime - discardWindow) {
|
|
39684
|
-
this.frameQueue.shift();
|
|
38499
|
+
const discarded = this.frameQueue.shift();
|
|
38500
|
+
discardedCount++;
|
|
38501
|
+
if (discardedCount === 1) {
|
|
38502
|
+
const ageMs = ((currentTime - discarded.timestamp) * 1e3).toFixed(0);
|
|
38503
|
+
console.warn("[LAM] Frame(s) discarded as too old", {
|
|
38504
|
+
ageMs,
|
|
38505
|
+
discardWindowMs: discardWindow * 1e3,
|
|
38506
|
+
queueLength: this.frameQueue.length,
|
|
38507
|
+
backend: lam?.backend ?? "unknown"
|
|
38508
|
+
});
|
|
38509
|
+
}
|
|
39685
38510
|
}
|
|
39686
38511
|
if (this.frameQueue.length > 0 && this.frameQueue[0].timestamp <= currentTime) {
|
|
39687
38512
|
const { frame } = this.frameQueue.shift();
|
|
@@ -39700,7 +38525,7 @@ var LAMPipeline = class {
|
|
|
39700
38525
|
* Get current buffer fill level (0-1)
|
|
39701
38526
|
*/
|
|
39702
38527
|
get fillLevel() {
|
|
39703
|
-
return Math.min(1, this.buffer.length / this.
|
|
38528
|
+
return Math.min(1, this.buffer.length / this.REQUIRED_SAMPLES);
|
|
39704
38529
|
}
|
|
39705
38530
|
/**
|
|
39706
38531
|
* Get number of frames queued
|
|
@@ -39717,7 +38542,7 @@ var LAMPipeline = class {
|
|
|
39717
38542
|
/**
|
|
39718
38543
|
* Flush remaining buffered audio
|
|
39719
38544
|
*
|
|
39720
|
-
* Processes any remaining audio in the buffer, even if less than
|
|
38545
|
+
* Processes any remaining audio in the buffer, even if less than REQUIRED_SAMPLES.
|
|
39721
38546
|
* This ensures the final audio chunk generates blendshape frames.
|
|
39722
38547
|
*
|
|
39723
38548
|
* Should be called when audio stream ends to prevent losing the last 0-1 seconds.
|
|
@@ -39728,17 +38553,12 @@ var LAMPipeline = class {
|
|
|
39728
38553
|
if (this.buffer.length === 0) {
|
|
39729
38554
|
return;
|
|
39730
38555
|
}
|
|
38556
|
+
const padded = new Float32Array(this.REQUIRED_SAMPLES);
|
|
38557
|
+
padded.set(this.buffer, 0);
|
|
39731
38558
|
const processedStartTime = this.bufferStartTime;
|
|
39732
|
-
const sampleRate = this.options.sampleRate ?? 16e3;
|
|
39733
|
-
const minSize = lam.chunkSamples ?? this.DEFAULT_CHUNK_SAMPLES;
|
|
39734
|
-
const audioToInfer = this.buffer.length >= minSize ? this.buffer : (() => {
|
|
39735
|
-
const padded = new Float32Array(minSize);
|
|
39736
|
-
padded.set(this.buffer, 0);
|
|
39737
|
-
return padded;
|
|
39738
|
-
})();
|
|
39739
38559
|
try {
|
|
39740
|
-
const result = await lam.infer(
|
|
39741
|
-
const actualDuration = this.buffer.length / sampleRate;
|
|
38560
|
+
const result = await lam.infer(padded);
|
|
38561
|
+
const actualDuration = this.buffer.length / (this.options.sampleRate ?? 16e3);
|
|
39742
38562
|
const frameDuration = 1 / this.FRAME_RATE;
|
|
39743
38563
|
const actualFrameCount = Math.ceil(actualDuration * this.FRAME_RATE);
|
|
39744
38564
|
for (let i = 0; i < Math.min(actualFrameCount, result.blendshapes.length); i++) {
|
|
@@ -39797,13 +38617,12 @@ var SyncedAudioPipeline = class extends EventEmitter {
|
|
|
39797
38617
|
this.monitorInterval = null;
|
|
39798
38618
|
this.frameAnimationId = null;
|
|
39799
38619
|
const sampleRate = options.sampleRate ?? 16e3;
|
|
39800
|
-
|
|
39801
|
-
|
|
39802
|
-
|
|
39803
|
-
|
|
39804
|
-
|
|
39805
|
-
|
|
39806
|
-
this.scheduler = new AudioScheduler({ sampleRate, initialDelayS });
|
|
38620
|
+
const autoDelay = options.lam.modelId === "wav2arkit_cpu" ? 750 : options.lam.backend === "wasm" ? 350 : 50;
|
|
38621
|
+
const audioDelayMs = options.audioDelayMs ?? autoDelay;
|
|
38622
|
+
this.scheduler = new AudioScheduler({
|
|
38623
|
+
sampleRate,
|
|
38624
|
+
initialLookaheadSec: audioDelayMs / 1e3
|
|
38625
|
+
});
|
|
39807
38626
|
this.coalescer = new AudioChunkCoalescer({
|
|
39808
38627
|
sampleRate,
|
|
39809
38628
|
targetDurationMs: options.chunkTargetMs ?? 200
|
|
@@ -40554,9 +39373,9 @@ function configureCacheLimit(config) {
|
|
|
40554
39373
|
function getCacheConfig() {
|
|
40555
39374
|
return { ...globalCacheConfig };
|
|
40556
39375
|
}
|
|
40557
|
-
function getCacheKey(url,
|
|
40558
|
-
if (
|
|
40559
|
-
return `${url}#v${
|
|
39376
|
+
function getCacheKey(url, version) {
|
|
39377
|
+
if (version) {
|
|
39378
|
+
return `${url}#v${version}`;
|
|
40560
39379
|
}
|
|
40561
39380
|
return url;
|
|
40562
39381
|
}
|
|
@@ -40780,12 +39599,12 @@ var ModelCache = class {
|
|
|
40780
39599
|
* @param etag - Optional ETag for staleness validation
|
|
40781
39600
|
* @param version - Optional version string for metadata
|
|
40782
39601
|
*/
|
|
40783
|
-
async set(url, data, etag,
|
|
39602
|
+
async set(url, data, etag, version) {
|
|
40784
39603
|
const telemetry = getTelemetry();
|
|
40785
39604
|
const span = telemetry?.startSpan("ModelCache.set", {
|
|
40786
39605
|
"cache.url": url,
|
|
40787
39606
|
"cache.size_bytes": data.byteLength,
|
|
40788
|
-
...
|
|
39607
|
+
...version && { "cache.version": version }
|
|
40789
39608
|
});
|
|
40790
39609
|
try {
|
|
40791
39610
|
this.checkQuota().catch((err) => {
|
|
@@ -40803,7 +39622,7 @@ var ModelCache = class {
|
|
|
40803
39622
|
cachedAt: now,
|
|
40804
39623
|
lastAccessedAt: now,
|
|
40805
39624
|
etag,
|
|
40806
|
-
version
|
|
39625
|
+
version
|
|
40807
39626
|
};
|
|
40808
39627
|
const request = store.put(cached);
|
|
40809
39628
|
request.onsuccess = () => {
|
|
@@ -41045,13 +39864,13 @@ async function fetchWithCache(url, optionsOrProgress) {
|
|
|
41045
39864
|
} else if (optionsOrProgress) {
|
|
41046
39865
|
options = optionsOrProgress;
|
|
41047
39866
|
}
|
|
41048
|
-
const { version
|
|
39867
|
+
const { version, validateStale = false, onProgress } = options;
|
|
41049
39868
|
const cache = getModelCache();
|
|
41050
|
-
const cacheKey =
|
|
39869
|
+
const cacheKey = version ? getCacheKey(url, version) : url;
|
|
41051
39870
|
const telemetry = getTelemetry();
|
|
41052
39871
|
const span = telemetry?.startSpan("fetchWithCache", {
|
|
41053
39872
|
"fetch.url": url,
|
|
41054
|
-
...
|
|
39873
|
+
...version && { "fetch.version": version },
|
|
41055
39874
|
"fetch.validate_stale": validateStale
|
|
41056
39875
|
});
|
|
41057
39876
|
if (validateStale) {
|
|
@@ -41106,7 +39925,7 @@ async function fetchWithCache(url, optionsOrProgress) {
|
|
|
41106
39925
|
if (!response.body) {
|
|
41107
39926
|
const data2 = await response.arrayBuffer();
|
|
41108
39927
|
if (!tooLargeForCache) {
|
|
41109
|
-
await cache.set(cacheKey, data2, etag,
|
|
39928
|
+
await cache.set(cacheKey, data2, etag, version);
|
|
41110
39929
|
}
|
|
41111
39930
|
span?.setAttributes({
|
|
41112
39931
|
"fetch.size_bytes": data2.byteLength,
|
|
@@ -41133,7 +39952,7 @@ async function fetchWithCache(url, optionsOrProgress) {
|
|
|
41133
39952
|
}
|
|
41134
39953
|
const buffer = data.buffer;
|
|
41135
39954
|
if (!tooLargeForCache) {
|
|
41136
|
-
await cache.set(cacheKey, buffer, etag,
|
|
39955
|
+
await cache.set(cacheKey, buffer, etag, version);
|
|
41137
39956
|
console.log(`[ModelCache] Cached: ${url} (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB)`);
|
|
41138
39957
|
}
|
|
41139
39958
|
span?.setAttributes({
|
|
@@ -41435,9 +40254,7 @@ var noopLogger = {
|
|
|
41435
40254
|
function isIOSSafari() {
|
|
41436
40255
|
if (typeof navigator === "undefined") return false;
|
|
41437
40256
|
const ua = navigator.userAgent.toLowerCase();
|
|
41438
|
-
return /iphone|ipad|ipod/.test(ua)
|
|
41439
|
-
// Only force WASM on actual iOS devices
|
|
41440
|
-
/safari/.test(ua) && /mobile/.test(ua) && !/chrome|crios|fxios/.test(ua);
|
|
40257
|
+
return /iphone|ipad|ipod/.test(ua) && /safari/.test(ua) && !/chrome|crios|fxios|chromium|edg/.test(ua);
|
|
41441
40258
|
}
|
|
41442
40259
|
function isIOS() {
|
|
41443
40260
|
if (typeof navigator === "undefined") return false;
|
|
@@ -41495,10 +40312,7 @@ function getOptimalWasmThreads() {
|
|
|
41495
40312
|
return 4;
|
|
41496
40313
|
}
|
|
41497
40314
|
function shouldEnableWasmProxy() {
|
|
41498
|
-
|
|
41499
|
-
return false;
|
|
41500
|
-
}
|
|
41501
|
-
return true;
|
|
40315
|
+
return false;
|
|
41502
40316
|
}
|
|
41503
40317
|
function isSafari() {
|
|
41504
40318
|
if (typeof navigator === "undefined") return false;
|
|
@@ -41513,7 +40327,7 @@ function isSpeechRecognitionAvailable() {
|
|
|
41513
40327
|
return "SpeechRecognition" in window || "webkitSpeechRecognition" in window;
|
|
41514
40328
|
}
|
|
41515
40329
|
function shouldUseNativeASR() {
|
|
41516
|
-
return isIOS() && isSpeechRecognitionAvailable();
|
|
40330
|
+
return (isIOS() || isSafari()) && isSpeechRecognitionAvailable();
|
|
41517
40331
|
}
|
|
41518
40332
|
function shouldUseServerLipSync() {
|
|
41519
40333
|
return isIOS();
|
|
@@ -41526,11 +40340,13 @@ var loadedBackend = null;
|
|
|
41526
40340
|
var WASM_CDN_PATH = "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.2/dist/";
|
|
41527
40341
|
async function isWebGPUAvailable() {
|
|
41528
40342
|
if (isIOS()) {
|
|
41529
|
-
logger.debug("WebGPU check: iOS
|
|
40343
|
+
logger.debug("WebGPU check: disabled on iOS (asyncify bundle crashes WebKit)");
|
|
41530
40344
|
return false;
|
|
41531
40345
|
}
|
|
41532
40346
|
if (!hasWebGPUApi()) {
|
|
41533
|
-
logger.debug("WebGPU check: navigator.gpu not available"
|
|
40347
|
+
logger.debug("WebGPU check: navigator.gpu not available", {
|
|
40348
|
+
isSecureContext: typeof window !== "undefined" ? window.isSecureContext : "N/A"
|
|
40349
|
+
});
|
|
41534
40350
|
return false;
|
|
41535
40351
|
}
|
|
41536
40352
|
try {
|
|
@@ -41554,14 +40370,20 @@ async function isWebGPUAvailable() {
|
|
|
41554
40370
|
}
|
|
41555
40371
|
var iosWasmPatched = false;
|
|
41556
40372
|
function applyIOSWasmMemoryPatch() {
|
|
41557
|
-
if (iosWasmPatched || !
|
|
40373
|
+
if (iosWasmPatched || !isIOSSafari()) return;
|
|
41558
40374
|
iosWasmPatched = true;
|
|
41559
40375
|
const OrigMemory = WebAssembly.Memory;
|
|
41560
|
-
const MAX_IOS_PAGES =
|
|
41561
|
-
logger.info("Applying iOS WASM memory patch (max
|
|
40376
|
+
const MAX_IOS_PAGES = 32768;
|
|
40377
|
+
logger.info("Applying iOS WASM memory patch (max\u21922GB, shared preserved)");
|
|
41562
40378
|
WebAssembly.Memory = function IOSPatchedMemory(descriptor) {
|
|
41563
40379
|
const patched = { ...descriptor };
|
|
41564
40380
|
if (patched.maximum !== void 0 && patched.maximum > MAX_IOS_PAGES) {
|
|
40381
|
+
logger.info("iOS memory patch: capping maximum", {
|
|
40382
|
+
original: patched.maximum,
|
|
40383
|
+
capped: MAX_IOS_PAGES,
|
|
40384
|
+
shared: patched.shared,
|
|
40385
|
+
initial: patched.initial
|
|
40386
|
+
});
|
|
41565
40387
|
patched.maximum = MAX_IOS_PAGES;
|
|
41566
40388
|
}
|
|
41567
40389
|
return new OrigMemory(patched);
|
|
@@ -41595,7 +40417,10 @@ async function getOnnxRuntime(backend) {
|
|
|
41595
40417
|
logger.info(`Loading ONNX Runtime with ${backend} backend...`);
|
|
41596
40418
|
applyIOSWasmMemoryPatch();
|
|
41597
40419
|
try {
|
|
41598
|
-
if (backend === "wasm") {
|
|
40420
|
+
if (backend === "wasm" && (isIOS() || isSafari())) {
|
|
40421
|
+
const module2 = await import("onnxruntime-web/wasm");
|
|
40422
|
+
ortInstance = module2.default || module2;
|
|
40423
|
+
} else if (backend === "wasm") {
|
|
41599
40424
|
const module2 = await import("onnxruntime-web");
|
|
41600
40425
|
ortInstance = module2.default || module2;
|
|
41601
40426
|
} else {
|
|
@@ -41670,6 +40495,16 @@ function getLoadedBackend() {
|
|
|
41670
40495
|
function isOnnxRuntimeLoaded() {
|
|
41671
40496
|
return ortInstance !== null;
|
|
41672
40497
|
}
|
|
40498
|
+
async function preloadOnnxRuntime(preference = "auto") {
|
|
40499
|
+
if (ortInstance) {
|
|
40500
|
+
logger.info("ONNX Runtime already preloaded", { backend: loadedBackend });
|
|
40501
|
+
return loadedBackend;
|
|
40502
|
+
}
|
|
40503
|
+
logger.info("Preloading ONNX Runtime...", { preference });
|
|
40504
|
+
const { backend } = await getOnnxRuntimeForPreference(preference);
|
|
40505
|
+
logger.info("ONNX Runtime preloaded", { backend });
|
|
40506
|
+
return backend;
|
|
40507
|
+
}
|
|
41673
40508
|
|
|
41674
40509
|
// src/inference/blendshapeUtils.ts
|
|
41675
40510
|
var LAM_BLENDSHAPES = [
|
|
@@ -41865,6 +40700,7 @@ var CTC_VOCAB = [
|
|
|
41865
40700
|
];
|
|
41866
40701
|
var Wav2Vec2Inference = class {
|
|
41867
40702
|
constructor(config) {
|
|
40703
|
+
this.modelId = "wav2vec2";
|
|
41868
40704
|
this.session = null;
|
|
41869
40705
|
this.ort = null;
|
|
41870
40706
|
this._backend = "wasm";
|
|
@@ -41925,13 +40761,52 @@ var Wav2Vec2Inference = class {
|
|
|
41925
40761
|
logger2.error(errorMsg, { modelUrl, isCached });
|
|
41926
40762
|
throw new Error(errorMsg);
|
|
41927
40763
|
}
|
|
40764
|
+
let externalDataBuffer = null;
|
|
40765
|
+
if (this.config.externalDataUrl !== false) {
|
|
40766
|
+
const dataUrl = typeof this.config.externalDataUrl === "string" ? this.config.externalDataUrl : `${modelUrl}.data`;
|
|
40767
|
+
try {
|
|
40768
|
+
const isDataCached = await cache.has(dataUrl);
|
|
40769
|
+
if (isDataCached) {
|
|
40770
|
+
logger2.debug("Loading external data from cache", { dataUrl });
|
|
40771
|
+
externalDataBuffer = await cache.get(dataUrl);
|
|
40772
|
+
if (!externalDataBuffer) {
|
|
40773
|
+
logger2.warn("Cache corruption for external data, retrying", { dataUrl });
|
|
40774
|
+
await cache.delete(dataUrl);
|
|
40775
|
+
externalDataBuffer = await fetchWithCache(dataUrl);
|
|
40776
|
+
}
|
|
40777
|
+
} else {
|
|
40778
|
+
logger2.info("Fetching external model data", {
|
|
40779
|
+
dataUrl,
|
|
40780
|
+
note: "This may be a large download (383MB+)"
|
|
40781
|
+
});
|
|
40782
|
+
externalDataBuffer = await fetchWithCache(dataUrl);
|
|
40783
|
+
}
|
|
40784
|
+
logger2.info("External data loaded", {
|
|
40785
|
+
size: formatBytes(externalDataBuffer.byteLength)
|
|
40786
|
+
});
|
|
40787
|
+
} catch (err) {
|
|
40788
|
+
logger2.debug("No external data file found (single-file model)", {
|
|
40789
|
+
dataUrl,
|
|
40790
|
+
error: err.message
|
|
40791
|
+
});
|
|
40792
|
+
}
|
|
40793
|
+
}
|
|
41928
40794
|
logger2.debug("Creating ONNX session", {
|
|
41929
|
-
|
|
40795
|
+
graphSize: formatBytes(modelBuffer.byteLength),
|
|
40796
|
+
externalDataSize: externalDataBuffer ? formatBytes(externalDataBuffer.byteLength) : "none",
|
|
41930
40797
|
backend: this._backend
|
|
41931
40798
|
});
|
|
41932
40799
|
const sessionOptions = getSessionOptions(this._backend);
|
|
40800
|
+
if (externalDataBuffer) {
|
|
40801
|
+
const dataFilename = (typeof this.config.externalDataUrl === "string" ? this.config.externalDataUrl : `${modelUrl}.data`).split("/").pop();
|
|
40802
|
+
sessionOptions.externalData = [{
|
|
40803
|
+
path: dataFilename,
|
|
40804
|
+
data: new Uint8Array(externalDataBuffer)
|
|
40805
|
+
}];
|
|
40806
|
+
}
|
|
41933
40807
|
logger2.info("Creating session with execution provider", {
|
|
41934
|
-
executionProvider: this._backend
|
|
40808
|
+
executionProvider: this._backend,
|
|
40809
|
+
hasExternalData: !!externalDataBuffer
|
|
41935
40810
|
});
|
|
41936
40811
|
const modelData = new Uint8Array(modelBuffer);
|
|
41937
40812
|
this.session = await this.ort.InferenceSession.create(modelData, sessionOptions);
|
|
@@ -42178,7 +41053,7 @@ var WhisperInference = class _WhisperInference {
|
|
|
42178
41053
|
* Check if WebGPU is available in this browser
|
|
42179
41054
|
*/
|
|
42180
41055
|
static async isWebGPUAvailable() {
|
|
42181
|
-
return
|
|
41056
|
+
return "gpu" in navigator;
|
|
42182
41057
|
}
|
|
42183
41058
|
/**
|
|
42184
41059
|
* Load the Whisper model pipeline
|
|
@@ -42473,18 +41348,13 @@ var WhisperInference = class _WhisperInference {
|
|
|
42473
41348
|
var logger5 = createLogger("Wav2ArkitCpu");
|
|
42474
41349
|
var Wav2ArkitCpuInference = class {
|
|
42475
41350
|
constructor(config) {
|
|
41351
|
+
this.modelId = "wav2arkit_cpu";
|
|
42476
41352
|
this.session = null;
|
|
42477
41353
|
this.ort = null;
|
|
42478
41354
|
this._backend = "wasm";
|
|
42479
41355
|
this.isLoading = false;
|
|
42480
41356
|
// Inference queue for handling concurrent calls
|
|
42481
41357
|
this.inferenceQueue = Promise.resolve();
|
|
42482
|
-
/**
|
|
42483
|
-
* Preferred chunk size: 4000 samples (250ms at 16kHz).
|
|
42484
|
-
* wav2arkit_cpu accepts variable-length input, so we use smaller chunks
|
|
42485
|
-
* for lower latency on WASM (vs 16000 for Wav2Vec2's fixed requirement).
|
|
42486
|
-
*/
|
|
42487
|
-
this.chunkSamples = 4e3;
|
|
42488
41358
|
this.config = config;
|
|
42489
41359
|
}
|
|
42490
41360
|
get backend() {
|
|
@@ -42518,23 +41388,25 @@ var Wav2ArkitCpuInference = class {
|
|
|
42518
41388
|
this._backend = backend;
|
|
42519
41389
|
logger5.info("ONNX Runtime loaded", { backend: this._backend });
|
|
42520
41390
|
const modelUrl = this.config.modelUrl;
|
|
42521
|
-
const
|
|
42522
|
-
|
|
42523
|
-
if (isIOS()
|
|
42524
|
-
|
|
42525
|
-
sessionOptions.externalData = [{
|
|
42526
|
-
path: dataFilename,
|
|
42527
|
-
data: this.config.modelDataUrl
|
|
42528
|
-
}];
|
|
42529
|
-
logger5.info("iOS: URL-based session creation (ORT handles fetch internally)", {
|
|
41391
|
+
const dataUrl = this.config.externalDataUrl !== false ? this.config.externalDataUrl || `${modelUrl}.data` : null;
|
|
41392
|
+
const sessionOptions = getSessionOptions(this._backend);
|
|
41393
|
+
if (isIOS()) {
|
|
41394
|
+
logger5.info("iOS: passing model URLs directly to ORT (low-memory path)", {
|
|
42530
41395
|
modelUrl,
|
|
42531
|
-
|
|
42532
|
-
dataUrl: this.config.modelDataUrl
|
|
41396
|
+
dataUrl
|
|
42533
41397
|
});
|
|
41398
|
+
if (dataUrl) {
|
|
41399
|
+
const dataFilename = dataUrl.split("/").pop();
|
|
41400
|
+
sessionOptions.externalData = [{
|
|
41401
|
+
path: dataFilename,
|
|
41402
|
+
data: dataUrl
|
|
41403
|
+
// URL string — ORT fetches directly into WASM
|
|
41404
|
+
}];
|
|
41405
|
+
}
|
|
42534
41406
|
this.session = await this.ort.InferenceSession.create(modelUrl, sessionOptions);
|
|
42535
41407
|
} else {
|
|
42536
41408
|
const cache = getModelCache();
|
|
42537
|
-
isCached = await cache.has(modelUrl);
|
|
41409
|
+
const isCached = await cache.has(modelUrl);
|
|
42538
41410
|
let modelBuffer;
|
|
42539
41411
|
if (isCached) {
|
|
42540
41412
|
logger5.debug("Loading model from cache", { modelUrl });
|
|
@@ -42545,42 +41417,48 @@ var Wav2ArkitCpuInference = class {
|
|
|
42545
41417
|
modelBuffer = await fetchWithCache(modelUrl);
|
|
42546
41418
|
}
|
|
42547
41419
|
} else {
|
|
42548
|
-
logger5.debug("Fetching and caching model", { modelUrl });
|
|
41420
|
+
logger5.debug("Fetching and caching model graph", { modelUrl });
|
|
42549
41421
|
modelBuffer = await fetchWithCache(modelUrl);
|
|
42550
41422
|
}
|
|
42551
41423
|
if (!modelBuffer) {
|
|
42552
41424
|
throw new Error(`Failed to load model: ${modelUrl}`);
|
|
42553
41425
|
}
|
|
42554
|
-
let externalDataBuffer;
|
|
42555
|
-
if (
|
|
42556
|
-
|
|
42557
|
-
|
|
42558
|
-
|
|
42559
|
-
|
|
42560
|
-
|
|
42561
|
-
|
|
42562
|
-
|
|
42563
|
-
|
|
41426
|
+
let externalDataBuffer = null;
|
|
41427
|
+
if (dataUrl) {
|
|
41428
|
+
try {
|
|
41429
|
+
const isDataCached = await cache.has(dataUrl);
|
|
41430
|
+
if (isDataCached) {
|
|
41431
|
+
logger5.debug("Loading external data from cache", { dataUrl });
|
|
41432
|
+
externalDataBuffer = await cache.get(dataUrl);
|
|
41433
|
+
if (!externalDataBuffer) {
|
|
41434
|
+
logger5.warn("Cache corruption for external data, retrying", { dataUrl });
|
|
41435
|
+
await cache.delete(dataUrl);
|
|
41436
|
+
externalDataBuffer = await fetchWithCache(dataUrl);
|
|
41437
|
+
}
|
|
41438
|
+
} else {
|
|
41439
|
+
logger5.info("Fetching external model data", {
|
|
41440
|
+
dataUrl,
|
|
41441
|
+
note: "This may be a large download (400MB+)"
|
|
41442
|
+
});
|
|
42564
41443
|
externalDataBuffer = await fetchWithCache(dataUrl);
|
|
42565
41444
|
}
|
|
42566
|
-
|
|
42567
|
-
|
|
42568
|
-
|
|
41445
|
+
logger5.info("External data loaded", {
|
|
41446
|
+
size: formatBytes(externalDataBuffer.byteLength)
|
|
41447
|
+
});
|
|
41448
|
+
} catch (err) {
|
|
41449
|
+
logger5.debug("No external data file found (single-file model)", {
|
|
41450
|
+
dataUrl,
|
|
41451
|
+
error: err.message
|
|
42569
41452
|
});
|
|
42570
|
-
externalDataBuffer = await fetchWithCache(dataUrl);
|
|
42571
41453
|
}
|
|
42572
|
-
logger5.debug("External data loaded", {
|
|
42573
|
-
size: formatBytes(externalDataBuffer.byteLength)
|
|
42574
|
-
});
|
|
42575
41454
|
}
|
|
42576
41455
|
logger5.debug("Creating ONNX session", {
|
|
42577
|
-
|
|
42578
|
-
|
|
42579
|
-
externalDataSize: externalDataBuffer ? formatBytes(externalDataBuffer.byteLength) : void 0,
|
|
41456
|
+
graphSize: formatBytes(modelBuffer.byteLength),
|
|
41457
|
+
externalDataSize: externalDataBuffer ? formatBytes(externalDataBuffer.byteLength) : "none",
|
|
42580
41458
|
backend: this._backend
|
|
42581
41459
|
});
|
|
42582
41460
|
if (externalDataBuffer) {
|
|
42583
|
-
const dataFilename =
|
|
41461
|
+
const dataFilename = dataUrl.split("/").pop();
|
|
42584
41462
|
sessionOptions.externalData = [{
|
|
42585
41463
|
path: dataFilename,
|
|
42586
41464
|
data: new Uint8Array(externalDataBuffer)
|
|
@@ -42599,7 +41477,7 @@ var Wav2ArkitCpuInference = class {
|
|
|
42599
41477
|
span?.setAttributes({
|
|
42600
41478
|
"model.backend": this._backend,
|
|
42601
41479
|
"model.load_time_ms": loadTimeMs,
|
|
42602
|
-
"model.cached":
|
|
41480
|
+
"model.cached": !isIOS()
|
|
42603
41481
|
});
|
|
42604
41482
|
span?.end();
|
|
42605
41483
|
telemetry?.recordHistogram("omote.model.load_time", loadTimeMs, {
|
|
@@ -42680,11 +41558,11 @@ var Wav2ArkitCpuInference = class {
|
|
|
42680
41558
|
const blendshapes = [];
|
|
42681
41559
|
for (let f = 0; f < numFrames; f++) {
|
|
42682
41560
|
const rawFrame = blendshapeData.slice(f * numBlendshapes, (f + 1) * numBlendshapes);
|
|
42683
|
-
const
|
|
42684
|
-
blendshapes.push(
|
|
41561
|
+
const symmetrized = symmetrizeBlendshapes(rawFrame);
|
|
41562
|
+
blendshapes.push(symmetrized);
|
|
42685
41563
|
}
|
|
42686
41564
|
logger5.trace("Inference completed", {
|
|
42687
|
-
inferenceTimeMs: Math.round(inferenceTimeMs),
|
|
41565
|
+
inferenceTimeMs: Math.round(inferenceTimeMs * 100) / 100,
|
|
42688
41566
|
numFrames,
|
|
42689
41567
|
inputSamples
|
|
42690
41568
|
});
|
|
@@ -42750,14 +41628,14 @@ function createLipSync(config) {
|
|
|
42750
41628
|
});
|
|
42751
41629
|
}
|
|
42752
41630
|
if (useCpu) {
|
|
42753
|
-
logger6.info("Creating Wav2ArkitCpuInference (WASM)");
|
|
41631
|
+
logger6.info("Creating Wav2ArkitCpuInference (404MB, WASM)");
|
|
42754
41632
|
return new Wav2ArkitCpuInference({
|
|
42755
|
-
modelUrl: config.cpuModelUrl
|
|
42756
|
-
modelDataUrl: config.cpuModelDataUrl
|
|
41633
|
+
modelUrl: config.cpuModelUrl
|
|
42757
41634
|
});
|
|
42758
41635
|
}
|
|
42759
41636
|
const gpuInstance = new Wav2Vec2Inference({
|
|
42760
41637
|
modelUrl: config.gpuModelUrl,
|
|
41638
|
+
externalDataUrl: config.gpuExternalDataUrl,
|
|
42761
41639
|
backend: config.gpuBackend ?? "auto",
|
|
42762
41640
|
numIdentityClasses: config.numIdentityClasses
|
|
42763
41641
|
});
|
|
@@ -42774,15 +41652,15 @@ var LipSyncWithFallback = class {
|
|
|
42774
41652
|
this.implementation = gpuInstance;
|
|
42775
41653
|
this.config = config;
|
|
42776
41654
|
}
|
|
41655
|
+
get modelId() {
|
|
41656
|
+
return this.implementation.modelId;
|
|
41657
|
+
}
|
|
42777
41658
|
get backend() {
|
|
42778
41659
|
return this.implementation.backend;
|
|
42779
41660
|
}
|
|
42780
41661
|
get isLoaded() {
|
|
42781
41662
|
return this.implementation.isLoaded;
|
|
42782
41663
|
}
|
|
42783
|
-
get chunkSamples() {
|
|
42784
|
-
return this.implementation.chunkSamples;
|
|
42785
|
-
}
|
|
42786
41664
|
async load() {
|
|
42787
41665
|
try {
|
|
42788
41666
|
return await this.implementation.load();
|
|
@@ -42795,8 +41673,7 @@ var LipSyncWithFallback = class {
|
|
|
42795
41673
|
} catch {
|
|
42796
41674
|
}
|
|
42797
41675
|
this.implementation = new Wav2ArkitCpuInference({
|
|
42798
|
-
modelUrl: this.config.cpuModelUrl
|
|
42799
|
-
modelDataUrl: this.config.cpuModelDataUrl
|
|
41676
|
+
modelUrl: this.config.cpuModelUrl
|
|
42800
41677
|
});
|
|
42801
41678
|
this.hasFallenBack = true;
|
|
42802
41679
|
logger6.info("Fallback to Wav2ArkitCpuInference successful");
|
|
@@ -42826,6 +41703,8 @@ var SileroVADInference = class {
|
|
|
42826
41703
|
// Pre-speech buffer for capturing beginning of speech
|
|
42827
41704
|
this.preSpeechBuffer = [];
|
|
42828
41705
|
this.wasSpeaking = false;
|
|
41706
|
+
// Cached sample rate tensor (int64 scalar, never changes per instance)
|
|
41707
|
+
this.srTensor = null;
|
|
42829
41708
|
const sampleRate = config.sampleRate ?? 16e3;
|
|
42830
41709
|
if (sampleRate !== 8e3 && sampleRate !== 16e3) {
|
|
42831
41710
|
throw new Error("Silero VAD only supports 8000 or 16000 Hz sample rates");
|
|
@@ -42956,6 +41835,24 @@ var SileroVADInference = class {
|
|
|
42956
41835
|
this.context = new Float32Array(this.contextSize);
|
|
42957
41836
|
this.preSpeechBuffer = [];
|
|
42958
41837
|
this.wasSpeaking = false;
|
|
41838
|
+
if (!this.srTensor) {
|
|
41839
|
+
try {
|
|
41840
|
+
this.srTensor = new this.ort.Tensor(
|
|
41841
|
+
"int64",
|
|
41842
|
+
new BigInt64Array([BigInt(this.config.sampleRate)]),
|
|
41843
|
+
[]
|
|
41844
|
+
);
|
|
41845
|
+
} catch (e) {
|
|
41846
|
+
logger7.warn("BigInt64Array not available, using bigint array fallback", {
|
|
41847
|
+
error: e instanceof Error ? e.message : String(e)
|
|
41848
|
+
});
|
|
41849
|
+
this.srTensor = new this.ort.Tensor(
|
|
41850
|
+
"int64",
|
|
41851
|
+
[BigInt(this.config.sampleRate)],
|
|
41852
|
+
[]
|
|
41853
|
+
);
|
|
41854
|
+
}
|
|
41855
|
+
}
|
|
42959
41856
|
}
|
|
42960
41857
|
/**
|
|
42961
41858
|
* Process a single audio chunk
|
|
@@ -43087,20 +41984,7 @@ var SileroVADInference = class {
|
|
|
43087
41984
|
inputBuffer.set(audioChunkCopy, this.contextSize);
|
|
43088
41985
|
const inputBufferCopy = new Float32Array(inputBuffer);
|
|
43089
41986
|
const inputTensor = new this.ort.Tensor("float32", inputBufferCopy, [1, inputSize]);
|
|
43090
|
-
|
|
43091
|
-
try {
|
|
43092
|
-
srTensor = new this.ort.Tensor(
|
|
43093
|
-
"int64",
|
|
43094
|
-
new BigInt64Array([BigInt(this.config.sampleRate)]),
|
|
43095
|
-
[]
|
|
43096
|
-
);
|
|
43097
|
-
} catch {
|
|
43098
|
-
srTensor = new this.ort.Tensor(
|
|
43099
|
-
"int64",
|
|
43100
|
-
[BigInt(this.config.sampleRate)],
|
|
43101
|
-
[]
|
|
43102
|
-
);
|
|
43103
|
-
}
|
|
41987
|
+
const srTensor = this.srTensor;
|
|
43104
41988
|
const stateCopy = new Float32Array(this.state.data);
|
|
43105
41989
|
const stateTensor = new this.ort.Tensor("float32", stateCopy, this.state.dims);
|
|
43106
41990
|
const feeds = {
|
|
@@ -43189,6 +42073,7 @@ var SileroVADInference = class {
|
|
|
43189
42073
|
this.session = null;
|
|
43190
42074
|
}
|
|
43191
42075
|
this.state = null;
|
|
42076
|
+
this.srTensor = null;
|
|
43192
42077
|
}
|
|
43193
42078
|
};
|
|
43194
42079
|
/**
|
|
@@ -46001,8 +44886,8 @@ async function nukeBrowserCaches(preventRecreation = false) {
|
|
|
46001
44886
|
totalDeleted: deletedCount
|
|
46002
44887
|
});
|
|
46003
44888
|
if (preventRecreation) {
|
|
46004
|
-
const { env
|
|
46005
|
-
|
|
44889
|
+
const { env } = await Promise.resolve().then(() => (init_transformers_web(), transformers_web_exports));
|
|
44890
|
+
env.useBrowserCache = false;
|
|
46006
44891
|
logger12.warn("Browser cache creation disabled (env.useBrowserCache = false)");
|
|
46007
44892
|
}
|
|
46008
44893
|
return deletedCount;
|