@huggingface/transformers 3.2.2 → 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 +3 -2
  2. package/dist/transformers.cjs +252 -113
  3. package/dist/transformers.cjs.map +1 -1
  4. package/dist/transformers.js +256 -114
  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 +256 -114
  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 +93 -36
  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 +48 -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
@@ -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_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,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,mBACN,MAAM,gCACN,MAAM,sBACN,GAAG,CAAC,MAAM,CAAC,iBACX,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAChB,KAAK,CAAC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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,CAI9E;IAED;;;;OAIG;IACH,8BAJW,UAAU,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,YACzD,UAAU,CA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E,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;;;;;;;;;;OAUG;IACH,mDATW,OAAO,uBAAuB,EAAE,MAAM,EAAE,GACtC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAC,CA4BvH;IAmBD,6CAQC;CACJ;0BAzKyB,gCAAgC;8BAE5B,qBAAqB;mCADhB,kCAAkC"}
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;;;;;;;;;;OAUG;IAGH,mDAXW,OAAO,uBAAuB,EAAE,MAAM,EAAE,GACtC;QAAC,cAAc,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAC,CA8BvH;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"}
package/types/models.d.ts CHANGED
@@ -149,7 +149,7 @@ export class PreTrainedModel extends PreTrainedModel_base {
149
149
  * @param {import('./generation/parameters.js').GenerationFunctionParameters} options
150
150
  * @returns {Promise<ModelOutput|Tensor>} The output of the model, which can contain the generated token ids, attentions, and scores.
151
151
  */
152
- generate({ inputs, generation_config, logits_processor, stopping_criteria, streamer, ...kwargs }: any): Promise<ModelOutput | Tensor>;
152
+ generate({ inputs, generation_config, logits_processor, stopping_criteria, streamer, ...kwargs }: import("./generation/parameters.js").GenerationFunctionParameters): Promise<ModelOutput | Tensor>;
153
153
  /**
154
154
  * Returns an object containing past key values from the given decoder results object.
155
155
  *
@@ -1181,6 +1181,12 @@ export class WhisperForConditionalGeneration extends WhisperPreTrainedModel {
1181
1181
  * @param {WhisperGenerationConfig} generation_config
1182
1182
  */
1183
1183
  _retrieve_init_tokens(generation_config: WhisperGenerationConfig): number[];
1184
+ /**
1185
+ * Transcribes or translates log-mel input features to a sequence of auto-regressively generated token ids.
1186
+ * @param {import('./models/whisper/generation_whisper.js').WhisperGenerationFunctionParameters} options
1187
+ * @returns {Promise<ModelOutput|Tensor>} The output of the model, which can contain the generated token ids, attentions, and scores.
1188
+ */
1189
+ generate({ inputs, generation_config, logits_processor, stopping_criteria, ...kwargs }: import("./models/whisper/generation_whisper.js").WhisperGenerationFunctionParameters): Promise<ModelOutput | Tensor>;
1184
1190
  /**
1185
1191
  * Calculates token-level timestamps using the encoder-decoder cross-attentions and
1186
1192
  * dynamic time-warping (DTW) to map each output token to a position in the input audio.
@@ -2208,7 +2214,7 @@ export class DPTModel extends DPTPreTrainedModel {
2208
2214
  *
2209
2215
  * **Example:** Depth estimation w/ `Xenova/dpt-hybrid-midas`.
2210
2216
  * ```javascript
2211
- * import { DPTForDepthEstimation, AutoProcessor, RawImage, interpolate, max } from '@huggingface/transformers';
2217
+ * import { DPTForDepthEstimation, AutoProcessor, RawImage, interpolate_4d } from '@huggingface/transformers';
2212
2218
  *
2213
2219
  * // Load model and processor
2214
2220
  * const model_id = 'Xenova/dpt-hybrid-midas';
@@ -2217,7 +2223,7 @@ export class DPTModel extends DPTPreTrainedModel {
2217
2223
  *
2218
2224
  * // Load image from URL
2219
2225
  * const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
2220
- * const image = await RawImage.fromURL(url);
2226
+ * const image = await RawImage.read(url);
2221
2227
  *
2222
2228
  * // Prepare image for the model
2223
2229
  * const inputs = await processor(image);
@@ -2226,10 +2232,15 @@ export class DPTModel extends DPTPreTrainedModel {
2226
2232
  * const { predicted_depth } = await model(inputs);
2227
2233
  *
2228
2234
  * // Interpolate to original size
2229
- * const prediction = interpolate(predicted_depth, image.size.reverse(), 'bilinear', false);
2235
+ * const prediction = (await interpolate_4d(predicted_depth.unsqueeze(1), {
2236
+ * size: image.size.reverse(),
2237
+ * mode: 'bilinear',
2238
+ * })).squeeze(1);
2230
2239
  *
2231
2240
  * // Visualize the prediction
2232
- * const formatted = prediction.mul_(255 / max(prediction.data)[0]).to('uint8');
2241
+ * const min = prediction.min().item();
2242
+ * const max = prediction.max().item();
2243
+ * const formatted = prediction.sub_(min).div_(max - min).mul_(255).to('uint8');
2233
2244
  * const depth = RawImage.fromTensor(formatted);
2234
2245
  * // RawImage {
2235
2246
  * // data: Uint8Array(307200) [ 85, 85, 84, ... ],
@@ -2274,11 +2285,7 @@ export class GLPNPreTrainedModel extends PreTrainedModel {
2274
2285
  export class GLPNModel extends GLPNPreTrainedModel {
2275
2286
  }
2276
2287
  /**
2277
- * GLPN Model transformer with a lightweight depth estimation head on top e.g. for KITTI, NYUv2.
2278
- *
2279
- * **Example:** Depth estimation w/ `Xenova/glpn-kitti`.
2280
- * ```javascript
2281
- * import { GLPNForDepthEstimation, AutoProcessor, RawImage, interpolate, max } from '@huggingface/transformers';
2288
+ * import { GLPNForDepthEstimation, AutoProcessor, RawImage, interpolate_4d } from '@huggingface/transformers';
2282
2289
  *
2283
2290
  * // Load model and processor
2284
2291
  * const model_id = 'Xenova/glpn-kitti';
@@ -2287,7 +2294,7 @@ export class GLPNModel extends GLPNPreTrainedModel {
2287
2294
  *
2288
2295
  * // Load image from URL
2289
2296
  * const url = 'http://images.cocodataset.org/val2017/000000039769.jpg';
2290
- * const image = await RawImage.fromURL(url);
2297
+ * const image = await RawImage.read(url);
2291
2298
  *
2292
2299
  * // Prepare image for the model
2293
2300
  * const inputs = await processor(image);
@@ -2296,13 +2303,18 @@ export class GLPNModel extends GLPNPreTrainedModel {
2296
2303
  * const { predicted_depth } = await model(inputs);
2297
2304
  *
2298
2305
  * // Interpolate to original size
2299
- * const prediction = interpolate(predicted_depth, image.size.reverse(), 'bilinear', false);
2306
+ * const prediction = (await interpolate_4d(predicted_depth.unsqueeze(1), {
2307
+ * size: image.size.reverse(),
2308
+ * mode: 'bilinear',
2309
+ * })).squeeze(1);
2300
2310
  *
2301
2311
  * // Visualize the prediction
2302
- * const formatted = prediction.mul_(255 / max(prediction.data)[0]).to('uint8');
2312
+ * const min = prediction.min().item();
2313
+ * const max = prediction.max().item();
2314
+ * const formatted = prediction.sub_(min).div_(max - min).mul_(255).to('uint8');
2303
2315
  * const depth = RawImage.fromTensor(formatted);
2304
2316
  * // RawImage {
2305
- * // data: Uint8Array(307200) [ 207, 169, 154, ... ],
2317
+ * // data: Uint8Array(307200) [ 85, 85, 84, ... ],
2306
2318
  * // width: 640,
2307
2319
  * // height: 480,
2308
2320
  * // channels: 1
@@ -2437,6 +2449,22 @@ export class Dinov2ForImageClassification extends Dinov2PreTrainedModel {
2437
2449
  */
2438
2450
  _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2439
2451
  }
2452
+ export class Dinov2WithRegistersPreTrainedModel extends PreTrainedModel {
2453
+ }
2454
+ /**
2455
+ * The bare Dinov2WithRegisters Model transformer outputting raw hidden-states without any specific head on top.
2456
+ */
2457
+ export class Dinov2WithRegistersModel extends Dinov2WithRegistersPreTrainedModel {
2458
+ }
2459
+ /**
2460
+ * Dinov2WithRegisters Model transformer with an image classification head on top (a linear layer on top of the final hidden state of the [CLS] token) e.g. for ImageNet.
2461
+ */
2462
+ export class Dinov2WithRegistersForImageClassification extends Dinov2WithRegistersPreTrainedModel {
2463
+ /**
2464
+ * @param {any} model_inputs
2465
+ */
2466
+ _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2467
+ }
2440
2468
  export class YolosPreTrainedModel extends PreTrainedModel {
2441
2469
  }
2442
2470
  export class YolosModel extends YolosPreTrainedModel {
@@ -3460,13 +3488,12 @@ export class DecisionTransformerModel extends DecisionTransformerPreTrainedModel
3460
3488
  export class MultiModalityPreTrainedModel extends PreTrainedModel {
3461
3489
  }
3462
3490
  export class MultiModalityCausalLM extends MultiModalityPreTrainedModel {
3463
- constructor(...args: any[]);
3464
3491
  _generation_mode: string;
3465
3492
  forward(model_inputs: any): Promise<any>;
3466
3493
  /**
3467
3494
  * @param {import('./generation/parameters.js').GenerationFunctionParameters} options
3468
3495
  */
3469
- generate_images(options: any): Promise<RawImage[]>;
3496
+ generate_images(options: import("./generation/parameters.js").GenerationFunctionParameters): Promise<RawImage[]>;
3470
3497
  }
3471
3498
  export class MgpstrModelOutput extends ModelOutput {
3472
3499
  constructor({ char_logits, bpe_logits, wp_logits }: {
@@ -3781,11 +3808,15 @@ export class SequenceClassifierOutput extends ModelOutput {
3781
3808
  /**
3782
3809
  * @param {Object} output The output of the model.
3783
3810
  * @param {Tensor} output.logits classification (or regression if config.num_labels==1) scores (before SoftMax).
3811
+ * @param {Record<string, Tensor>} [output.attentions] Object of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, sequence_length)`.
3812
+ * Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
3784
3813
  */
3785
- constructor({ logits }: {
3814
+ constructor({ logits, ...attentions }: {
3786
3815
  logits: Tensor;
3816
+ attentions?: Record<string, Tensor>;
3787
3817
  });
3788
3818
  logits: Tensor;
3819
+ attentions: Record<string, Tensor>[];
3789
3820
  }
3790
3821
  /**
3791
3822
  * Base class for outputs of XVector models.