@huggingface/transformers 3.2.3 → 3.3.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.
Files changed (105) hide show
  1. package/README.md +5 -3
  2. package/dist/ort-wasm-simd-threaded.jsep.wasm +0 -0
  3. package/dist/ort.bundle.min.mjs +2776 -0
  4. package/dist/transformers.cjs +792 -330
  5. package/dist/transformers.cjs.map +1 -1
  6. package/dist/transformers.js +1150 -656
  7. package/dist/transformers.js.map +1 -1
  8. package/dist/transformers.min.cjs +1 -1
  9. package/dist/transformers.min.cjs.map +1 -1
  10. package/dist/transformers.min.js +1 -1
  11. package/dist/transformers.min.js.map +1 -1
  12. package/dist/transformers.min.mjs +1 -1
  13. package/dist/transformers.min.mjs.map +1 -1
  14. package/dist/transformers.mjs +798 -331
  15. package/dist/transformers.mjs.map +1 -1
  16. package/package.json +3 -3
  17. package/src/base/feature_extraction_utils.js +9 -9
  18. package/src/base/image_processors_utils.js +12 -1
  19. package/src/base/processing_utils.js +24 -3
  20. package/src/configs.js +5 -0
  21. package/src/env.js +1 -2
  22. package/src/generation/streamers.js +5 -2
  23. package/src/models/auto/feature_extraction_auto.js +0 -16
  24. package/src/models/auto/processing_auto.js +0 -16
  25. package/src/models/convnext/image_processing_convnext.js +1 -0
  26. package/src/models/efficientnet/image_processing_efficientnet.js +1 -0
  27. package/src/models/florence2/processing_florence2.js +3 -0
  28. package/src/models/grounding_dino/image_processing_grounding_dino.js +29 -0
  29. package/src/models/grounding_dino/processing_grounding_dino.js +101 -0
  30. package/src/models/idefics3/image_processing_idefics3.js +2 -0
  31. package/src/models/image_processors.js +1 -0
  32. package/src/models/janus/image_processing_janus.js +1 -0
  33. package/src/models/mgp_str/processing_mgp_str.js +2 -0
  34. package/src/models/paligemma/processing_paligemma.js +1 -0
  35. package/src/models/phi3_v/processing_phi3_v.js +1 -1
  36. package/src/models/processors.js +3 -2
  37. package/src/models/pyannote/feature_extraction_pyannote.js +1 -0
  38. package/src/models/qwen2_vl/processing_qwen2_vl.js +1 -0
  39. package/src/models/seamless_m4t/feature_extraction_seamless_m4t.js +2 -2
  40. package/src/models/whisper/feature_extraction_whisper.js +1 -1
  41. package/src/models.js +72 -20
  42. package/src/ops/registry.js +10 -0
  43. package/src/pipelines.js +73 -23
  44. package/src/tokenizers.js +4 -7
  45. package/src/utils/audio.js +113 -1
  46. package/src/utils/core.js +26 -0
  47. package/src/utils/dtypes.js +2 -0
  48. package/src/utils/hub.js +1 -1
  49. package/src/utils/image.js +5 -18
  50. package/src/utils/maths.js +8 -6
  51. package/src/utils/tensor.js +134 -114
  52. package/types/base/feature_extraction_utils.d.ts +7 -7
  53. package/types/base/image_processors_utils.d.ts +7 -0
  54. package/types/base/image_processors_utils.d.ts.map +1 -1
  55. package/types/base/processing_utils.d.ts +25 -19
  56. package/types/base/processing_utils.d.ts.map +1 -1
  57. package/types/configs.d.ts.map +1 -1
  58. package/types/generation/parameters.d.ts +1 -1
  59. package/types/generation/streamers.d.ts +3 -1
  60. package/types/generation/streamers.d.ts.map +1 -1
  61. package/types/models/auto/feature_extraction_auto.d.ts.map +1 -1
  62. package/types/models/auto/image_processing_auto.d.ts.map +1 -1
  63. package/types/models/auto/processing_auto.d.ts.map +1 -1
  64. package/types/models/convnext/image_processing_convnext.d.ts.map +1 -1
  65. package/types/models/efficientnet/image_processing_efficientnet.d.ts.map +1 -1
  66. package/types/models/florence2/processing_florence2.d.ts.map +1 -1
  67. package/types/models/grounding_dino/image_processing_grounding_dino.d.ts +20 -0
  68. package/types/models/grounding_dino/image_processing_grounding_dino.d.ts.map +1 -0
  69. package/types/models/grounding_dino/processing_grounding_dino.d.ts +27 -0
  70. package/types/models/grounding_dino/processing_grounding_dino.d.ts.map +1 -0
  71. package/types/models/idefics3/image_processing_idefics3.d.ts.map +1 -1
  72. package/types/models/image_processors.d.ts +1 -0
  73. package/types/models/janus/image_processing_janus.d.ts.map +1 -1
  74. package/types/models/mgp_str/processing_mgp_str.d.ts.map +1 -1
  75. package/types/models/paligemma/processing_paligemma.d.ts.map +1 -1
  76. package/types/models/phi3_v/processing_phi3_v.d.ts +6 -2
  77. package/types/models/phi3_v/processing_phi3_v.d.ts.map +1 -1
  78. package/types/models/processors.d.ts +3 -2
  79. package/types/models/pyannote/feature_extraction_pyannote.d.ts.map +1 -1
  80. package/types/models/qwen2_vl/processing_qwen2_vl.d.ts.map +1 -1
  81. package/types/models/sapiens/image_processing_sapiens.d.ts +10 -0
  82. package/types/models/sapiens/image_processing_sapiens.d.ts.map +1 -0
  83. package/types/models/whisper/generation_whisper.d.ts +1 -1
  84. package/types/models/whisper/generation_whisper.d.ts.map +1 -1
  85. package/types/models.d.ts +40 -17
  86. package/types/models.d.ts.map +1 -1
  87. package/types/ops/registry.d.ts +1 -0
  88. package/types/ops/registry.d.ts.map +1 -1
  89. package/types/pipelines.d.ts +7 -12
  90. package/types/pipelines.d.ts.map +1 -1
  91. package/types/tokenizers.d.ts.map +1 -1
  92. package/types/tsconfig.tsbuildinfo +1 -0
  93. package/types/utils/audio.d.ts +25 -0
  94. package/types/utils/audio.d.ts.map +1 -1
  95. package/types/utils/core.d.ts +6 -0
  96. package/types/utils/core.d.ts.map +1 -1
  97. package/types/utils/dtypes.d.ts.map +1 -1
  98. package/types/utils/hub.d.ts +1 -1
  99. package/types/utils/hub.d.ts.map +1 -1
  100. package/types/utils/image.d.ts +3 -2
  101. package/types/utils/image.d.ts.map +1 -1
  102. package/types/utils/maths.d.ts +8 -6
  103. package/types/utils/maths.d.ts.map +1 -1
  104. package/types/utils/tensor.d.ts +22 -6
  105. package/types/utils/tensor.d.ts.map +1 -1
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Converts bounding boxes from center format to corners format.
3
+ *
4
+ * @param {number[]} arr The coordinate for the center of the box and its width, height dimensions (center_x, center_y, width, height)
5
+ * @returns {number[]} The coodinates for the top-left and bottom-right corners of the box (top_left_x, top_left_y, bottom_right_x, bottom_right_y)
6
+ */
7
+ export function center_to_corners_format([centerX, centerY, width, height]: number[]): number[];
1
8
  /**
2
9
  * Post-processes the outputs of the model (for object detection).
3
10
  * @param {Object} outputs The outputs of the model that must be post-processed
@@ -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;;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C,MAAM,EAAE,MAAM,CAAC,CA4F5B;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,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":"AAgEA;;;;;GAKG;AACH,4EAHW,MAAM,EAAE,GACN,MAAM,EAAE,CASpB;AAED;;;;;;;;;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,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AW,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"}
@@ -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,32 @@ 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"]>;
63
+ /**
64
+ * @param {Parameters<PreTrainedTokenizer['decode']>} args
65
+ * @returns {ReturnType<PreTrainedTokenizer['decode']>}
66
+ */
67
+ decode(token_ids: number[] | bigint[] | import("../transformers.js").Tensor, decode_args?: {
68
+ skip_special_tokens?: boolean;
69
+ clean_up_tokenization_spaces?: boolean;
70
+ }): ReturnType<PreTrainedTokenizer["decode"]>;
66
71
  /**
67
72
  * Calls the feature_extractor function with the given input.
68
73
  * @param {any} input The input to extract features from.
@@ -76,5 +81,6 @@ export class Processor extends Processor_base {
76
81
  */
77
82
  export type ProcessorProperties = any;
78
83
  export type PretrainedProcessorOptions = import("../utils/hub.js").PretrainedOptions & ProcessorProperties;
84
+ export type PreTrainedTokenizer = import("../tokenizers.js").PreTrainedTokenizer;
79
85
  export {};
80
86
  //# 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;IAwFrC;;;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B,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;gCAlWY,OAAO,gBAAgB,EAAE,iBAAiB;+BAI1C,OAAO,iBAAiB,EAAE,gBAAgB;2BAI1C,OAAO,iBAAiB,EAAE,YAAY;;;;;;;;qBA+VrC,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"}
@@ -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
@@ -18,12 +18,14 @@ export class TextStreamer extends BaseStreamer {
18
18
  * @param {import('../tokenizers.js').PreTrainedTokenizer} tokenizer
19
19
  * @param {Object} options
20
20
  * @param {boolean} [options.skip_prompt=false] Whether to skip the prompt tokens
21
+ * @param {boolean} [options.skip_special_tokens=true] Whether to skip special tokens when decoding
21
22
  * @param {function(string): void} [options.callback_function=null] Function to call when a piece of text is ready to display
22
23
  * @param {function(bigint[]): void} [options.token_callback_function=null] Function to call when a new token is generated
23
24
  * @param {Object} [options.decode_kwargs={}] Additional keyword arguments to pass to the tokenizer's decode method
24
25
  */
25
- constructor(tokenizer: import("../tokenizers.js").PreTrainedTokenizer, { skip_prompt, callback_function, token_callback_function, decode_kwargs, ...kwargs }?: {
26
+ constructor(tokenizer: import("../tokenizers.js").PreTrainedTokenizer, { skip_prompt, callback_function, token_callback_function, skip_special_tokens, decode_kwargs, ...kwargs }?: {
26
27
  skip_prompt?: boolean;
28
+ skip_special_tokens?: boolean;
27
29
  callback_function?: (arg0: string) => void;
28
30
  token_callback_function?: (arg0: bigint[]) => void;
29
31
  decode_kwargs?: any;
@@ -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,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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I;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,EA4BA;IATG,wBAAgD;IAEhD,uBA3BgB,MAAM,KAAG,IAAI,CA2BO;IACpC,qBA3BgB,MAAM,KAAG,IAAI,CA2BG;IAChC,mBA3BmB,IAAI,CA2BO;IAE9B,uBAAoC;IAEpC,+BAAkC;CAiCzC"}
@@ -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;kFAuBq9yC,oBAAiB;CADr+yC;+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"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @typedef {object} GroundingDinoFeatureExtractorResultProps
3
+ * @property {import('../../utils/tensor.js').Tensor} pixel_mask
4
+ * @typedef {import('../../base/image_processors_utils.js').ImageProcessorResult & GroundingDinoFeatureExtractorResultProps} GroundingDinoFeatureExtractorResult
5
+ */
6
+ export class GroundingDinoImageProcessor extends ImageProcessor {
7
+ /**
8
+ * Calls the feature extraction process on an array of images, preprocesses
9
+ * each image, and concatenates the resulting features into a single Tensor.
10
+ * @param {import('../../utils/image.js').RawImage[]} images The image(s) to extract features from.
11
+ * @returns {Promise<GroundingDinoFeatureExtractorResult>} An object containing the concatenated pixel values of the preprocessed images.
12
+ */
13
+ _call(images: import("../../utils/image.js").RawImage[]): Promise<GroundingDinoFeatureExtractorResult>;
14
+ }
15
+ export type GroundingDinoFeatureExtractorResultProps = {
16
+ pixel_mask: import("../../utils/tensor.js").Tensor;
17
+ };
18
+ export type GroundingDinoFeatureExtractorResult = import("../../base/image_processors_utils.js").ImageProcessorResult & GroundingDinoFeatureExtractorResultProps;
19
+ import { ImageProcessor } from "../../base/image_processors_utils.js";
20
+ //# sourceMappingURL=image_processing_grounding_dino.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image_processing_grounding_dino.d.ts","sourceRoot":"","sources":["../../../src/models/grounding_dino/image_processing_grounding_dino.js"],"names":[],"mappings":"AAOA;;;;GAIG;AAEH;IACI;;;;;OAKG;IACH,cAHW,OAAO,sBAAsB,EAAE,QAAQ,EAAE,GACvC,OAAO,CAAC,mCAAmC,CAAC,CASxD;CACJ;;gBAnBa,OAAO,uBAAuB,EAAE,MAAM;;kDACvC,OAAO,sCAAsC,EAAE,oBAAoB,GAAG,wCAAwC;+BAPpH,sCAAsC"}
@@ -0,0 +1,27 @@
1
+ export class GroundingDinoProcessor extends Processor {
2
+ static tokenizer_class: typeof AutoTokenizer;
3
+ static image_processor_class: typeof AutoImageProcessor;
4
+ /**
5
+ * @typedef {import('../../utils/image.js').RawImage} RawImage
6
+ */
7
+ /**
8
+ *
9
+ * @param {RawImage|RawImage[]|RawImage[][]} images
10
+ * @param {string|string[]} text
11
+ * @returns {Promise<any>}
12
+ */
13
+ _call(images: import("../../utils/image.js").RawImage | import("../../utils/image.js").RawImage[] | import("../../utils/image.js").RawImage[][], text: string | string[], options?: {}): Promise<any>;
14
+ post_process_grounded_object_detection(outputs: any, input_ids: any, { box_threshold, text_threshold, target_sizes }?: {
15
+ box_threshold?: number;
16
+ text_threshold?: number;
17
+ target_sizes?: any;
18
+ }): {
19
+ scores: any[];
20
+ boxes: any[];
21
+ labels: string[];
22
+ }[];
23
+ }
24
+ import { Processor } from "../../base/processing_utils.js";
25
+ import { AutoTokenizer } from "../../tokenizers.js";
26
+ import { AutoImageProcessor } from "../auto/image_processing_auto.js";
27
+ //# sourceMappingURL=processing_grounding_dino.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processing_grounding_dino.d.ts","sourceRoot":"","sources":["../../../src/models/grounding_dino/processing_grounding_dino.js"],"names":[],"mappings":"AA0BA;IACI,6CAAsC;IACtC,wDAAiD;IAEjD;;OAEG;IACH;;;;;OAKG;IACH,cAJW,0CAAS,yCAAU,GAAC,yCAAU,EAAE,QAChC,MAAM,GAAC,MAAM,EAAE,iBACb,OAAO,CAAC,GAAG,CAAC,CAWxB;IACD;;;;;;;;QAkDC;CACJ;0BApGyB,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"}
@@ -9,6 +9,7 @@ export * from "./donut/image_processing_donut.js";
9
9
  export * from "./dpt/image_processing_dpt.js";
10
10
  export * from "./efficientnet/image_processing_efficientnet.js";
11
11
  export * from "./glpn/image_processing_glpn.js";
12
+ export * from "./grounding_dino/image_processing_grounding_dino.js";
12
13
  export * from "./idefics3/image_processing_idefics3.js";
13
14
  export * from "./janus/image_processing_janus.js";
14
15
  export * from "./jina_clip/image_processing_jina_clip.js";
@@ -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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,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,9 +1,10 @@
1
1
  export * from "./florence2/processing_florence2.js";
2
- export * from "./mgp_str/processing_mgp_str.js";
3
- export * from "./moonshine/processing_moonshine.js";
2
+ export * from "./grounding_dino/processing_grounding_dino.js";
4
3
  export * from "./idefics3/processing_idefics3.js";
5
4
  export * from "./janus/processing_janus.js";
6
5
  export * from "./jina_clip/processing_jina_clip.js";
6
+ export * from "./mgp_str/processing_mgp_str.js";
7
+ export * from "./moonshine/processing_moonshine.js";
7
8
  export * from "./owlvit/processing_owlvit.js";
8
9
  export * from "./phi3_v/processing_phi3_v.js";
9
10
  export * from "./paligemma/processing_paligemma.js";
@@ -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
@@ -2453,6 +2465,10 @@ export class Dinov2WithRegistersForImageClassification extends Dinov2WithRegiste
2453
2465
  */
2454
2466
  _call(model_inputs: any): Promise<SequenceClassifierOutput>;
2455
2467
  }
2468
+ export class GroundingDinoPreTrainedModel extends PreTrainedModel {
2469
+ }
2470
+ export class GroundingDinoForObjectDetection extends GroundingDinoPreTrainedModel {
2471
+ }
2456
2472
  export class YolosPreTrainedModel extends PreTrainedModel {
2457
2473
  }
2458
2474
  export class YolosModel extends YolosPreTrainedModel {
@@ -3061,6 +3077,10 @@ export class WavLMForAudioFrameClassification extends WavLMPreTrainedModel {
3061
3077
  */
3062
3078
  _call(model_inputs: any): Promise<TokenClassifierOutput>;
3063
3079
  }
3080
+ export class StyleTextToSpeech2PreTrainedModel extends PreTrainedModel {
3081
+ }
3082
+ export class StyleTextToSpeech2Model extends StyleTextToSpeech2PreTrainedModel {
3083
+ }
3064
3084
  /**
3065
3085
  * An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.
3066
3086
  */
@@ -3476,13 +3496,12 @@ export class DecisionTransformerModel extends DecisionTransformerPreTrainedModel
3476
3496
  export class MultiModalityPreTrainedModel extends PreTrainedModel {
3477
3497
  }
3478
3498
  export class MultiModalityCausalLM extends MultiModalityPreTrainedModel {
3479
- constructor(...args: any[]);
3480
3499
  _generation_mode: string;
3481
3500
  forward(model_inputs: any): Promise<any>;
3482
3501
  /**
3483
3502
  * @param {import('./generation/parameters.js').GenerationFunctionParameters} options
3484
3503
  */
3485
- generate_images(options: any): Promise<RawImage[]>;
3504
+ generate_images(options: import("./generation/parameters.js").GenerationFunctionParameters): Promise<RawImage[]>;
3486
3505
  }
3487
3506
  export class MgpstrModelOutput extends ModelOutput {
3488
3507
  constructor({ char_logits, bpe_logits, wp_logits }: {
@@ -3797,11 +3816,15 @@ export class SequenceClassifierOutput extends ModelOutput {
3797
3816
  /**
3798
3817
  * @param {Object} output The output of the model.
3799
3818
  * @param {Tensor} output.logits classification (or regression if config.num_labels==1) scores (before SoftMax).
3819
+ * @param {Record<string, Tensor>} [output.attentions] Object of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length, sequence_length)`.
3820
+ * Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
3800
3821
  */
3801
- constructor({ logits }: {
3822
+ constructor({ logits, ...attentions }: {
3802
3823
  logits: Tensor;
3824
+ attentions?: Record<string, Tensor>;
3803
3825
  });
3804
3826
  logits: Tensor;
3827
+ attentions: Record<string, Tensor>[];
3805
3828
  }
3806
3829
  /**
3807
3830
  * Base class for outputs of XVector models.