@huggingface/transformers 3.2.3 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +2 -2
  2. package/dist/transformers.cjs +203 -92
  3. package/dist/transformers.cjs.map +1 -1
  4. package/dist/transformers.js +203 -92
  5. package/dist/transformers.js.map +1 -1
  6. package/dist/transformers.min.cjs +1 -1
  7. package/dist/transformers.min.cjs.map +1 -1
  8. package/dist/transformers.min.js +1 -1
  9. package/dist/transformers.min.js.map +1 -1
  10. package/dist/transformers.min.mjs +1 -1
  11. package/dist/transformers.min.mjs.map +1 -1
  12. package/dist/transformers.mjs +203 -92
  13. package/dist/transformers.mjs.map +1 -1
  14. package/package.json +2 -2
  15. package/src/base/feature_extraction_utils.js +9 -9
  16. package/src/base/image_processors_utils.js +11 -0
  17. package/src/base/processing_utils.js +13 -3
  18. package/src/configs.js +5 -0
  19. package/src/env.js +1 -1
  20. package/src/models/auto/feature_extraction_auto.js +0 -16
  21. package/src/models/auto/processing_auto.js +0 -16
  22. package/src/models/convnext/image_processing_convnext.js +1 -0
  23. package/src/models/efficientnet/image_processing_efficientnet.js +1 -0
  24. package/src/models/florence2/processing_florence2.js +3 -0
  25. package/src/models/idefics3/image_processing_idefics3.js +2 -0
  26. package/src/models/janus/image_processing_janus.js +1 -0
  27. package/src/models/mgp_str/processing_mgp_str.js +2 -0
  28. package/src/models/paligemma/processing_paligemma.js +1 -0
  29. package/src/models/phi3_v/processing_phi3_v.js +1 -1
  30. package/src/models/pyannote/feature_extraction_pyannote.js +1 -0
  31. package/src/models/qwen2_vl/processing_qwen2_vl.js +1 -0
  32. package/src/models/seamless_m4t/feature_extraction_seamless_m4t.js +2 -2
  33. package/src/models/whisper/feature_extraction_whisper.js +1 -1
  34. package/src/models.js +50 -15
  35. package/src/ops/registry.js +10 -0
  36. package/src/pipelines.js +34 -7
  37. package/src/tokenizers.js +4 -7
  38. package/src/utils/dtypes.js +2 -0
  39. package/src/utils/hub.js +1 -1
  40. package/src/utils/maths.js +8 -6
  41. package/src/utils/tensor.js +42 -10
  42. package/types/base/feature_extraction_utils.d.ts +7 -7
  43. package/types/base/image_processors_utils.d.ts.map +1 -1
  44. package/types/base/processing_utils.d.ts +17 -19
  45. package/types/base/processing_utils.d.ts.map +1 -1
  46. package/types/configs.d.ts.map +1 -1
  47. package/types/generation/parameters.d.ts +1 -1
  48. package/types/models/auto/feature_extraction_auto.d.ts.map +1 -1
  49. package/types/models/auto/image_processing_auto.d.ts.map +1 -1
  50. package/types/models/auto/processing_auto.d.ts.map +1 -1
  51. package/types/models/convnext/image_processing_convnext.d.ts.map +1 -1
  52. package/types/models/efficientnet/image_processing_efficientnet.d.ts.map +1 -1
  53. package/types/models/florence2/processing_florence2.d.ts.map +1 -1
  54. package/types/models/idefics3/image_processing_idefics3.d.ts.map +1 -1
  55. package/types/models/janus/image_processing_janus.d.ts.map +1 -1
  56. package/types/models/mgp_str/processing_mgp_str.d.ts.map +1 -1
  57. package/types/models/paligemma/processing_paligemma.d.ts.map +1 -1
  58. package/types/models/phi3_v/processing_phi3_v.d.ts +6 -2
  59. package/types/models/phi3_v/processing_phi3_v.d.ts.map +1 -1
  60. package/types/models/pyannote/feature_extraction_pyannote.d.ts.map +1 -1
  61. package/types/models/qwen2_vl/processing_qwen2_vl.d.ts.map +1 -1
  62. package/types/models/sapiens/image_processing_sapiens.d.ts +10 -0
  63. package/types/models/sapiens/image_processing_sapiens.d.ts.map +1 -0
  64. package/types/models/whisper/generation_whisper.d.ts +1 -1
  65. package/types/models/whisper/generation_whisper.d.ts.map +1 -1
  66. package/types/models.d.ts +32 -17
  67. package/types/models.d.ts.map +1 -1
  68. package/types/ops/registry.d.ts +1 -0
  69. package/types/ops/registry.d.ts.map +1 -1
  70. package/types/pipelines.d.ts +2 -2
  71. package/types/pipelines.d.ts.map +1 -1
  72. package/types/tokenizers.d.ts.map +1 -1
  73. package/types/tsconfig.tsbuildinfo +1 -0
  74. package/types/utils/dtypes.d.ts.map +1 -1
  75. package/types/utils/hub.d.ts +1 -1
  76. package/types/utils/hub.d.ts.map +1 -1
  77. package/types/utils/image.d.ts +3 -2
  78. package/types/utils/image.d.ts.map +1 -1
  79. package/types/utils/maths.d.ts +8 -6
  80. package/types/utils/maths.d.ts.map +1 -1
  81. package/types/utils/tensor.d.ts +8 -4
  82. package/types/utils/tensor.d.ts.map +1 -1
package/src/pipelines.js CHANGED
@@ -69,7 +69,7 @@ import {
69
69
  import {
70
70
  Tensor,
71
71
  mean_pooling,
72
- interpolate,
72
+ interpolate_4d,
73
73
  quantize_embeddings,
74
74
  topk,
75
75
  } from './utils/tensor.js';
@@ -294,6 +294,7 @@ export class TextClassificationPipeline extends (/** @type {new (options: TextPi
294
294
 
295
295
  // TODO: Use softmax tensor function
296
296
  const function_to_apply =
297
+ // @ts-expect-error TS2339
297
298
  this.model.config.problem_type === 'multi_label_classification'
298
299
  ? batch => batch.sigmoid()
299
300
  : batch => new Tensor(
@@ -302,6 +303,7 @@ export class TextClassificationPipeline extends (/** @type {new (options: TextPi
302
303
  batch.dims,
303
304
  ); // single_label_classification (default)
304
305
 
306
+ // @ts-expect-error TS2339
305
307
  const id2label = this.model.config.id2label;
306
308
 
307
309
  const toReturn = [];
@@ -404,6 +406,7 @@ export class TokenClassificationPipeline extends (/** @type {new (options: TextP
404
406
  const outputs = await this.model(model_inputs)
405
407
 
406
408
  const logits = outputs.logits;
409
+ // @ts-expect-error TS2339
407
410
  const id2label = this.model.config.id2label;
408
411
 
409
412
  const toReturn = [];
@@ -743,11 +746,14 @@ export class Text2TextGenerationPipeline extends (/** @type {new (options: TextP
743
746
 
744
747
 
745
748
  // Add global prefix, if present
749
+ // @ts-expect-error TS2339
746
750
  if (this.model.config.prefix) {
751
+ // @ts-expect-error TS2339
747
752
  texts = texts.map(x => this.model.config.prefix + x)
748
753
  }
749
754
 
750
755
  // Handle task specific params:
756
+ // @ts-expect-error TS2339
751
757
  const task_specific_params = this.model.config.task_specific_params
752
758
  if (task_specific_params && task_specific_params[this.task]) {
753
759
  // Add prefixes, if present
@@ -1486,6 +1492,7 @@ export class AudioClassificationPipeline extends (/** @type {new (options: Audio
1486
1492
  const sampling_rate = this.processor.feature_extractor.config.sampling_rate;
1487
1493
  const preparedAudios = await prepareAudios(audio, sampling_rate);
1488
1494
 
1495
+ // @ts-expect-error TS2339
1489
1496
  const id2label = this.model.config.id2label;
1490
1497
 
1491
1498
  const toReturn = [];
@@ -1796,6 +1803,7 @@ export class AutomaticSpeechRecognitionPipeline extends (/** @type {new (options
1796
1803
  audio = [/** @type {AudioInput} */ (audio)];
1797
1804
  }
1798
1805
 
1806
+ // @ts-expect-error TS2339
1799
1807
  const time_precision = this.processor.feature_extractor.config.chunk_length / this.model.config.max_source_positions;
1800
1808
  const hop_length = this.processor.feature_extractor.config.hop_length;
1801
1809
 
@@ -1861,7 +1869,9 @@ export class AutomaticSpeechRecognitionPipeline extends (/** @type {new (options
1861
1869
 
1862
1870
  // TODO: Right now we only get top beam
1863
1871
  if (return_timestamps === 'word') {
1872
+ // @ts-expect-error TS2339
1864
1873
  chunk.tokens = data.sequences.tolist()[0];
1874
+ // @ts-expect-error TS2339
1865
1875
  chunk.token_timestamps = data.token_timestamps.tolist()[0].map(
1866
1876
  (/** @type {number} */ x) => round(x, 2)
1867
1877
  );
@@ -1906,7 +1916,7 @@ export class AutomaticSpeechRecognitionPipeline extends (/** @type {new (options
1906
1916
  const max_new_tokens = Math.floor(aud.length / sampling_rate) * 6;
1907
1917
  const outputs = await this.model.generate({ max_new_tokens, ...kwargs, ...inputs });
1908
1918
 
1909
- const text = this.processor.batch_decode(outputs, { skip_special_tokens: true })[0];
1919
+ const text = this.processor.batch_decode(/** @type {Tensor} */(outputs), { skip_special_tokens: true })[0];
1910
1920
  toReturn.push({ text });
1911
1921
  }
1912
1922
  return single ? toReturn[0] : toReturn;
@@ -2055,6 +2065,7 @@ export class ImageClassificationPipeline extends (/** @type {new (options: Image
2055
2065
  const { pixel_values } = await this.processor(preparedImages);
2056
2066
  const output = await this.model({ pixel_values });
2057
2067
 
2068
+ // @ts-expect-error TS2339
2058
2069
  const id2label = this.model.config.id2label;
2059
2070
 
2060
2071
  /** @type {ImageClassificationOutput[]} */
@@ -2169,6 +2180,7 @@ export class ImageSegmentationPipeline extends (/** @type {new (options: ImagePi
2169
2180
  }
2170
2181
  }
2171
2182
 
2183
+ // @ts-expect-error TS2339
2172
2184
  const id2label = this.model.config.id2label;
2173
2185
 
2174
2186
  /** @type {ImageSegmentationPipelineOutput[]} */
@@ -2395,6 +2407,7 @@ export class ObjectDetectionPipeline extends (/** @type {new (options: ImagePipe
2395
2407
  const processed = this.processor.image_processor.post_process_object_detection(output, threshold, imageSizes);
2396
2408
 
2397
2409
  // Add labels
2410
+ // @ts-expect-error TS2339
2398
2411
  const id2label = this.model.config.id2label;
2399
2412
 
2400
2413
  // Format output
@@ -2614,6 +2627,7 @@ export class DocumentQuestionAnsweringPipeline extends (/** @type {new (options:
2614
2627
  // Run model
2615
2628
  const output = await this.model.generate({
2616
2629
  inputs: pixel_values,
2630
+ // @ts-expect-error TS2339
2617
2631
  max_length: this.model.config.decoder.max_position_embeddings,
2618
2632
  decoder_input_ids,
2619
2633
  ...generate_kwargs,
@@ -2729,6 +2743,7 @@ export class TextToAudioPipeline extends (/** @type {new (options: TextToAudioPi
2729
2743
  // Generate waveform
2730
2744
  const { waveform } = await this.model(inputs);
2731
2745
 
2746
+ // @ts-expect-error TS2339
2732
2747
  const sampling_rate = this.model.config.sampling_rate;
2733
2748
  return {
2734
2749
  audio: waveform.data,
@@ -2886,11 +2901,23 @@ export class DepthEstimationPipeline extends (/** @type {new (options: ImagePipe
2886
2901
 
2887
2902
  const toReturn = [];
2888
2903
  for (let i = 0; i < preparedImages.length; ++i) {
2889
- const prediction = interpolate(predicted_depth[i], preparedImages[i].size.reverse(), 'bilinear', false);
2890
- const formatted = prediction.mul_(255 / max(prediction.data)[0]).to('uint8');
2904
+ const batch = predicted_depth[i];
2905
+ const [height, width] = batch.dims.slice(-2);
2906
+ const [new_width, new_height] = preparedImages[i].size;
2907
+
2908
+ // Interpolate to original size
2909
+ const prediction = (await interpolate_4d(batch.view(1, 1, height, width), {
2910
+ size: [new_height, new_width],
2911
+ mode: 'bilinear',
2912
+ })).view(new_height, new_width);
2913
+
2914
+ const minval = /** @type {number} */(prediction.min().item());
2915
+ const maxval = /** @type {number} */(prediction.max().item());
2916
+ const formatted = prediction.sub(minval).div_(maxval - minval).mul_(255).to('uint8').unsqueeze(0);
2917
+ const depth = RawImage.fromTensor(formatted);
2891
2918
  toReturn.push({
2892
- predicted_depth: predicted_depth[i],
2893
- depth: RawImage.fromTensor(formatted),
2919
+ predicted_depth: prediction,
2920
+ depth,
2894
2921
  });
2895
2922
  }
2896
2923
 
@@ -3368,4 +3395,4 @@ async function loadItems(mapping, model, pretrainedOptions) {
3368
3395
  }
3369
3396
 
3370
3397
  return result;
3371
- }
3398
+ }
package/src/tokenizers.js CHANGED
@@ -47,10 +47,8 @@ import {
47
47
  import { Template } from '@huggingface/jinja';
48
48
 
49
49
  import {
50
- WHISPER_LANGUAGE_MAPPING,
51
- whisper_language_to_code,
50
+ WHISPER_LANGUAGE_MAPPING
52
51
  } from './models/whisper/common_whisper.js';
53
- import { GITHUB_ISSUE_URL } from './utils/constants.js';
54
52
 
55
53
  /**
56
54
  * @typedef {Object} TokenizerProperties Additional tokenizer-specific properties.
@@ -535,7 +533,7 @@ class Unigram extends TokenizerModel {
535
533
  * Create a new Unigram tokenizer model.
536
534
  * @param {Object} config The configuration object for the Unigram model.
537
535
  * @param {number} config.unk_id The ID of the unknown token
538
- * @param {any[][]} config.vocab A 2D array representing a mapping of tokens to scores.
536
+ * @param {[string, number][]} config.vocab A 2D array representing a mapping of tokens to scores.
539
537
  * @param {Object} moreConfig Additional configuration object for the Unigram model.
540
538
  */
541
539
  constructor(config, moreConfig) {
@@ -543,11 +541,10 @@ class Unigram extends TokenizerModel {
543
541
 
544
542
  const vocabSize = config.vocab.length;
545
543
  this.vocab = new Array(vocabSize);
544
+ /** @type {number[]} */
546
545
  this.scores = new Array(vocabSize);
547
546
  for (let i = 0; i < vocabSize; ++i) {
548
- const piece = config.vocab[i];
549
- this.vocab[i] = piece[0];
550
- this.scores[i] = piece[1];
547
+ [this.vocab[i], this.scores[i]] = config.vocab[i];
551
548
  }
552
549
 
553
550
  this.unk_token_id = config.unk_id;
@@ -1,3 +1,5 @@
1
+ /// <reference types="@webgpu/types" />
2
+
1
3
  import { apis } from "../env.js";
2
4
 
3
5
  import { DEVICE_TYPES } from "./devices.js";
package/src/utils/hub.js CHANGED
@@ -121,7 +121,7 @@ class FileResponse {
121
121
  */
122
122
  async arrayBuffer() {
123
123
  const data = await fs.promises.readFile(this.filePath);
124
- return data.buffer;
124
+ return /** @type {ArrayBuffer} */ (data.buffer);
125
125
  }
126
126
 
127
127
  /**
@@ -225,8 +225,9 @@ export function magnitude(arr) {
225
225
 
226
226
  /**
227
227
  * Returns the value and index of the minimum element in an array.
228
- * @param {number[]|TypedArray} arr array of numbers.
229
- * @returns {[number, number]} the value and index of the minimum element, of the form: [valueOfMin, indexOfMin]
228
+ * @template {number[]|bigint[]|AnyTypedArray} T
229
+ * @param {T} arr array of numbers.
230
+ * @returns {T extends bigint[]|BigTypedArray ? [bigint, number] : [number, number]} the value and index of the minimum element, of the form: [valueOfMin, indexOfMin]
230
231
  * @throws {Error} If array is empty.
231
232
  */
232
233
  export function min(arr) {
@@ -239,14 +240,15 @@ export function min(arr) {
239
240
  indexOfMin = i;
240
241
  }
241
242
  }
242
- return [min, indexOfMin];
243
+ return /** @type {T extends bigint[]|BigTypedArray ? [bigint, number] : [number, number]} */([min, indexOfMin]);
243
244
  }
244
245
 
245
246
 
246
247
  /**
247
248
  * Returns the value and index of the maximum element in an array.
248
- * @param {number[]|AnyTypedArray} arr array of numbers.
249
- * @returns {[number, number]} the value and index of the maximum element, of the form: [valueOfMax, indexOfMax]
249
+ * @template {number[]|bigint[]|AnyTypedArray} T
250
+ * @param {T} arr array of numbers.
251
+ * @returns {T extends bigint[]|BigTypedArray ? [bigint, number] : [number, number]} the value and index of the maximum element, of the form: [valueOfMax, indexOfMax]
250
252
  * @throws {Error} If array is empty.
251
253
  */
252
254
  export function max(arr) {
@@ -259,7 +261,7 @@ export function max(arr) {
259
261
  indexOfMax = i;
260
262
  }
261
263
  }
262
- return [Number(max), indexOfMax];
264
+ return /** @type {T extends bigint[]|BigTypedArray ? [bigint, number] : [number, number]} */([max, indexOfMax]);
263
265
  }
264
266
 
265
267
  function isPowerOfTwo(number) {
@@ -9,6 +9,8 @@
9
9
 
10
10
  import {
11
11
  interpolate_data,
12
+ max,
13
+ min,
12
14
  permute_data
13
15
  } from './maths.js';
14
16
 
@@ -464,8 +466,6 @@ export class Tensor {
464
466
  return this.permute(...dims);
465
467
  }
466
468
 
467
- // TODO add .max() and .min() methods
468
-
469
469
  /**
470
470
  * Returns the sum of each row of the input tensor in the given dimension dim.
471
471
  *
@@ -759,6 +759,36 @@ export class Tensor {
759
759
  return mean(this, dim, keepdim);
760
760
  }
761
761
 
762
+ min(dim = null, keepdim = false) {
763
+ if (dim !== null) {
764
+ throw new Error("`dim !== null` not yet implemented.");
765
+ }
766
+ const value = min(this.data)[0];
767
+ return new Tensor(this.type, [value], []);
768
+ }
769
+ max(dim = null, keepdim = false) {
770
+ if (dim !== null) {
771
+ throw new Error("`dim !== null` not yet implemented.");
772
+ }
773
+ const value = max(this.data)[0];
774
+ return new Tensor(this.type, [value], []);
775
+ }
776
+
777
+ argmin(dim = null, keepdim = false) {
778
+ if (dim !== null) {
779
+ throw new Error("`dim !== null` not yet implemented.");
780
+ }
781
+ const index = min(this.data)[1];
782
+ return new Tensor('int64', [BigInt(index)], []);
783
+ }
784
+ argmax(dim = null, keepdim = false) {
785
+ if (dim !== null) {
786
+ throw new Error("`dim !== null` not yet implemented.");
787
+ }
788
+ const index = max(this.data)[1];
789
+ return new Tensor('int64', [BigInt(index)], []);
790
+ }
791
+
762
792
  /**
763
793
  * Performs Tensor dtype conversion.
764
794
  * @param {DataType} type The desired data type.
@@ -892,7 +922,7 @@ export function interpolate(input, [out_height, out_width], mode = 'bilinear', a
892
922
  * @param {Tensor} input the input tensor
893
923
  * @param {Object} options the options for the interpolation
894
924
  * @param {[number, number]|[number, number, number]|[number, number, number, number]} [options.size=null] output spatial size.
895
- * @param {"bilinear"|"bicubic"} [options.mode='bilinear'] algorithm used for upsampling
925
+ * @param {"nearest"|"bilinear"|"bicubic"} [options.mode='bilinear'] algorithm used for upsampling
896
926
  * @returns {Promise<Tensor>} The interpolated tensor.
897
927
  */
898
928
  export async function interpolate_4d(input, {
@@ -922,7 +952,9 @@ export async function interpolate_4d(input, {
922
952
  }
923
953
 
924
954
  let op;
925
- if (mode === 'bilinear') {
955
+ if (mode === 'nearest') {
956
+ op = await TensorOpRegistry.nearest_interpolate_4d;
957
+ } else if (mode === 'bilinear') {
926
958
  op = await TensorOpRegistry.bilinear_interpolate_4d;
927
959
  } else if (mode === 'bicubic') {
928
960
  op = await TensorOpRegistry.bicubic_interpolate_4d;
@@ -963,13 +995,13 @@ export async function rfft(x, a) {
963
995
  * Returns the k largest elements of the given input tensor.
964
996
  * Inspired by https://pytorch.org/docs/stable/generated/torch.topk.html
965
997
  * @param {Tensor} x the input tensor
966
- * @param {number} k the k in "top-k"
998
+ * @param {number} [k] the k in "top-k"
967
999
  * @returns {Promise<[Tensor, Tensor]>} the output tuple of (Tensor, LongTensor) of top-k elements and their indices.
968
1000
  */
969
1001
  export async function topk(x, k) {
970
1002
  const op = await TensorOpRegistry.top_k;
971
1003
 
972
- if (k === null) {
1004
+ if (k == null) {
973
1005
  k = x.dims.at(-1);
974
1006
  } else {
975
1007
  k = Math.min(k, x.dims.at(-1));
@@ -998,10 +1030,10 @@ const arrayToIndexTensor = (array) => new Tensor('int64', array, [array.length])
998
1030
  export async function slice(data, starts, ends, axes, steps) {
999
1031
  const op = await TensorOpRegistry.slice;
1000
1032
  return await op({
1001
- x: data,
1002
- s: arrayToIndexTensor(starts),
1003
- e: arrayToIndexTensor(ends),
1004
- a: arrayToIndexTensor(axes),
1033
+ x: data,
1034
+ s: arrayToIndexTensor(starts),
1035
+ e: arrayToIndexTensor(ends),
1036
+ a: arrayToIndexTensor(axes),
1005
1037
  t: arrayToIndexTensor(steps ?? new Array(axes.length).fill(1)),
1006
1038
  });
1007
1039
  }
@@ -14,19 +14,19 @@ declare const FeatureExtractor_base: new () => {
14
14
  */
15
15
  export class FeatureExtractor extends FeatureExtractor_base {
16
16
  /**
17
- * Instantiate one of the processor classes of the library from a pretrained model.
17
+ * Instantiate one of the feature extractor classes of the library from a pretrained model.
18
18
  *
19
- * The processor class to instantiate is selected based on the `image_processor_type` (or `feature_extractor_type`; legacy)
20
- * property of the config object (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
19
+ * The feature extractor class to instantiate is selected based on the `feature_extractor_type` property of
20
+ * the config object (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
21
21
  *
22
22
  * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
23
- * - A string, the *model id* of a pretrained processor hosted inside a model repo on huggingface.co.
23
+ * - A string, the *model id* of a pretrained feature_extractor hosted inside a model repo on huggingface.co.
24
24
  * Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
25
25
  * user or organization name, like `dbmdz/bert-base-german-cased`.
26
- * - A path to a *directory* containing processor files, e.g., `./my_model_directory/`.
27
- * @param {import('../utils/hub.js').PretrainedOptions} options Additional options for loading the processor.
26
+ * - A path to a *directory* containing feature_extractor files, e.g., `./my_model_directory/`.
27
+ * @param {import('../utils/hub.js').PretrainedOptions} options Additional options for loading the feature_extractor.
28
28
  *
29
- * @returns {Promise<FeatureExtractor>} A new instance of the Processor class.
29
+ * @returns {Promise<FeatureExtractor>} A new instance of the Feature Extractor class.
30
30
  */
31
31
  static from_pretrained(pretrained_model_name_or_path: string, options: import("../utils/hub.js").PretrainedOptions): Promise<FeatureExtractor>;
32
32
  /**
@@ -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,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,GAAC,iBACD,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,CAwDtD;AAkPD;;;;;;;;;GASG;AACH,4DARW,GAAC,cACD,MAAM,mBACN,MAAM,gCACN,MAAM,sBACN,GAAG,CAAC,MAAM,CAAC,iBACX,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAChB,KAAK,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CAAC,CAAC,CAuE/G;AAGD;;;;;;;GAOG;AACH,4DANW,GAAC,cACD,MAAM,iBACN,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB,KAAK,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,KAAK,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CAAC,CAAC,CAI/G;;KA3iBsC,GAAG;UAAyB,GACnE;;AA6iBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;IAqeI;;;;;;;;;;;;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N,OAAO,CAAC,QAAQ,CAAC,CAO7B;IAED;;;;;OAKG;IAEH;;;;;;OAMG;IACH,kBAJW,QAAQ,iGAEN,OAAO;;;;uBAVN,WAAW;;;;6BACX,WAAW;;;;sBACX,MAAM;MAQmB,CAsHtC;IAED;;;;;;;OAOG;IACH,cAJW,QAAQ,EAAE,WACP,GAAG,EAAA,GACJ,OAAO,CAAC,oBAAoB,CAAC,CAqBzC;CAsBJ;;;;;0BAvjCY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;;;;;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"}
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,GAAC,iBACD,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,CAwDtD;AAkPD;;;;;;;;;GASG;AACH,4DARW,GAAC,cACD,MAAM,mB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;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"}
@@ -5,6 +5,7 @@ declare const Processor_base: new () => {
5
5
  /**
6
6
  * @typedef {Object} ProcessorProperties Additional processor-specific properties.
7
7
  * @typedef {import('../utils/hub.js').PretrainedOptions & ProcessorProperties} PretrainedProcessorOptions
8
+ * @typedef {import('../tokenizers.js').PreTrainedTokenizer} PreTrainedTokenizer
8
9
  */
9
10
  /**
10
11
  * Represents a Processor that extracts features from an input.
@@ -15,8 +16,8 @@ export class Processor extends Processor_base {
15
16
  /**
16
17
  * Instantiate one of the processor classes of the library from a pretrained model.
17
18
  *
18
- * The processor class to instantiate is selected based on the `feature_extractor_type` property of the config object
19
- * (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
19
+ * The processor class to instantiate is selected based on the `image_processor_type` (or `feature_extractor_type`; legacy)
20
+ * property of the config object (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
20
21
  *
21
22
  * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
22
23
  * - A string, the *model id* of a pretrained processor hosted inside a model repo on huggingface.co.
@@ -41,28 +42,24 @@ export class Processor extends Processor_base {
41
42
  */
42
43
  get image_processor(): import("./image_processors_utils.js").ImageProcessor | undefined;
43
44
  /**
44
- * @returns {import('../tokenizers.js').PreTrainedTokenizer|undefined} The tokenizer of the processor, if it exists.
45
+ * @returns {PreTrainedTokenizer|undefined} The tokenizer of the processor, if it exists.
45
46
  */
46
- get tokenizer(): import("../tokenizers.js").PreTrainedTokenizer | undefined;
47
+ get tokenizer(): PreTrainedTokenizer | undefined;
47
48
  /**
48
49
  * @returns {import('./feature_extraction_utils.js').FeatureExtractor|undefined} The feature extractor of the processor, if it exists.
49
50
  */
50
51
  get feature_extractor(): import("./feature_extraction_utils.js").FeatureExtractor | undefined;
51
- apply_chat_template(messages: any, options?: {}): string | number[] | number[][] | import("../transformers.js").Tensor | {
52
- /**
53
- * List of token ids to be fed to a model.
54
- */
55
- input_ids: number[] | number[][] | import("../transformers.js").Tensor;
56
- /**
57
- * List of indices specifying which tokens should be attended to by the model.
58
- */
59
- attention_mask: number[] | number[][] | import("../transformers.js").Tensor;
60
- /**
61
- * List of token type ids to be fed to a model.
62
- */
63
- token_type_ids?: number[] | number[][] | import("../transformers.js").Tensor;
64
- };
65
- batch_decode(...args: any[]): string[];
52
+ /**
53
+ * @param {Parameters<PreTrainedTokenizer['apply_chat_template']>[0]} messages
54
+ * @param {Parameters<PreTrainedTokenizer['apply_chat_template']>[1]} options
55
+ * @returns {ReturnType<PreTrainedTokenizer['apply_chat_template']>}
56
+ */
57
+ apply_chat_template(messages: Parameters<PreTrainedTokenizer["apply_chat_template"]>[0], options?: Parameters<PreTrainedTokenizer["apply_chat_template"]>[1]): ReturnType<PreTrainedTokenizer["apply_chat_template"]>;
58
+ /**
59
+ * @param {Parameters<PreTrainedTokenizer['batch_decode']>} args
60
+ * @returns {ReturnType<PreTrainedTokenizer['batch_decode']>}
61
+ */
62
+ batch_decode(batch: number[][] | import("../transformers.js").Tensor, decode_args?: any): ReturnType<PreTrainedTokenizer["batch_decode"]>;
66
63
  /**
67
64
  * Calls the feature_extractor function with the given input.
68
65
  * @param {any} input The input to extract features from.
@@ -76,5 +73,6 @@ export class Processor extends Processor_base {
76
73
  */
77
74
  export type ProcessorProperties = any;
78
75
  export type PretrainedProcessorOptions = import("../utils/hub.js").PretrainedOptions & ProcessorProperties;
76
+ export type PreTrainedTokenizer = import("../tokenizers.js").PreTrainedTokenizer;
79
77
  export {};
80
78
  //# 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":";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"}
1
+ {"version":3,"file":"processing_utils.d.ts","sourceRoot":"","sources":["../../src/base/processing_utils.js"],"names":[],"mappings":";KAIsD,GAAG;UACxD,GAAE;;AAsBH;;;;GAIG;AAGH;;GAEG;AACH;IACI,yBAIC;IACD,sCAAqC;IA6ErC;;;;;;;;;;;;;;OAcG;IACH,sDATW,MAAM,WAKN,0BAA0B,GAExB,OAAO,CAAC,SAAS,CAAC,CAoB9B;IA5GD;;;;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,mBAAmB,GAAC,SAAS,CAIzC;IAED;;OAEG;IACH,yBAFa,OAAO,+BAA+B,EAAE,gBAAgB,GAAC,SAAS,CA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;;+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"}
@@ -1,4 +1,4 @@
1
- type GenerationFunctionParameters = {
1
+ export type GenerationFunctionParameters = {
2
2
  /**
3
3
  * (`Tensor` of varying shape depending on the modality, *optional*):
4
4
  * The sequence used as a prompt for the generation or as model inputs to the encoder. If `null` the
@@ -1 +1 @@
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
+ {"version":3,"file":"feature_extraction_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/feature_extraction_auto.js"],"names":[],"mappings":"AAMA;kFAmBgU,oBAAiB;CADhV;iCArBgC,wCAAwC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"image_processing_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/image_processing_auto.js"],"names":[],"mappings":"AAMA;kFAuB88yC,oBAAiB;CAD99yC;+BAzB8B,sCAAsC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"processing_auto.d.ts","sourceRoot":"","sources":["../../../src/models/auto/processing_auto.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;;CA2CC;0BA/EyB,gCAAgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"image_processing_convnext.d.ts","sourceRoot":"","sources":["../../../src/models/convnext/image_processing_convnext.js"],"names":[],"mappings":"AAIA;IACI,yBAOC;IAJG;;OAEG;IACH,cAAmD;IAGvD,iCA4BC;CACJ;AACD;CAAwE;+BA1CjE,sCAAsC"}
1
+ {"version":3,"file":"image_processing_convnext.d.ts","sourceRoot":"","sources":["../../../src/models/convnext/image_processing_convnext.js"],"names":[],"mappings":"AAIA;IACI,yBAQC;IALG;;OAEG;IAEH,cAAmD;IAGvD,iCA4BC;CACJ;AACD;CAAwE;+BA3CjE,sCAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"image_processing_efficientnet.d.ts","sourceRoot":"","sources":["../../../src/models/efficientnet/image_processing_efficientnet.js"],"names":[],"mappings":"AAIA;IACI,yBAMC;IAJG,iBAAkD;CAKzD;+BAVM,sCAAsC"}
1
+ {"version":3,"file":"image_processing_efficientnet.d.ts","sourceRoot":"","sources":["../../../src/models/efficientnet/image_processing_efficientnet.js"],"names":[],"mappings":"AAIA;IACI,yBAOC;IAJG,iBAAkD;CAKzD;+BAXM,sCAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"processing_florence2.d.ts","sourceRoot":"","sources":["../../../src/models/florence2/processing_florence2.js"],"names":[],"mappings":"AAIA;IACI,6CAAsC;IACtC,wDAAiD;IAEjD,0CAuBC;IAdG,kCAAkC;IAClC,mCADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAC2E;IAEzG,kCAAkC;IAClC,6BADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAC+D;IAE7F,kCAAkC;IAClC,yBADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CACuD;IAErF;;;MAGC;IACD,qBAAwB;IAG5B;;;;OAIG;IACH,wBAHW,MAAM,GAAC,MAAM,EAAE,GACb,MAAM,EAAE,CA6BpB;IAED;;;;;OAKG;IACH,8BAJW,MAAM,QACN,MAAM,cACN,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;MAsC1B;IAID,0DAaC;CACJ;0BA/HyB,gCAAgC;8BAE5B,qBAAqB;mCADhB,kCAAkC"}
1
+ {"version":3,"file":"processing_florence2.d.ts","sourceRoot":"","sources":["../../../src/models/florence2/processing_florence2.js"],"names":[],"mappings":"AAIA;IACI,6CAAsC;IACtC,wDAAiD;IAEjD,0CA0BC;IAdG,kCAAkC;IAClC,mCADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAC2E;IAEzG,kCAAkC;IAClC,6BADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAC+D;IAE7F,kCAAkC;IAClC,yBADW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CACuD;IAErF;;;MAGC;IACD,qBAAwB;IAG5B;;;;OAIG;IACH,wBAHW,MAAM,GAAC,MAAM,EAAE,GACb,MAAM,EAAE,CA6BpB;IAED;;;;;OAKG;IACH,8BAJW,MAAM,QACN,MAAM,cACN,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;MAsC1B;IAID,0DAaC;CACJ;0BAlIyB,gCAAgC;8BAE5B,qBAAqB;mCADhB,kCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"image_processing_idefics3.d.ts","sourceRoot":"","sources":["../../../src/models/idefics3/image_processing_idefics3.js"],"names":[],"mappings":"AAOA;IACI,yBAKC;IAFG,wBAA2D;IAC3D,oBAA2C;IAG/C;;;OAGG;IAEH;;;;;OAKG;IACH,6GAHW,MAAM;;;MAiBhB;IAED,uDAAuD;IACvD,cADY,0CAAS,yCAAU,GAAC,yCAAU,EAAE;;;;;;;;;;OA4H3C;IAED;;;;;;OA4DC;CACJ;+BAjOM,sCAAsC"}
1
+ {"version":3,"file":"image_processing_idefics3.d.ts","sourceRoot":"","sources":["../../../src/models/idefics3/image_processing_idefics3.js"],"names":[],"mappings":"AAOA;IACI,yBAKC;IAFG,wBAA2D;IAC3D,oBAA2C;IAG/C;;;OAGG;IAEH;;;;;OAKG;IACH,6GAHW,MAAM;;;MAiBhB;IAED,uDAAuD;IACvD,cADY,0CAAS,yCAAU,GAAC,yCAAU,EAAE;;;;;;;;;;OA8H3C;IAED;;;;;;OA4DC;CACJ;+BAnOM,sCAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"image_processing_janus.d.ts","sourceRoot":"","sources":["../../../src/models/janus/image_processing_janus.js"],"names":[],"mappings":"AAKA;IACI,yBAUC;IADG,qBAAqF;IAGzF,+GAMC;CACJ;+BAtBM,sCAAsC"}
1
+ {"version":3,"file":"image_processing_janus.d.ts","sourceRoot":"","sources":["../../../src/models/janus/image_processing_janus.js"],"names":[],"mappings":"AAKA;IACI,yBAWC;IADG,qBAAqF;IAGzF,+GAMC;CACJ;+BAvBM,sCAAsC"}
@@ -1 +1 @@
1
- {"version":3,"file":"processing_mgp_str.d.ts","sourceRoot":"","sources":["../../../src/models/mgp_str/processing_mgp_str.js"],"names":[],"mappings":"AAUA;IACI,6CAAsC;IACtC,wDAAiD;IAEjD;;OAEG;IACH,sBAFa,OAAO,qBAAqB,EAAE,eAAe,CAIzD;IAED;;OAEG;IACH,qBAFa,OAAO,qBAAqB,EAAE,aAAa,CAIvD;IAED;;OAEG;IACH,oBAFa,OAAO,qBAAqB,EAAE,aAAa,CAIvD;IAED;;;;;OAKG;IACH,4BAJW,OAAO,uBAAuB,EAAE,MAAM,UACtC,MAAM,GACJ,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CA0ChC;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,EAAE,GACR,MAAM,EAAE,CAIpB;IAED;;;;OAIG;IACH,sBAHW,MAAM,EAAE,EAAE,GACR,MAAM,EAAE,CAIpB;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,EAAE,GACR,MAAM,EAAE,CAIpB;IAED;;;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;IAmBD,6CAQC;CACJ;0BA3KyB,gCAAgC;8BAE5B,qBAAqB;mCADhB,kCAAkC"}
@@ -1 +1 @@
1
- {"version":3,"file":"processing_paligemma.d.ts","sourceRoot":"","sources":["../../../src/models/paligemma/processing_paligemma.js"],"names":[],"mappings":"AAgBA;IACI,6CAAsC;IACtC,wDAAiD;IAGjD;;OAEG;IAGH,cAAuB,0CAAS,yCAAU,yCAsDzC;CACJ;0BAjFyB,gCAAgC;8BAE5B,qBAAqB;mCADhB,kCAAkC"}
1
+ {"version":3,"file":"processing_paligemma.d.ts","sourceRoot":"","sources":["../../../src/models/paligemma/processing_paligemma.js"],"names":[],"mappings":"AAgBA;IACI,6CAAsC;IACtC,wDAAiD;IAGjD;;OAEG;IAGH,cAAuB,0CAAS,yCAAU,yCAuDzC;CACJ;0BAlFyB,gCAAgC;8BAE5B,qBAAqB;mCADhB,kCAAkC"}
@@ -5,10 +5,14 @@ export class Phi3VProcessor extends Processor {
5
5
  *
6
6
  * @param {string|string[]} text
7
7
  * @param {RawImage|RawImage[]} images
8
- * @param {...any} args
8
+ * @param { { padding?: boolean, truncation?: boolean, num_crops?: number } | undefined } options
9
9
  * @returns {Promise<any>}
10
10
  */
11
- _call(text: string | string[], images?: RawImage | RawImage[], { padding, truncation, num_crops, }?: any[]): Promise<any>;
11
+ _call(text: string | string[], images?: RawImage | RawImage[], { padding, truncation, num_crops, }?: {
12
+ padding?: boolean;
13
+ truncation?: boolean;
14
+ num_crops?: number;
15
+ } | undefined): Promise<any>;
12
16
  }
13
17
  import { Processor } from "../../base/processing_utils.js";
14
18
  import { RawImage } from "../../utils/image.js";
@@ -1 +1 @@
1
- {"version":3,"file":"processing_phi3_v.d.ts","sourceRoot":"","sources":["../../../src/models/phi3_v/processing_phi3_v.js"],"names":[],"mappings":"AAQA;IACI,wDAAiD;IACjD,6CAAsC;IAEtC;;;;;;OAMG;IACH,YALW,MAAM,GAAC,MAAM,EAAE,WACf,QAAQ,GAAC,QAAQ,EAAE,wCACf,GAAG,EAAA,GACL,OAAO,CAAC,GAAG,CAAC,CAkCxB;CACJ;0BApDyB,gCAAgC;yBAGjC,sBAAsB;mCAFZ,kCAAkC;8BACvC,qBAAqB"}
1
+ {"version":3,"file":"processing_phi3_v.d.ts","sourceRoot":"","sources":["../../../src/models/phi3_v/processing_phi3_v.js"],"names":[],"mappings":"AAQA;IACI,wDAAiD;IACjD,6CAAsC;IAEtC;;;;;;OAMG;IACH,YALW,MAAM,GAAC,MAAM,EAAE,WACf,QAAQ,GAAC,QAAQ,EAAE,wCACjB;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,GAC3E,OAAO,CAAC,GAAG,CAAC,CAkCxB;CACJ;0BApDyB,gCAAgC;yBAGjC,sBAAsB;mCAFZ,kCAAkC;8BACvC,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature_extraction_pyannote.d.ts","sourceRoot":"","sources":["../../../src/models/pyannote/feature_extraction_pyannote.js"],"names":[],"mappings":"AAKA;IACI;;;;OAIG;IACH,aAHW,YAAY,GAAC,YAAY,GACvB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;KAAE,CAAC,CAiB9C;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;OAKG;IACH,yCAJW,OAAO,uBAAuB,EAAE,MAAM,eACtC,MAAM,GACJ,KAAK,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAwCxF;CAEJ;iCAnFuD,wCAAwC;uBACzE,uBAAuB"}
1
+ {"version":3,"file":"feature_extraction_pyannote.d.ts","sourceRoot":"","sources":["../../../src/models/pyannote/feature_extraction_pyannote.js"],"names":[],"mappings":"AAKA;IACI;;;;OAIG;IACH,aAHW,YAAY,GAAC,YAAY,GACvB,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;KAAE,CAAC,CAiB9C;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;OAKG;IACH,yCAJW,OAAO,uBAAuB,EAAE,MAAM,eACtC,MAAM,GACJ,KAAK,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAyCxF;CAEJ;iCApFuD,wCAAwC;uBACzE,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"processing_qwen2_vl.d.ts","sourceRoot":"","sources":["../../../src/models/qwen2_vl/processing_qwen2_vl.js"],"names":[],"mappings":"AAKA;IACI,wDAAiD;IACjD,6CAAsC;IAEtC;;;;;;OAMG;IACH,YALW,MAAM,GAAC,MAAM,EAAE,WACf,QAAQ,GAAC,QAAQ,EAAE,WACf,GAAG,EAAA,GACL,OAAO,CAAC,GAAG,CAAC,CAoCxB;CACJ;0BAnDyB,gCAAgC;yBAGjC,sBAAsB;mCAFZ,kCAAkC;8BACvC,qBAAqB"}
1
+ {"version":3,"file":"processing_qwen2_vl.d.ts","sourceRoot":"","sources":["../../../src/models/qwen2_vl/processing_qwen2_vl.js"],"names":[],"mappings":"AAKA;IACI,wDAAiD;IACjD,6CAAsC;IAEtC;;;;;;OAMG;IACH,YALW,MAAM,GAAC,MAAM,EAAE,WACf,QAAQ,GAAC,QAAQ,EAAE,WACf,GAAG,EAAA,GACL,OAAO,CAAC,GAAG,CAAC,CAqCxB;CACJ;0BApDyB,gCAAgC;yBAGjC,sBAAsB;mCAFZ,kCAAkC;8BACvC,qBAAqB"}
@@ -0,0 +1,10 @@
1
+ export class SapiensImageProcessor extends ImageProcessor {
2
+ post_process_semantic_segmentation(outputs: any, target_sizes?: [number, number][]): {
3
+ segmentation: import("../../transformers.js").Tensor;
4
+ labels: number[];
5
+ }[];
6
+ }
7
+ export class SapiensFeatureExtractor extends SapiensImageProcessor {
8
+ }
9
+ import { ImageProcessor } from "../../base/image_processors_utils.js";
10
+ //# sourceMappingURL=image_processing_sapiens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image_processing_sapiens.d.ts","sourceRoot":"","sources":["../../../src/models/sapiens/image_processing_sapiens.js"],"names":[],"mappings":"AAMA;;;;;CAKC;AACD;CAAsE;+BAT/D,sCAAsC"}
@@ -69,7 +69,7 @@ export class WhisperGenerationConfig extends GenerationConfig {
69
69
  */
70
70
  max_initial_timestamp_index: number;
71
71
  }
72
- export type WhisperGenerationFunctionParameters = any & {
72
+ export type WhisperGenerationFunctionParameters = import("../../generation/parameters.js").GenerationFunctionParameters & {
73
73
  generation_config: WhisperGenerationConfig;
74
74
  } & WhisperGenerationConfig;
75
75
  import { GenerationConfig } from "../../generation/configuration_utils.js";
@@ -1 +1 @@
1
- {"version":3,"file":"generation_whisper.d.ts","sourceRoot":"","sources":["../../../src/models/whisper/generation_whisper.js"],"names":[],"mappings":"AAEA;IAEI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;;OAKG;IACH,yBAFU,OAAO,CAEc;IAE/B;;;OAGG;IACH,YAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,iBAFU,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAEL;IAEvB;;;OAGG;IACH,MAFU,MAAM,CAEJ;IAEZ;;;;OAIG;IACH,UAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,wBAFU,MAAM,CAEc;IAE9B;;;;;;OAMG;IACH,YAFU,MAAM,EAAE,CAEA;IAElB;;;OAGG;IACH,iBAFU,OAAO,CAEM;IAEvB;;;;OAIG;IACH,YAFU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAC,IAAI,CAEnB;IAElB;;;OAGG;IACH,YAFU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAC,IAAI,CAEnB;IAElB;;;;OAIG;IACH,6BAFU,MAAM,CAEgB;CACnC;kDAGY,GAAqE,GAAG;IAAC,iBAAiB,EAAE,uBAAuB,CAAA;CAAC,GAAG,uBAAuB;iCAvF1H,yCAAyC"}
1
+ {"version":3,"file":"generation_whisper.d.ts","sourceRoot":"","sources":["../../../src/models/whisper/generation_whisper.js"],"names":[],"mappings":"AAEA;IAEI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;;OAKG;IACH,yBAFU,OAAO,CAEc;IAE/B;;;OAGG;IACH,YAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,iBAFU,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAEL;IAEvB;;;OAGG;IACH,MAFU,MAAM,CAEJ;IAEZ;;;;OAIG;IACH,UAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,wBAFU,MAAM,CAEc;IAE9B;;;;;;OAMG;IACH,YAFU,MAAM,EAAE,CAEA;IAElB;;;OAGG;IACH,iBAFU,OAAO,CAEM;IAEvB;;;;OAIG;IACH,YAFU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAC,IAAI,CAEnB;IAElB;;;OAGG;IACH,YAFU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAC,IAAI,CAEnB;IAElB;;;;OAIG;IACH,6BAFU,MAAM,CAEgB;CACnC;kDAGY,OAAO,gCAAgC,EAAE,4BAA4B,GAAG;IAAC,iBAAiB,EAAE,uBAAuB,CAAA;CAAC,GAAG,uBAAuB;iCAvF1H,yCAAyC"}