@huggingface/transformers 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/ort-wasm-simd-threaded.jsep.wasm +0 -0
- package/dist/transformers.cjs +1062 -183
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.js +2239 -1232
- package/dist/transformers.js.map +1 -1
- package/dist/transformers.min.cjs +1 -358
- package/dist/transformers.min.cjs.map +1 -1
- package/dist/transformers.min.js +1 -421
- package/dist/transformers.min.js.map +1 -1
- package/dist/transformers.min.mjs +1 -358
- package/dist/transformers.min.mjs.map +1 -1
- package/dist/transformers.mjs +1082 -181
- package/dist/transformers.mjs.map +1 -1
- package/package.json +11 -16
- package/src/backends/onnx.js +2 -7
- package/src/base/image_processors_utils.js +3 -1
- package/src/configs.js +11 -2
- package/src/env.js +1 -1
- package/src/models/feature_extractors.js +1 -0
- package/src/models/idefics3/image_processing_idefics3.js +24 -13
- package/src/models/image_processors.js +1 -0
- package/src/models/moonshine/feature_extraction_moonshine.js +26 -0
- package/src/models/moonshine/processing_moonshine.js +20 -0
- package/src/models/paligemma/processing_paligemma.js +82 -0
- package/src/models/phi3_v/image_processing_phi3_v.js +163 -0
- package/src/models/phi3_v/processing_phi3_v.js +53 -0
- package/src/models/processors.js +3 -0
- package/src/models/pyannote/feature_extraction_pyannote.js +56 -0
- package/src/models/pyannote/processing_pyannote.js +7 -54
- package/src/models.js +233 -35
- package/src/ops/registry.js +11 -0
- package/src/pipelines.js +30 -0
- package/src/tokenizers.js +12 -1
- package/src/utils/core.js +39 -9
- package/src/utils/hub.js +8 -12
- package/src/utils/image.js +40 -0
- package/src/utils/tensor.js +51 -1
- package/types/backends/onnx.d.ts +2 -2
- package/types/backends/onnx.d.ts.map +1 -1
- package/types/base/feature_extraction_utils.d.ts +1 -1
- package/types/base/feature_extraction_utils.d.ts.map +1 -1
- package/types/base/image_processors_utils.d.ts +4 -4
- package/types/base/image_processors_utils.d.ts.map +1 -1
- package/types/base/processing_utils.d.ts +4 -4
- package/types/base/processing_utils.d.ts.map +1 -1
- package/types/configs.d.ts +7 -7
- package/types/configs.d.ts.map +1 -1
- package/types/env.d.ts +1 -1
- package/types/env.d.ts.map +1 -1
- package/types/generation/configuration_utils.d.ts +2 -2
- package/types/generation/logits_process.d.ts +2 -2
- package/types/generation/logits_process.d.ts.map +1 -1
- package/types/generation/logits_sampler.d.ts.map +1 -1
- package/types/generation/parameters.d.ts +5 -5
- package/types/generation/stopping_criteria.d.ts +1 -1
- package/types/generation/stopping_criteria.d.ts.map +1 -1
- package/types/generation/streamers.d.ts +2 -2
- package/types/generation/streamers.d.ts.map +1 -1
- package/types/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.d.ts +1 -1
- package/types/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.d.ts.map +1 -1
- package/types/models/auto/feature_extraction_auto.d.ts.map +1 -1
- package/types/models/auto/image_processing_auto.d.ts.map +1 -1
- package/types/models/auto/processing_auto.d.ts +1 -1
- package/types/models/auto/processing_auto.d.ts.map +1 -1
- package/types/models/clap/feature_extraction_clap.d.ts +1 -1
- package/types/models/clap/feature_extraction_clap.d.ts.map +1 -1
- package/types/models/detr/image_processing_detr.d.ts +11 -11
- package/types/models/detr/image_processing_detr.d.ts.map +1 -1
- package/types/models/donut/image_processing_donut.d.ts +1 -1
- package/types/models/donut/image_processing_donut.d.ts.map +1 -1
- package/types/models/feature_extractors.d.ts +1 -0
- package/types/models/florence2/processing_florence2.d.ts.map +1 -1
- package/types/models/idefics3/image_processing_idefics3.d.ts.map +1 -1
- package/types/models/idefics3/processing_idefics3.d.ts.map +1 -1
- package/types/models/image_processors.d.ts +1 -0
- package/types/models/janus/image_processing_janus.d.ts +1 -1
- package/types/models/janus/image_processing_janus.d.ts.map +1 -1
- package/types/models/janus/processing_janus.d.ts.map +1 -1
- package/types/models/maskformer/image_processing_maskformer.d.ts +8 -8
- package/types/models/maskformer/image_processing_maskformer.d.ts.map +1 -1
- package/types/models/mgp_str/processing_mgp_str.d.ts +2 -2
- package/types/models/mgp_str/processing_mgp_str.d.ts.map +1 -1
- package/types/models/moonshine/feature_extraction_moonshine.d.ts +13 -0
- package/types/models/moonshine/feature_extraction_moonshine.d.ts.map +1 -0
- package/types/models/moonshine/processing_moonshine.d.ts +17 -0
- package/types/models/moonshine/processing_moonshine.d.ts.map +1 -0
- package/types/models/owlvit/image_processing_owlvit.d.ts.map +1 -1
- package/types/models/paligemma/processing_paligemma.d.ts +12 -0
- package/types/models/paligemma/processing_paligemma.d.ts.map +1 -0
- package/types/models/phi3_v/image_processing_phi3_v.d.ts +17 -0
- package/types/models/phi3_v/image_processing_phi3_v.d.ts.map +1 -0
- package/types/models/phi3_v/processing_phi3_v.d.ts +17 -0
- package/types/models/phi3_v/processing_phi3_v.d.ts.map +1 -0
- package/types/models/processors.d.ts +3 -0
- package/types/models/pyannote/feature_extraction_pyannote.d.ts +18 -0
- package/types/models/pyannote/feature_extraction_pyannote.d.ts.map +1 -1
- package/types/models/pyannote/processing_pyannote.d.ts +4 -15
- package/types/models/pyannote/processing_pyannote.d.ts.map +1 -1
- package/types/models/qwen2_vl/processing_qwen2_vl.d.ts.map +1 -1
- package/types/models/rt_detr/image_processing_rt_detr.d.ts.map +1 -1
- package/types/models/sam/image_processing_sam.d.ts.map +1 -1
- package/types/models/seamless_m4t/feature_extraction_seamless_m4t.d.ts +1 -1
- package/types/models/seamless_m4t/feature_extraction_seamless_m4t.d.ts.map +1 -1
- package/types/models/segformer/image_processing_segformer.d.ts.map +1 -1
- package/types/models/speecht5/processing_speecht5.d.ts.map +1 -1
- package/types/models/swin2sr/image_processing_swin2sr.d.ts +1 -1
- package/types/models/swin2sr/image_processing_swin2sr.d.ts.map +1 -1
- package/types/models/vitmatte/image_processing_vitmatte.d.ts.map +1 -1
- package/types/models/vitpose/image_processing_vitpose.d.ts +1 -1
- package/types/models/vitpose/image_processing_vitpose.d.ts.map +1 -1
- package/types/models/wav2vec2/feature_extraction_wav2vec2.d.ts.map +1 -1
- package/types/models/wav2vec2/processing_wav2vec2.d.ts.map +1 -1
- package/types/models/wespeaker/feature_extraction_wespeaker.d.ts +1 -1
- package/types/models/wespeaker/feature_extraction_wespeaker.d.ts.map +1 -1
- package/types/models/whisper/feature_extraction_whisper.d.ts +1 -1
- package/types/models/whisper/feature_extraction_whisper.d.ts.map +1 -1
- package/types/models/whisper/generation_whisper.d.ts.map +1 -1
- package/types/models/whisper/processing_whisper.d.ts.map +1 -1
- package/types/models/yolos/image_processing_yolos.d.ts.map +1 -1
- package/types/models.d.ts +61 -5
- package/types/models.d.ts.map +1 -1
- package/types/ops/registry.d.ts +1 -0
- package/types/ops/registry.d.ts.map +1 -1
- package/types/pipelines.d.ts +31 -51
- package/types/pipelines.d.ts.map +1 -1
- package/types/tokenizers.d.ts +10 -6
- package/types/tokenizers.d.ts.map +1 -1
- package/types/utils/audio.d.ts.map +1 -1
- package/types/utils/constants.d.ts.map +1 -1
- package/types/utils/core.d.ts +87 -22
- package/types/utils/core.d.ts.map +1 -1
- package/types/utils/data-structures.d.ts.map +1 -1
- package/types/utils/devices.d.ts.map +1 -1
- package/types/utils/dtypes.d.ts.map +1 -1
- package/types/utils/generic.d.ts.map +1 -1
- package/types/utils/hub.d.ts +3 -3
- package/types/utils/hub.d.ts.map +1 -1
- package/types/utils/image.d.ts +10 -1
- package/types/utils/image.d.ts.map +1 -1
- package/types/utils/maths.d.ts +10 -10
- package/types/utils/maths.d.ts.map +1 -1
- package/types/utils/tensor.d.ts +22 -6
- package/types/utils/tensor.d.ts.map +1 -1
package/src/utils/core.js
CHANGED
|
@@ -9,15 +9,45 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @typedef {Object}
|
|
13
|
-
* @property {'initiate'
|
|
14
|
-
* @property {string} name
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @
|
|
20
|
-
* @property {
|
|
12
|
+
* @typedef {Object} InitiateProgressInfo
|
|
13
|
+
* @property {'initiate'} status
|
|
14
|
+
* @property {string} name The model id or directory path.
|
|
15
|
+
* @property {string} file The name of the file.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} DownloadProgressInfo
|
|
20
|
+
* @property {'download'} status
|
|
21
|
+
* @property {string} name The model id or directory path.
|
|
22
|
+
* @property {string} file The name of the file.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {Object} ProgressStatusInfo
|
|
27
|
+
* @property {'progress'} status
|
|
28
|
+
* @property {string} name The model id or directory path.
|
|
29
|
+
* @property {string} file The name of the file.
|
|
30
|
+
* @property {number} progress A number between 0 and 100.
|
|
31
|
+
* @property {number} loaded The number of bytes loaded.
|
|
32
|
+
* @property {number} total The total number of bytes to be loaded.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} DoneProgressInfo
|
|
37
|
+
* @property {'done'} status
|
|
38
|
+
* @property {string} name The model id or directory path.
|
|
39
|
+
* @property {string} file The name of the file.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {Object} ReadyProgressInfo
|
|
44
|
+
* @property {'ready'} status
|
|
45
|
+
* @property {string} task The loaded task.
|
|
46
|
+
* @property {string} model The loaded model.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {InitiateProgressInfo | DownloadProgressInfo | ProgressStatusInfo | DoneProgressInfo | ReadyProgressInfo} ProgressInfo
|
|
21
51
|
*/
|
|
22
52
|
|
|
23
53
|
/**
|
package/src/utils/hub.js
CHANGED
|
@@ -504,13 +504,6 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
|
|
|
504
504
|
file: filename
|
|
505
505
|
})
|
|
506
506
|
|
|
507
|
-
/** @type {import('./core.js').ProgressInfo} */
|
|
508
|
-
const progressInfo = {
|
|
509
|
-
status: 'progress',
|
|
510
|
-
name: path_or_repo_id,
|
|
511
|
-
file: filename
|
|
512
|
-
}
|
|
513
|
-
|
|
514
507
|
/** @type {Uint8Array} */
|
|
515
508
|
let buffer;
|
|
516
509
|
|
|
@@ -530,7 +523,9 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
|
|
|
530
523
|
|
|
531
524
|
// For completeness, we still fire the final progress callback
|
|
532
525
|
dispatchCallback(options.progress_callback, {
|
|
533
|
-
|
|
526
|
+
status: 'progress',
|
|
527
|
+
name: path_or_repo_id,
|
|
528
|
+
file: filename,
|
|
534
529
|
progress: 100,
|
|
535
530
|
loaded: buffer.length,
|
|
536
531
|
total: buffer.length,
|
|
@@ -538,7 +533,9 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
|
|
|
538
533
|
} else {
|
|
539
534
|
buffer = await readResponse(response, data => {
|
|
540
535
|
dispatchCallback(options.progress_callback, {
|
|
541
|
-
|
|
536
|
+
status: 'progress',
|
|
537
|
+
name: path_or_repo_id,
|
|
538
|
+
file: filename,
|
|
542
539
|
...data,
|
|
543
540
|
})
|
|
544
541
|
})
|
|
@@ -595,12 +592,11 @@ export async function getModelJSON(modelPath, fileName, fatal = true, options =
|
|
|
595
592
|
|
|
596
593
|
return JSON.parse(jsonData);
|
|
597
594
|
}
|
|
598
|
-
|
|
599
595
|
/**
|
|
600
596
|
* Read and track progress when reading a Response object
|
|
601
597
|
*
|
|
602
|
-
* @param {
|
|
603
|
-
* @param {
|
|
598
|
+
* @param {Response|FileResponse} response The Response object to read
|
|
599
|
+
* @param {(data: {progress: number, loaded: number, total: number}) => void} progress_callback The function to call with progress updates
|
|
604
600
|
* @returns {Promise<Uint8Array>} A Promise that resolves with the Uint8Array buffer
|
|
605
601
|
*/
|
|
606
602
|
async function readResponse(response, progress_callback) {
|
package/src/utils/image.js
CHANGED
|
@@ -303,6 +303,46 @@ export class RawImage {
|
|
|
303
303
|
return this._update(newData, this.width, this.height, 4);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Apply an alpha mask to the image. Operates in place.
|
|
308
|
+
* @param {RawImage} mask The mask to apply. It should have a single channel.
|
|
309
|
+
* @returns {RawImage} The masked image.
|
|
310
|
+
* @throws {Error} If the mask is not the same size as the image.
|
|
311
|
+
* @throws {Error} If the image does not have 4 channels.
|
|
312
|
+
* @throws {Error} If the mask is not a single channel.
|
|
313
|
+
*/
|
|
314
|
+
putAlpha(mask) {
|
|
315
|
+
if (mask.width !== this.width || mask.height !== this.height) {
|
|
316
|
+
throw new Error(`Expected mask size to be ${this.width}x${this.height}, but got ${mask.width}x${mask.height}`);
|
|
317
|
+
}
|
|
318
|
+
if (mask.channels !== 1) {
|
|
319
|
+
throw new Error(`Expected mask to have 1 channel, but got ${mask.channels}`);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const this_data = this.data;
|
|
323
|
+
const mask_data = mask.data;
|
|
324
|
+
const num_pixels = this.width * this.height;
|
|
325
|
+
if (this.channels === 3) {
|
|
326
|
+
// Convert to RGBA and simultaneously apply mask to alpha channel
|
|
327
|
+
const newData = new Uint8ClampedArray(num_pixels * 4);
|
|
328
|
+
for (let i = 0, in_offset = 0, out_offset = 0; i < num_pixels; ++i) {
|
|
329
|
+
newData[out_offset++] = this_data[in_offset++];
|
|
330
|
+
newData[out_offset++] = this_data[in_offset++];
|
|
331
|
+
newData[out_offset++] = this_data[in_offset++];
|
|
332
|
+
newData[out_offset++] = mask_data[i];
|
|
333
|
+
}
|
|
334
|
+
return this._update(newData, this.width, this.height, 4);
|
|
335
|
+
|
|
336
|
+
} else if (this.channels === 4) {
|
|
337
|
+
// Apply mask to alpha channel in place
|
|
338
|
+
for (let i = 0; i < num_pixels; ++i) {
|
|
339
|
+
this_data[4 * i + 3] = mask_data[i];
|
|
340
|
+
}
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
throw new Error(`Expected image to have 3 or 4 channels, but got ${this.channels}`);
|
|
344
|
+
}
|
|
345
|
+
|
|
306
346
|
/**
|
|
307
347
|
* Resize the image to the given dimensions. This method uses the canvas API to perform the resizing.
|
|
308
348
|
* @param {number} width The width of the new image. `null` or `-1` will preserve the aspect ratio.
|
package/src/utils/tensor.js
CHANGED
|
@@ -772,8 +772,21 @@ export class Tensor {
|
|
|
772
772
|
if (!DataTypeMap.hasOwnProperty(type)) {
|
|
773
773
|
throw new Error(`Unsupported type: ${type}`);
|
|
774
774
|
}
|
|
775
|
+
|
|
776
|
+
// Handle special cases where a mapping function is needed (e.g., where one type is a bigint and the other is a number)
|
|
777
|
+
let map_fn;
|
|
778
|
+
const is_source_bigint = ['int64', 'uint64'].includes(this.type);
|
|
779
|
+
const is_dest_bigint = ['int64', 'uint64'].includes(type);
|
|
780
|
+
if (is_source_bigint && !is_dest_bigint) {
|
|
781
|
+
// TypeError: Cannot convert a BigInt value to a number
|
|
782
|
+
map_fn = Number;
|
|
783
|
+
} else if (!is_source_bigint && is_dest_bigint) {
|
|
784
|
+
// TypeError: Cannot convert [x] to a BigInt
|
|
785
|
+
map_fn = BigInt;
|
|
786
|
+
}
|
|
787
|
+
|
|
775
788
|
// @ts-ignore
|
|
776
|
-
return new Tensor(type, DataTypeMap[type].from(this.data), this.dims);
|
|
789
|
+
return new Tensor(type, DataTypeMap[type].from(this.data, map_fn), this.dims);
|
|
777
790
|
}
|
|
778
791
|
}
|
|
779
792
|
|
|
@@ -971,6 +984,29 @@ export async function topk(x, k) {
|
|
|
971
984
|
});
|
|
972
985
|
}
|
|
973
986
|
|
|
987
|
+
|
|
988
|
+
const arrayToIndexTensor = (array) => new Tensor('int64', array, [array.length]);
|
|
989
|
+
/**
|
|
990
|
+
* Slice a multidimensional float32 tensor.
|
|
991
|
+
* @param {Tensor} data: Tensor of data to extract slices from
|
|
992
|
+
* @param {number[]} starts: 1-D array of starting indices of corresponding axis in axes
|
|
993
|
+
* @param {number[]} ends: 1-D array of ending indices (exclusive) of corresponding axis in axes
|
|
994
|
+
* @param {number[]} axes: 1-D array of axes that starts and ends apply to
|
|
995
|
+
* @param {number[]} [steps]: 1-D array of slice step of corresponding axis in axes.
|
|
996
|
+
* @returns {Promise<Tensor>} Sliced data tensor.
|
|
997
|
+
*/
|
|
998
|
+
export async function slice(data, starts, ends, axes, steps) {
|
|
999
|
+
const op = await TensorOpRegistry.slice;
|
|
1000
|
+
return await op({
|
|
1001
|
+
x: data,
|
|
1002
|
+
s: arrayToIndexTensor(starts),
|
|
1003
|
+
e: arrayToIndexTensor(ends),
|
|
1004
|
+
a: arrayToIndexTensor(axes),
|
|
1005
|
+
t: arrayToIndexTensor(steps ?? new Array(axes.length).fill(1)),
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
|
|
974
1010
|
/**
|
|
975
1011
|
* Perform mean pooling of the last hidden state followed by a normalization step.
|
|
976
1012
|
* @param {Tensor} last_hidden_state Tensor of shape [batchSize, seqLength, embedDim]
|
|
@@ -1417,6 +1453,20 @@ export function zeros_like(tensor) {
|
|
|
1417
1453
|
return zeros(tensor.dims);
|
|
1418
1454
|
}
|
|
1419
1455
|
|
|
1456
|
+
/**
|
|
1457
|
+
* Returns a tensor filled with random numbers from a uniform distribution on the interval [0, 1)
|
|
1458
|
+
* @param {number[]} size A sequence of integers defining the shape of the output tensor.
|
|
1459
|
+
* @returns {Tensor} The random tensor.
|
|
1460
|
+
*/
|
|
1461
|
+
export function rand(size) {
|
|
1462
|
+
const length = size.reduce((a, b) => a * b, 1);
|
|
1463
|
+
return new Tensor(
|
|
1464
|
+
"float32",
|
|
1465
|
+
Float32Array.from({ length }, () => Math.random()),
|
|
1466
|
+
size,
|
|
1467
|
+
)
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1420
1470
|
/**
|
|
1421
1471
|
* Quantizes the embeddings tensor to binary or unsigned binary precision.
|
|
1422
1472
|
* @param {Tensor} tensor The tensor to quantize.
|
package/types/backends/onnx.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function deviceToExecutionProviders(device?: import("../utils/devices.js"
|
|
|
11
11
|
* @param {Object} session_config ONNX inference session configuration.
|
|
12
12
|
* @returns {Promise<import('onnxruntime-common').InferenceSession & { config: Object}>} The ONNX inference session.
|
|
13
13
|
*/
|
|
14
|
-
export function createInferenceSession(buffer: Uint8Array, session_options: import(
|
|
14
|
+
export function createInferenceSession(buffer: Uint8Array, session_options: import("onnxruntime-common").InferenceSession.SessionOptions, session_config: any): Promise<import("onnxruntime-common").InferenceSession & {
|
|
15
15
|
config: any;
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
@@ -26,5 +26,5 @@ export function isONNXTensor(x: any): boolean;
|
|
|
26
26
|
*/
|
|
27
27
|
export function isONNXProxy(): boolean;
|
|
28
28
|
export { Tensor } from "onnxruntime-common";
|
|
29
|
-
export type ONNXExecutionProviders = import(
|
|
29
|
+
export type ONNXExecutionProviders = import("onnxruntime-common").InferenceSession.ExecutionProviderConfig;
|
|
30
30
|
//# sourceMappingURL=onnx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onnx.d.ts","sourceRoot":"","sources":["../../src/backends/onnx.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"onnx.d.ts","sourceRoot":"","sources":["../../src/backends/onnx.js"],"names":[],"mappings":"AA0GA;;;;GAIG;AACH,oDAHW,OAAO,qBAAqB,EAAE,UAAU,GAAC,MAAM,GAAC,IAAI,GAClD,sBAAsB,EAAE,CAqBpC;AAWD;;;;;;GAMG;AACH,+CALW,UAAU,mBACV,OAAO,oBAAoB,EAAE,gBAAgB,CAAC,cAAc,wBAE1D,OAAO,CAAC,OAAO,oBAAoB,EAAE,gBAAgB,GAAG;IAAE,MAAM,MAAQ;CAAC,CAAC,CActF;AAED;;;;GAIG;AACH,gCAHW,GAAG,GACD,OAAO,CAInB;AA+BD;;;GAGG;AACH,+BAFa,OAAO,CAKnB;;qCAnLY,OAAO,oBAAoB,EAAE,gBAAgB,CAAC,uBAAuB"}
|
|
@@ -28,7 +28,7 @@ export class FeatureExtractor extends FeatureExtractor_base {
|
|
|
28
28
|
*
|
|
29
29
|
* @returns {Promise<FeatureExtractor>} A new instance of the Processor class.
|
|
30
30
|
*/
|
|
31
|
-
static from_pretrained(pretrained_model_name_or_path: string, options: import(
|
|
31
|
+
static from_pretrained(pretrained_model_name_or_path: string, options: import("../utils/hub.js").PretrainedOptions): Promise<FeatureExtractor>;
|
|
32
32
|
/**
|
|
33
33
|
* Constructs a new FeatureExtractor instance.
|
|
34
34
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature_extraction_utils.d.ts","sourceRoot":"","sources":["../../src/base/feature_extraction_utils.js"],"names":[],"mappings":"AAwCA;;;;;GAKG;AACH,6CAJW,GAAG,qBACH,MAAM,QAUhB
|
|
1
|
+
{"version":3,"file":"feature_extraction_utils.d.ts","sourceRoot":"","sources":["../../src/base/feature_extraction_utils.js"],"names":[],"mappings":"AAwCA;;;;;GAKG;AACH,6CAJW,GAAG,qBACH,MAAM,QAUhB;;KAnDuC,GAAG;UAG5B,GAAG;;AADlB;;GAEG;AACH;IAWI;;;;;;;;;;;;;;OAcG;IACH,sDATW,MAAM,WAKN,OAAO,iBAAiB,EAAE,iBAAiB,GAEzC,OAAO,CAAC,gBAAgB,CAAC,CAKrC;IA5BD;;;;OAIG;IACH,yBAGC;IADG,YAAoB;CAsB3B"}
|
|
@@ -102,7 +102,7 @@ export class ImageProcessor extends ImageProcessor_base {
|
|
|
102
102
|
*
|
|
103
103
|
* @returns {Promise<ImageProcessor>} A new instance of the Processor class.
|
|
104
104
|
*/
|
|
105
|
-
static from_pretrained(pretrained_model_name_or_path: string, options: import(
|
|
105
|
+
static from_pretrained(pretrained_model_name_or_path: string, options: import("../utils/hub.js").PretrainedOptions): Promise<ImageProcessor>;
|
|
106
106
|
/**
|
|
107
107
|
* Constructs a new `ImageProcessor`.
|
|
108
108
|
* @param {ImageProcessorConfig} config The configuration object.
|
|
@@ -149,7 +149,7 @@ export class ImageProcessor extends ImageProcessor_base {
|
|
|
149
149
|
* Pad the image by a certain amount.
|
|
150
150
|
* @param {Float32Array} pixelData The pixel data to pad.
|
|
151
151
|
* @param {number[]} imgDims The dimensions of the image (height, width, channels).
|
|
152
|
-
* @param {{width:number; height:number}|number} padSize The dimensions of the padded image.
|
|
152
|
+
* @param {{width:number; height:number}|number|'square'} padSize The dimensions of the padded image.
|
|
153
153
|
* @param {Object} options The options for padding.
|
|
154
154
|
* @param {'constant'|'symmetric'} [options.mode='constant'] The type of padding to add.
|
|
155
155
|
* @param {boolean} [options.center=false] Whether to center the image.
|
|
@@ -159,8 +159,8 @@ export class ImageProcessor extends ImageProcessor_base {
|
|
|
159
159
|
pad_image(pixelData: Float32Array, imgDims: number[], padSize: {
|
|
160
160
|
width: number;
|
|
161
161
|
height: number;
|
|
162
|
-
} | number, { mode, center, constant_values, }?: {
|
|
163
|
-
mode?:
|
|
162
|
+
} | number | "square", { mode, center, constant_values, }?: {
|
|
163
|
+
mode?: "constant" | "symmetric";
|
|
164
164
|
center?: boolean;
|
|
165
165
|
constant_values?: number | number[];
|
|
166
166
|
}): [Float32Array, number[]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_processors_utils.d.ts","sourceRoot":"","sources":["../../src/base/image_processors_utils.js"],"names":[],"mappings":"AA+EA;;;;;;;;;GASG;AACH;
|
|
1
|
+
{"version":3,"file":"image_processors_utils.d.ts","sourceRoot":"","sources":["../../src/base/image_processors_utils.js"],"names":[],"mappings":"AA+EA;;;;;;;;;GASG;AACH,uDAPG;IAAwB,MAAM,EAAtB,MAAM;IACU,UAAU,EAA1B,MAAM;CACd,cAAQ,MAAM,iBACN,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,iBAClB,OAAO,GACN,KAAQ,CAwEnB;AAGD;;;;;;GAMG;AACH,4DALW,G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C;;;;;kBAM9B,MAAM;;;;oBACN,WAAW,EAAE;;;;0BACb,WAAW,EAAE;;;;;;;;;;;;;iBAgiBb,MAAM,EAAE;;;;gBACR,MAAM,EAAE;;;;iBACR,OAAO;;;;qBACP,MAAM;;;;mBACN,OAAO;;;;gBACP,OAAO;;;;eACP,MAAM;;;;WACN,MAAM,MAAO;;;;iBACb,MAAM,MAAO;;;;;4BACb,OAAO;;;;;qBAEP,OAAO;;;;mBAEP,OAAO;;;;;wBACP,OAAO;;;;;yBAEP,MAAM;;;;WAGN,MAAM,EAAE;;;;UACR,MAAM,EAAE;;uBAtkBqB,oBAAoB;yBAEtC,mBAAmB"}
|
|
@@ -39,15 +39,15 @@ export class Processor extends Processor_base {
|
|
|
39
39
|
/**
|
|
40
40
|
* @returns {import('./image_processors_utils.js').ImageProcessor|undefined} The image processor of the processor, if it exists.
|
|
41
41
|
*/
|
|
42
|
-
get image_processor(): import("./image_processors_utils.js").ImageProcessor;
|
|
42
|
+
get image_processor(): import("./image_processors_utils.js").ImageProcessor | undefined;
|
|
43
43
|
/**
|
|
44
44
|
* @returns {import('../tokenizers.js').PreTrainedTokenizer|undefined} The tokenizer of the processor, if it exists.
|
|
45
45
|
*/
|
|
46
|
-
get tokenizer(): import("../tokenizers.js").PreTrainedTokenizer;
|
|
46
|
+
get tokenizer(): import("../tokenizers.js").PreTrainedTokenizer | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* @returns {import('./feature_extraction_utils.js').FeatureExtractor|undefined} The feature extractor of the processor, if it exists.
|
|
49
49
|
*/
|
|
50
|
-
get feature_extractor(): import("./feature_extraction_utils.js").FeatureExtractor;
|
|
50
|
+
get feature_extractor(): import("./feature_extraction_utils.js").FeatureExtractor | undefined;
|
|
51
51
|
apply_chat_template(messages: any, options?: {}): string | number[] | number[][] | import("../transformers.js").Tensor | {
|
|
52
52
|
/**
|
|
53
53
|
* List of token ids to be fed to a model.
|
|
@@ -75,6 +75,6 @@ export class Processor extends Processor_base {
|
|
|
75
75
|
* Additional processor-specific properties.
|
|
76
76
|
*/
|
|
77
77
|
export type ProcessorProperties = any;
|
|
78
|
-
export type PretrainedProcessorOptions = import(
|
|
78
|
+
export type PretrainedProcessorOptions = import("../utils/hub.js").PretrainedOptions & ProcessorProperties;
|
|
79
79
|
export {};
|
|
80
80
|
//# sourceMappingURL=processing_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processing_utils.d.ts","sourceRoot":"","sources":["../../src/base/processing_utils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processing_utils.d.ts","sourceRoot":"","sources":["../../src/base/processing_utils.js"],"names":[],"mappings":";KAIsD,GAAG;UACxD,GAAE;;AAsBH;;;GAGG;AAGH;;GAEG;AACH;IACI,yBAIC;IACD,sCAAqC;IAoErC;;;;;;;;;;;;;;OAcG;IACH,sDATW,MAAM,WAKN,0BAA0B,GAExB,OAAO,CAAC,SAAS,CAAC,CAoB9B;IAnGD;;;;OAIG;IACH,qCAFW,MAAM,CAAC,MAAM,MAAS,EAMhC;IAFG,YAAoB;IACpB,gCAA4B;IAGhC;;OAEG;IACH,uBAFa,OAAO,6BAA6B,EAAE,cAAc,GAAC,SAAS,CAI1E;IAED;;OAEG;IACH,iBAFa,OAAO,kBAAkB,EAAE,mBAAmB,GAAC,SAAS,CAIpE;IAED;;OAEG;IACH,yBAFa,OAAO,+BAA+B,EAAE,gBAAgB,GAAC,SAAS,CAI9E;IAED;;;;;;;;;;;;;MAQC;IAED,uCAKC;IAGD;;;;;OAKG;IACH,aAJW,GAAG,WACA,GAAG,EAAA,GACJ,OAAO,CAAC,GAAG,CAAC,CASxB;CAqCJ;;;;;yCAnHY,OAAO,iBAAiB,EAAE,iBAAiB,GAAG,mBAAmB"}
|
package/types/configs.d.ts
CHANGED
|
@@ -53,11 +53,11 @@ export class AutoConfig {
|
|
|
53
53
|
*
|
|
54
54
|
* @returns {Promise<PretrainedConfig>} A new instance of the `PretrainedConfig` class.
|
|
55
55
|
*/
|
|
56
|
-
static from_pretrained(pretrained_model_name_or_path: string, { progress_callback, config, cache_dir, local_files_only, revision, }?:
|
|
56
|
+
static from_pretrained(pretrained_model_name_or_path: string, { progress_callback, config, cache_dir, local_files_only, revision, }?: PretrainedOptions): Promise<PretrainedConfig>;
|
|
57
57
|
}
|
|
58
|
-
export type PretrainedOptions = import(
|
|
59
|
-
export type ProgressCallback = import(
|
|
60
|
-
export type ProgressInfo = import(
|
|
58
|
+
export type PretrainedOptions = import("./utils/hub.js").PretrainedOptions;
|
|
59
|
+
export type ProgressCallback = import("./utils/core.js").ProgressCallback;
|
|
60
|
+
export type ProgressInfo = import("./utils/core.js").ProgressInfo;
|
|
61
61
|
/**
|
|
62
62
|
* Transformers.js-specific configuration, possibly present in config.json under the key `transformers.js_config`.
|
|
63
63
|
*/
|
|
@@ -65,7 +65,7 @@ export type TransformersJSConfig = {
|
|
|
65
65
|
/**
|
|
66
66
|
* The data type of the key-value cache.
|
|
67
67
|
*/
|
|
68
|
-
kv_cache_dtype?: import(
|
|
68
|
+
kv_cache_dtype?: import("./utils/tensor.js").DataType | Record<import("./utils/dtypes.js").DataType, import("./utils/tensor.js").DataType>;
|
|
69
69
|
/**
|
|
70
70
|
* Override the free dimensions of the model.
|
|
71
71
|
* See https://onnxruntime.ai/docs/tutorials/web/env-flags-and-session-options.html#freedimensionoverrides
|
|
@@ -75,11 +75,11 @@ export type TransformersJSConfig = {
|
|
|
75
75
|
/**
|
|
76
76
|
* The default device to use for the model.
|
|
77
77
|
*/
|
|
78
|
-
device?: import(
|
|
78
|
+
device?: import("./utils/devices.js").DeviceType;
|
|
79
79
|
/**
|
|
80
80
|
* The default data type to use for the model.
|
|
81
81
|
*/
|
|
82
|
-
dtype?: import(
|
|
82
|
+
dtype?: import("./utils/dtypes.js").DataType | Record<string, import("./utils/dtypes.js").DataType>;
|
|
83
83
|
/**
|
|
84
84
|
* Whether to load the model using the external data format (used for models >= 2GB in size).
|
|
85
85
|
*/
|
package/types/configs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.js"],"names":[],"mappings":"AA2OA;;;;GAIG;AACH,0CAHW,gBAAgB;;;IACd,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA2EpC;AACD;;;GAGG;AACH;IAwBI;;;;;;;;OAQG;IACH,sDANW,MAAM,0EACN,iBAAiB,GAGf,OAAO,CAAC,gBAAgB,CAAC,CAqBrC;IArCD;;;OAGG;IACH,6BAGC;IAnBD,0BAA0B;IAC1B,YADW,MAAM,GAAC,IAAI,CACJ;IAElB,sBAAsB;IACtB,oBADW,OAAO,CACS;IAE3B,qBAAqB;IACrB,yBADW,MAAM,CACO;IAExB,mCAAmC;IACnC,0BADW,oBAAoB,CACN;IAQrB,uBAAkD;CAgCzD;AAED;;;;;GAKG;AACH;IArCI;;;;;;;;OAQG;IACH,sDANW,MAAM,0EACN,iBAAiB,GAGf,OAAO,CAAC,gBAAgB,CAAC,CAqBrC;CAcJ;gCA7VY,OAAO,gBAAgB,EAAE,iBAAiB;+BAI1C,OAAO,iBAAiB,EAAE,gBAAgB;2BAI1C,OAAO,iBAAiB,EAAE,YAAY;;;;;;;;qBA0VrC,OAAO,mBAAmB,EAAE,QAAQ,GAAC,MAAM,CAAC,OAAO,mBAAmB,EAAE,QAAQ,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC;;;;;;+BACvH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;aAGtB,OAAO,oBAAoB,EAAE,UAAU;;;;YACvC,OAAO,mBAAmB,EAAE,QAAQ,GAAC,MAAM,CAAC,MAAM,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC;;;;+BACzF,OAAO,GAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC"}
|
package/types/env.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type TransformersEnvironment = {
|
|
|
57
57
|
* allowing users to set these variables if they want to.
|
|
58
58
|
*/
|
|
59
59
|
backends: {
|
|
60
|
-
onnx: Partial<import(
|
|
60
|
+
onnx: Partial<import("onnxruntime-common").Env>;
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* Whether to allow loading of remote files, defaults to `true`.
|
package/types/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.js"],"names":[],"mappings":"AA0CA;;GAEG;AACH;IACI,6EAA6E;;IAG7E,yDAAyD;;IAGzD,yCAAyC;;IAGzC,0CAA0C;;IAG1C,yCAAyC;;IAGzC,mDAAmD;;IAGnD,sDAAsD;;IAGtD,8CAA8C;;IAG9C,wCAAwC;;GAEzC;AA6BH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,sCAAsC;AACtC,kBADW,uBAAuB,CA6BjC;;;;;;;;aAhDa,MAAM;;;;;cACN;QAAC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.js"],"names":[],"mappings":"AA0CA;;GAEG;AACH;IACI,6EAA6E;;IAG7E,yDAAyD;;IAGzD,yCAAyC;;IAGzC,0CAA0C;;IAG1C,yCAAyC;;IAGzC,mDAAmD;;IAGnD,sDAAsD;;IAGtD,8CAA8C;;IAG9C,wCAAwC;;GAEzC;AA6BH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,sCAAsC;AACtC,kBADW,uBAAuB,CA6BjC;;;;;;;;aAhDa,MAAM;;;;;cACN;QAAC,IAAI,EAAE,OAAO,CAAC,OAAO,oBAAoB,EAAE,GAAG,CAAC,CAAA;KAAC;;;;;uBAEjD,OAAO;;;;gBAEP,MAAM;;;;wBACN,MAAM;;;;;sBACN,OAAO;;;;oBAEP,MAAM;;;;WACN,OAAO;;;;qBACP,OAAO;;;;gBACP,OAAO;;;;cACP,MAAM;;;;oBACN,OAAO"}
|
|
@@ -6,7 +6,7 @@ export class GenerationConfig {
|
|
|
6
6
|
*
|
|
7
7
|
* @param {GenerationConfig|import('../configs.js').PretrainedConfig} config
|
|
8
8
|
*/
|
|
9
|
-
constructor(config: GenerationConfig | import(
|
|
9
|
+
constructor(config: GenerationConfig | import("../configs.js").PretrainedConfig);
|
|
10
10
|
/**
|
|
11
11
|
* The maximum length the generated tokens can have.
|
|
12
12
|
* Corresponds to the length of the input prompt + `max_new_tokens`.
|
|
@@ -228,7 +228,7 @@ export class GenerationConfig {
|
|
|
228
228
|
* @type {import('./streamers.js').TextStreamer}
|
|
229
229
|
* @default null
|
|
230
230
|
*/
|
|
231
|
-
streamer: import(
|
|
231
|
+
streamer: import("./streamers.js").TextStreamer;
|
|
232
232
|
/**
|
|
233
233
|
* A list of tokens that will be suppressed at the beginning of the generation.
|
|
234
234
|
* The `SuppressBeginTokens` logit processor will set their log probs to `-inf` so that they are not sampled.
|
|
@@ -64,7 +64,7 @@ export class LogitsProcessorList extends LogitsProcessorList_base {
|
|
|
64
64
|
* @param {Tensor} logits
|
|
65
65
|
*/
|
|
66
66
|
_call(input_ids: bigint[][], logits: Tensor): Tensor;
|
|
67
|
-
[Symbol.iterator]():
|
|
67
|
+
[Symbol.iterator](): ArrayIterator<any>;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* A LogitsProcessor that forces a BOS token at the beginning of the generated sequence.
|
|
@@ -135,7 +135,7 @@ export class WhisperTimeStampLogitsProcessor extends LogitsProcessor {
|
|
|
135
135
|
* @param {import('../models/whisper/generation_whisper.js').WhisperGenerationConfig} generate_config The config object passed to the `generate()` method of a transformer model.
|
|
136
136
|
* @param {number[]} init_tokens The initial tokens of the input sequence.
|
|
137
137
|
*/
|
|
138
|
-
constructor(generate_config: import(
|
|
138
|
+
constructor(generate_config: import("../models/whisper/generation_whisper.js").WhisperGenerationConfig, init_tokens: number[]);
|
|
139
139
|
eos_token_id: number;
|
|
140
140
|
no_timestamps_token_id: number;
|
|
141
141
|
timestamp_begin: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logits_process.d.ts","sourceRoot":"","sources":["../../src/generation/logits_process.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logits_process.d.ts","sourceRoot":"","sources":["../../src/generation/logits_process.js"],"names":[],"mappings":";KAQW,GAAG;UAAyB,GAAG;;AAE1C;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,QAKhB;CACJ;;KAjBU,GAAG;UAAyB,GAAG;;AAoB1C;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,QAKhB;CACJ;;KAnCU,GAAG;UAAyB,GAAG;;AAsC1C;;;;GAIG;AACH;IAMQ,kBAAoB;IAGxB;;;;OAIG;IACH,WAFW,eAAe,QAIzB;IAED;;;;OAIG;IACH,cAFW,eAAe,EAAE,QAI3B;IAED;;;;;OAKG;IACH,iBAHW,MAAM,EAAE,EAAE,UACV,MAAM,UAShB;IAED,wCAEC;CACJ;AAwCD;;GAEG;AACH;IACI;;;OAGG;IACH,0BAFW,MAAM,EAKhB;IADG,qBAAgC;IAGpC;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,GACJ,MAAM,CAWlB;CACJ;AAED;;GAEG;AACH;IACI;;;;OAIG;IACH,wBAHW,MAAM,gBACN,MAAM,GAAC,MAAM,EAAE,EAMzB;IAFG,mBAA4B;IAC5B,uBAA+E;IAGnF;;;;;OAKG;IACH,iBAHW,MAAM,EAAE,EAAE,UACV,MAAM,UAahB;CACJ;AAED;;;;GAIG;AACH;IACI;;;;OAIG;IACH,mCAHW,MAAM,EAAE,eACR,MAAM,EAMhB;IAFG,gCAAkD;IAClD,oBAA8B;IAGlC;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV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;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,GACJ,MAAM,CAclB;CACJ;AAED;IACI;;;;OAIG;IACH,2BAHW,MAAM,EAAE,EAAE,gBACV,MAAM,GAAC,MAAM,EAAE,EAMzB;IAFG,0BAAkC;IAClC,uBAA+E;IAGnF;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,GACJ,MAAM,CA4BlB;CACJ;AAED;;;;;;;GAOG;AACH;IAEI;;;;;OAKG;IACH,4BAJW,MAAM,EAYhB;IADG,uBAAoC;IAGxC;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,GACJ,MAAM,CAsBlB;CACJ;AAED;;;GAGG;AACH;IACI;;;;;OAKG;IACH,yBAJW,MAAM,EAgBhB;IADG,oBAA8B;IAGlC;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,GACJ,MAAM,CAQlB;CACJ;AAED;;;GAGG;AACH;IACI;;;;;;;OAOG;IACH,mBANW,MAAM,0CAGd;QAAyB,YAAY,GAA7B,MAAM;QACW,kBAAkB,GAAnC,MAAM;KAChB,EAgBA;IAHG,cAAkB;IAClB,qBAAgC;IAChC,2BAA4C;CAEnD;AAED;;;GAGG;AACH;IACI;;;;;;OAMG;IACH,mBALW,MAAM,0CAEd;QAAyB,YAAY,GAA7B,MAAM;QACW,kBAAkB,GAAnC,MAAM;KAChB,EAYA;IAFG,cAAgD;IAChD,qBAAgC;CAEvC;uBA9sBsB,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logits_sampler.d.ts","sourceRoot":"","sources":["../../src/generation/logits_sampler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logits_sampler.d.ts","sourceRoot":"","sources":["../../src/generation/logits_sampler.js"],"names":[],"mappings":";KAQK,GAAG;UAGN,GAAG;;AAGL;;GAEG;AACH;IAyEI;;;;OAIG;IACH,qCAHW,gBAAgB,GACd,aAAa,CAwBzB;IAnGD;;;OAGG;IACH,+BAFW,gBAAgB,EAK1B;IADG,oCAA0C;IAG9C;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAMvC;IAED;;;;;OAKG;IACH,eAJW,MAAM,GAEJ,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAIvC;IAED;;;;;OAKG;IACH,kBAJW,MAAM,SACN,MAAM,GACJ,YAAY,CAcxB;IAED;;;;OAIG;IACH,4BAHW,OAAO,oBAAoB,EAAE,SAAS,GACpC,MAAM,CAiBlB;CA8BJ;iCA1GgC,sCAAsC;uBAN1C,oBAAoB"}
|
|
@@ -6,7 +6,7 @@ type GenerationFunctionParameters = {
|
|
|
6
6
|
* should be in the format of `input_ids`. For encoder-decoder models *inputs* can represent any of
|
|
7
7
|
* `input_ids`, `input_values`, `input_features`, or `pixel_values`.
|
|
8
8
|
*/
|
|
9
|
-
inputs?: import(
|
|
9
|
+
inputs?: import("../utils/tensor.js").Tensor;
|
|
10
10
|
/**
|
|
11
11
|
* (`GenerationConfig`, *optional*):
|
|
12
12
|
* The generation configuration to be used as base parametrization for the generation call.
|
|
@@ -17,27 +17,27 @@ type GenerationFunctionParameters = {
|
|
|
17
17
|
* - (2) from the model configuration. Please note that unspecified parameters will inherit [`GenerationConfig`]'s
|
|
18
18
|
* default values, whose documentation should be checked to parameterize generation.
|
|
19
19
|
*/
|
|
20
|
-
generation_config?: import(
|
|
20
|
+
generation_config?: import("./configuration_utils.js").GenerationConfig;
|
|
21
21
|
/**
|
|
22
22
|
* (`LogitsProcessorList`, *optional*):
|
|
23
23
|
* Custom logits processors that complement the default logits processors built from arguments and
|
|
24
24
|
* generation config. If a logit processor is passed that is already created with the arguments or a
|
|
25
25
|
* generation config an error is thrown. This feature is intended for advanced users.
|
|
26
26
|
*/
|
|
27
|
-
logits_processor?: import(
|
|
27
|
+
logits_processor?: import("./logits_process.js").LogitsProcessorList;
|
|
28
28
|
/**
|
|
29
29
|
* (`StoppingCriteriaList`, *optional*):
|
|
30
30
|
* Custom stopping criteria that complements the default stopping criteria built from arguments and a
|
|
31
31
|
* generation config. If a stopping criteria is passed that is already created with the arguments or a
|
|
32
32
|
* generation config an error is thrown. This feature is intended for advanced users.
|
|
33
33
|
*/
|
|
34
|
-
stopping_criteria?: import(
|
|
34
|
+
stopping_criteria?: import("./stopping_criteria.js").StoppingCriteriaList;
|
|
35
35
|
/**
|
|
36
36
|
* (`BaseStreamer`, *optional*):
|
|
37
37
|
* Streamer object that will be used to stream the generated sequences. Generated tokens are passed
|
|
38
38
|
* through `streamer.put(token_ids)` and the streamer is responsible for any further processing.
|
|
39
39
|
*/
|
|
40
|
-
streamer?: import(
|
|
40
|
+
streamer?: import("./streamers.js").BaseStreamer;
|
|
41
41
|
/**
|
|
42
42
|
* (`number[]`, *optional*):
|
|
43
43
|
* If the model is an encoder-decoder model, this argument is used to pass the `decoder_input_ids`.
|
|
@@ -38,7 +38,7 @@ export class StoppingCriteriaList extends StoppingCriteriaList_base {
|
|
|
38
38
|
*/
|
|
39
39
|
extend(items: StoppingCriteria | StoppingCriteriaList | StoppingCriteria[]): void;
|
|
40
40
|
_call(input_ids: any, scores: any): any[];
|
|
41
|
-
[Symbol.iterator]():
|
|
41
|
+
[Symbol.iterator](): ArrayIterator<any>;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* This class can be used to stop generation whenever the full generated number of tokens exceeds `max_length`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopping_criteria.d.ts","sourceRoot":"","sources":["../../src/generation/stopping_criteria.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stopping_criteria.d.ts","sourceRoot":"","sources":["../../src/generation/stopping_criteria.js"],"names":[],"mappings":";KAQ4C,GAAG;UAA0B,GAAE;;AAE3E;;GAEG;AACH;IACI;;;;;;;;OAQG;IACH,iBAPW,MAAM,EAAE,EAAE,UAEV,MAAM,EAAE,EAAE,GAGR,OAAO,EAAE,CAIrB;CACJ;;KAlB2C,GAAG;UAA0B,GAAE;;AAmB3E;GACG;AACH;IAMQ,gBAAkB;IAGtB;;;;OAIG;IACH,WAFW,gBAAgB,QAI1B;IAED;;;;OAIG;IACH,cAFW,gBAAgB,GAAC,oBAAoB,GAAC,gBAAgB,EAAE,QASlE;IAED,0CASC;IAED,wCAEC;CACJ;AAED;;;GAGG;AACH;IAEI;;;;OAIG;IACH,wBAHW,MAAM,4BACN,MAAM,EAMhB;IAFG,mBAA4B;IAC5B,gCAAsD;IAG1D,2BAEC;CACJ;AAID;;;GAGG;AACH;IAEI;;;;OAIG;IACH,0BAHW,MAAM,GAAC,MAAM,EAAE,EASzB;IADG,uBAAgC;CAgBvC;AAED;;GAEG;AACH;IAGQ,qBAAwB;IAG5B,kBAEC;IAED,cAEC;IAED,0CAEC;CACJ"}
|
|
@@ -22,7 +22,7 @@ export class TextStreamer extends BaseStreamer {
|
|
|
22
22
|
* @param {function(bigint[]): void} [options.token_callback_function=null] Function to call when a new token is generated
|
|
23
23
|
* @param {Object} [options.decode_kwargs={}] Additional keyword arguments to pass to the tokenizer's decode method
|
|
24
24
|
*/
|
|
25
|
-
constructor(tokenizer: import(
|
|
25
|
+
constructor(tokenizer: import("../tokenizers.js").PreTrainedTokenizer, { skip_prompt, callback_function, token_callback_function, decode_kwargs, ...kwargs }?: {
|
|
26
26
|
skip_prompt?: boolean;
|
|
27
27
|
callback_function?: (arg0: string) => void;
|
|
28
28
|
token_callback_function?: (arg0: bigint[]) => void;
|
|
@@ -65,7 +65,7 @@ export class WhisperTextStreamer extends TextStreamer {
|
|
|
65
65
|
* @param {boolean} [options.skip_special_tokens=true] Whether to skip special tokens when decoding
|
|
66
66
|
* @param {Object} [options.decode_kwargs={}] Additional keyword arguments to pass to the tokenizer's decode method
|
|
67
67
|
*/
|
|
68
|
-
constructor(tokenizer: import(
|
|
68
|
+
constructor(tokenizer: import("../tokenizers.js").WhisperTokenizer, { skip_prompt, callback_function, token_callback_function, on_chunk_start, on_chunk_end, on_finalize, time_precision, skip_special_tokens, decode_kwargs, }?: {
|
|
69
69
|
skip_prompt?: boolean;
|
|
70
70
|
callback_function?: (arg0: string) => void;
|
|
71
71
|
token_callback_function?: (arg0: bigint[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamers.d.ts","sourceRoot":"","sources":["../../src/generation/streamers.js"],"names":[],"mappings":"AASA;IACI;;;OAGG;IACH,WAFW,MAAM,EAAE,EAAE,QAIpB;IAED;;OAEG;IACH,YAEC;CACJ;AAMD;;GAEG;AACH;IACI;;;;;;;;OAQG;IACH,uBAPW,OAAO,kBAAkB,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"streamers.d.ts","sourceRoot":"","sources":["../../src/generation/streamers.js"],"names":[],"mappings":"AASA;IACI;;;OAGG;IACH,WAFW,MAAM,EAAE,EAAE,QAIpB;IAED;;OAEG;IACH,YAEC;CACJ;AAMD;;GAEG;AACH;IACI;;;;;;;;OAQG;IACH,uBAPW,OAAO,kBAAkB,EAAE,mBAAmB,0FAEtD;QAA0B,WAAW,GAA7B,OAAO;QAC0B,iBAAiB,GAAlD,CAAS,IAAM,EAAN,MAAM,KAAG,IAAI;QACa,uBAAuB,GAA1D,CAAS,IAAQ,EAAR,MAAM,EAAE,KAAG,IAAI;QACP,aAAa;KACxC,EAmBA;IAVG,0DAA0B;IAC1B,qBAA8B;IAC9B,oCAA0D;IAC1D,gCAdgB,MAAM,EAAE,KAAG,IAAI,CAcuB;IACtD,mBAAoD;IAGpD,mBAAqB;IACrB,kBAAkB;IAClB,gCAAkC;IA6DtC;;;;OAIG;IACH,wBAHW,MAAM,cACN,OAAO,QASjB;CACJ;AAED;;;;;;;GAOG;AACH;IACI;;;;;;;;;;;;OAYG;IACH,uBAZW,OAAO,kBAAkB,EAAE,gBAAgB,gKAEnD;QAA0B,WAAW,GAA7B,OAAO;QAC0B,iBAAiB,GAAlD,CAAS,IAAM,EAAN,MAAM,KAAG,IAAI;QACa,uBAAuB,GAA1D,CAAS,IAAQ,EAAR,MAAM,EAAE,KAAG,IAAI;QACS,cAAc,GAA/C,CAAS,IAAM,EAAN,MAAM,KAAG,IAAI;QACW,YAAY,GAA7C,CAAS,IAAM,EAAN,MAAM,KAAG,IAAI;QACK,WAAW,GAAtC,MAAY,IAAI;QACC,cAAc,GAA/B,MAAM;QACY,mBAAmB,GAArC,OAAO;QACU,aAAa;KACxC,EA2BA;IATG,wBAAgD;IAEhD,uBA1BgB,MAAM,KAAG,IAAI,CA0BO;IACpC,qBA1BgB,MAAM,KAAG,IAAI,CA0BG;IAChC,mBA1BmB,IAAI,CA0BO;IAE9B,uBAAoC;IAEpC,+BAAkC;CAiCzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature_extraction_audio_spectrogram_transformer.d.ts","sourceRoot":"","sources":["../../../src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"],"names":[],"mappings":"AAKA;IAEI,yBA2BC;IARG,wBAA8B;IAE9B,
|
|
1
|
+
{"version":3,"file":"feature_extraction_audio_spectrogram_transformer.d.ts","sourceRoot":"","sources":["../../../src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"],"names":[],"mappings":"AAKA;IAEI,yBA2BC;IARG,wBAA8B;IAE9B,sCAEE;IAEF,UAA4B;IAC5B,SAA0B;IAG9B;;;;;OAKG;IACH,kCAJW,YAAY,GAAC,YAAY,cACzB,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAwB3B;IAGD;;;;OAIG;IACH,aAHW,YAAY,GAAC,YAAY,GACvB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAkB7C;CACJ;iCAzFuD,wCAAwC;uBACzE,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature_extraction_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/feature_extraction_auto.js"],"names":[],"mappings":"AAMA;
|
|
1
|
+
{"version":3,"file":"feature_extraction_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/feature_extraction_auto.js"],"names":[],"mappings":"AAMA;kFAe6F,oBAE7F;CAiBC;iCArCgC,wCAAwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_processing_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/image_processing_auto.js"],"names":[],"mappings":"AAMA;
|
|
1
|
+
{"version":3,"file":"image_processing_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/image_processing_auto.js"],"names":[],"mappings":"AAMA;kFAuB4jyC,oBAAiB;CAD5kyC;+BAzB8B,sCAAsC"}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
export class AutoProcessor {
|
|
32
|
-
static from_pretrained(pretrained_model_name_or_path: string, options:
|
|
32
|
+
static from_pretrained(pretrained_model_name_or_path: string, options: PretrainedProcessorOptions): Promise<Processor>;
|
|
33
33
|
}
|
|
34
34
|
import { Processor } from '../../base/processing_utils.js';
|
|
35
35
|
//# sourceMappingURL=processing_auto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processing_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/processing_auto.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;
|
|
1
|
+
{"version":3,"file":"processing_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/processing_auto.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;;CA2DC;0BA/FyB,gCAAgC"}
|
|
@@ -2,7 +2,7 @@ export class ClapFeatureExtractor extends FeatureExtractor {
|
|
|
2
2
|
constructor(config: any);
|
|
3
3
|
mel_filters: number[][];
|
|
4
4
|
mel_filters_slaney: number[][];
|
|
5
|
-
window: Float64Array
|
|
5
|
+
window: Float64Array<ArrayBufferLike>;
|
|
6
6
|
/**
|
|
7
7
|
* Extracts the mel spectrogram and prepares it for the mode based on the `truncation` and `padding` arguments.
|
|
8
8
|
*
|