@huggingface/transformers 3.0.2 → 3.1.1

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 (258) hide show
  1. package/README.md +13 -4
  2. package/dist/ort-wasm-simd-threaded.jsep.wasm +0 -0
  3. package/dist/transformers.cjs +16655 -13040
  4. package/dist/transformers.cjs.map +1 -1
  5. package/dist/transformers.js +17095 -13468
  6. package/dist/transformers.js.map +1 -1
  7. package/dist/transformers.min.cjs +244 -52
  8. package/dist/transformers.min.cjs.map +1 -1
  9. package/dist/transformers.min.js +235 -43
  10. package/dist/transformers.min.js.map +1 -1
  11. package/dist/transformers.min.mjs +246 -54
  12. package/dist/transformers.min.mjs.map +1 -1
  13. package/dist/transformers.mjs +16818 -13202
  14. package/dist/transformers.mjs.map +1 -1
  15. package/package.json +4 -4
  16. package/src/base/feature_extraction_utils.js +54 -0
  17. package/src/base/image_processors_utils.js +1089 -0
  18. package/src/base/processing_utils.js +145 -0
  19. package/src/configs.js +15 -4
  20. package/src/env.js +6 -6
  21. package/src/generation/configuration_utils.js +7 -0
  22. package/src/generation/logits_process.js +22 -16
  23. package/src/generation/streamers.js +7 -2
  24. package/src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js +90 -0
  25. package/src/models/auto/feature_extraction_auto.js +41 -0
  26. package/src/models/auto/image_processing_auto.js +29 -0
  27. package/src/models/auto/processing_auto.js +100 -0
  28. package/src/models/beit/image_processing_beit.js +5 -0
  29. package/src/models/bit/image_processing_bit.js +5 -0
  30. package/src/models/chinese_clip/image_processing_chinese_clip.js +5 -0
  31. package/src/models/clap/feature_extraction_clap.js +159 -0
  32. package/src/models/clip/image_processing_clip.js +6 -0
  33. package/src/models/convnext/image_processing_convnext.js +45 -0
  34. package/src/models/deit/image_processing_deit.js +6 -0
  35. package/src/models/detr/image_processing_detr.js +52 -0
  36. package/src/models/donut/image_processing_donut.js +31 -0
  37. package/src/models/dpt/image_processing_dpt.js +6 -0
  38. package/src/models/efficientnet/image_processing_efficientnet.js +13 -0
  39. package/src/models/feature_extractors.js +12 -0
  40. package/src/models/florence2/processing_florence2.js +128 -0
  41. package/src/models/glpn/image_processing_glpn.js +5 -0
  42. package/src/models/idefics3/image_processing_idefics3.js +219 -0
  43. package/src/models/idefics3/processing_idefics3.js +136 -0
  44. package/src/models/image_processors.js +37 -0
  45. package/src/models/janus/image_processing_janus.js +26 -0
  46. package/src/models/janus/processing_janus.js +123 -0
  47. package/src/models/jina_clip/image_processing_jina_clip.js +26 -0
  48. package/src/models/jina_clip/processing_jina_clip.js +24 -0
  49. package/src/models/llava_onevision/image_processing_llava_onevision.js +5 -0
  50. package/src/models/mask2former/image_processing_mask2former.js +5 -0
  51. package/src/models/maskformer/image_processing_maskformer.js +18 -0
  52. package/src/models/mgp_str/processing_mgp_str.js +170 -0
  53. package/src/models/mobilenet_v1/image_processing_mobilenet_v1.js +7 -0
  54. package/src/models/mobilenet_v2/image_processing_mobilenet_v2.js +7 -0
  55. package/src/models/mobilenet_v3/image_processing_mobilenet_v3.js +7 -0
  56. package/src/models/mobilenet_v4/image_processing_mobilenet_v4.js +7 -0
  57. package/src/models/mobilevit/image_processing_mobilevit.js +6 -0
  58. package/src/models/nougat/image_processing_nougat.js +5 -0
  59. package/src/models/owlv2/image_processing_owlv2.js +5 -0
  60. package/src/models/owlvit/image_processing_owlvit.js +12 -0
  61. package/src/models/owlvit/processing_owlvit.js +7 -0
  62. package/src/models/processors.js +12 -0
  63. package/src/models/pvt/image_processing_pvt.js +5 -0
  64. package/src/models/pyannote/feature_extraction_pyannote.js +28 -0
  65. package/src/models/pyannote/processing_pyannote.js +71 -0
  66. package/src/models/qwen2_vl/image_processing_qwen2_vl.js +52 -0
  67. package/src/models/qwen2_vl/processing_qwen2_vl.js +52 -0
  68. package/src/models/rt_detr/image_processing_rt_detr.js +12 -0
  69. package/src/models/sam/image_processing_sam.js +242 -0
  70. package/src/models/sam/processing_sam.js +20 -0
  71. package/src/models/sapiens/image_processing_sapiens.js +13 -0
  72. package/src/models/seamless_m4t/feature_extraction_seamless_m4t.js +180 -0
  73. package/src/models/segformer/image_processing_segformer.js +13 -0
  74. package/src/models/siglip/image_processing_siglip.js +5 -0
  75. package/src/models/speecht5/feature_extraction_speecht5.js +4 -0
  76. package/src/models/speecht5/processing_speecht5.js +17 -0
  77. package/src/models/swin2sr/image_processing_swin2sr.js +24 -0
  78. package/src/models/vit/image_processing_vit.js +7 -0
  79. package/src/models/vitmatte/image_processing_vitmatte.js +50 -0
  80. package/src/models/vitpose/image_processing_vitpose.js +89 -0
  81. package/src/models/wav2vec2/feature_extraction_wav2vec2.js +44 -0
  82. package/src/models/wav2vec2/processing_wav2vec2.js +15 -0
  83. package/src/models/wespeaker/feature_extraction_wespeaker.js +100 -0
  84. package/src/models/whisper/feature_extraction_whisper.js +84 -0
  85. package/src/models/whisper/processing_whisper.js +21 -0
  86. package/src/models/yolos/image_processing_yolos.js +12 -0
  87. package/src/models.js +755 -34
  88. package/src/pipelines.js +8 -8
  89. package/src/tokenizers.js +5 -0
  90. package/src/transformers.js +15 -2
  91. package/src/utils/constants.js +8 -1
  92. package/src/utils/core.js +51 -9
  93. package/src/utils/dtypes.js +2 -1
  94. package/src/utils/hub.js +2 -1
  95. package/src/utils/image.js +87 -33
  96. package/src/utils/tensor.js +39 -2
  97. package/types/base/feature_extraction_utils.d.ts +41 -0
  98. package/types/base/feature_extraction_utils.d.ts.map +1 -0
  99. package/types/base/image_processors_utils.d.ts +323 -0
  100. package/types/base/image_processors_utils.d.ts.map +1 -0
  101. package/types/base/processing_utils.d.ts +80 -0
  102. package/types/base/processing_utils.d.ts.map +1 -0
  103. package/types/configs.d.ts +5 -2
  104. package/types/configs.d.ts.map +1 -1
  105. package/types/env.d.ts +1 -1
  106. package/types/env.d.ts.map +1 -1
  107. package/types/generation/configuration_utils.d.ts +6 -0
  108. package/types/generation/configuration_utils.d.ts.map +1 -1
  109. package/types/generation/logits_process.d.ts +30 -20
  110. package/types/generation/logits_process.d.ts.map +1 -1
  111. package/types/generation/streamers.d.ts +13 -8
  112. package/types/generation/streamers.d.ts.map +1 -1
  113. package/types/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.d.ts +25 -0
  114. package/types/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.d.ts.map +1 -0
  115. package/types/models/auto/feature_extraction_auto.d.ts +5 -0
  116. package/types/models/auto/feature_extraction_auto.d.ts.map +1 -0
  117. package/types/models/auto/image_processing_auto.d.ts +5 -0
  118. package/types/models/auto/image_processing_auto.d.ts.map +1 -0
  119. package/types/models/auto/processing_auto.d.ts +35 -0
  120. package/types/models/auto/processing_auto.d.ts.map +1 -0
  121. package/types/models/beit/image_processing_beit.d.ts +4 -0
  122. package/types/models/beit/image_processing_beit.d.ts.map +1 -0
  123. package/types/models/bit/image_processing_bit.d.ts +4 -0
  124. package/types/models/bit/image_processing_bit.d.ts.map +1 -0
  125. package/types/models/chinese_clip/image_processing_chinese_clip.d.ts +4 -0
  126. package/types/models/chinese_clip/image_processing_chinese_clip.d.ts.map +1 -0
  127. package/types/models/clap/feature_extraction_clap.d.ts +57 -0
  128. package/types/models/clap/feature_extraction_clap.d.ts.map +1 -0
  129. package/types/models/clip/image_processing_clip.d.ts +6 -0
  130. package/types/models/clip/image_processing_clip.d.ts.map +1 -0
  131. package/types/models/convnext/image_processing_convnext.d.ts +12 -0
  132. package/types/models/convnext/image_processing_convnext.d.ts.map +1 -0
  133. package/types/models/deit/image_processing_deit.d.ts +6 -0
  134. package/types/models/deit/image_processing_deit.d.ts.map +1 -0
  135. package/types/models/detr/image_processing_detr.d.ts +42 -0
  136. package/types/models/detr/image_processing_detr.d.ts.map +1 -0
  137. package/types/models/donut/image_processing_donut.d.ts +7 -0
  138. package/types/models/donut/image_processing_donut.d.ts.map +1 -0
  139. package/types/models/dpt/image_processing_dpt.d.ts +6 -0
  140. package/types/models/dpt/image_processing_dpt.d.ts.map +1 -0
  141. package/types/models/efficientnet/image_processing_efficientnet.d.ts +6 -0
  142. package/types/models/efficientnet/image_processing_efficientnet.d.ts.map +1 -0
  143. package/types/models/feature_extractors.d.ts +10 -0
  144. package/types/models/feature_extractors.d.ts.map +1 -0
  145. package/types/models/florence2/processing_florence2.d.ts +39 -0
  146. package/types/models/florence2/processing_florence2.d.ts.map +1 -0
  147. package/types/models/glpn/image_processing_glpn.d.ts +4 -0
  148. package/types/models/glpn/image_processing_glpn.d.ts.map +1 -0
  149. package/types/models/idefics3/image_processing_idefics3.d.ts +40 -0
  150. package/types/models/idefics3/image_processing_idefics3.d.ts.map +1 -0
  151. package/types/models/idefics3/processing_idefics3.d.ts +19 -0
  152. package/types/models/idefics3/processing_idefics3.d.ts.map +1 -0
  153. package/types/models/image_processors.d.ts +37 -0
  154. package/types/models/image_processors.d.ts.map +1 -0
  155. package/types/models/janus/image_processing_janus.d.ts +7 -0
  156. package/types/models/janus/image_processing_janus.d.ts.map +1 -0
  157. package/types/models/janus/processing_janus.d.ts +77 -0
  158. package/types/models/janus/processing_janus.d.ts.map +1 -0
  159. package/types/models/jina_clip/image_processing_jina_clip.d.ts +5 -0
  160. package/types/models/jina_clip/image_processing_jina_clip.d.ts.map +1 -0
  161. package/types/models/jina_clip/processing_jina_clip.d.ts +9 -0
  162. package/types/models/jina_clip/processing_jina_clip.d.ts.map +1 -0
  163. package/types/models/llava_onevision/image_processing_llava_onevision.d.ts +4 -0
  164. package/types/models/llava_onevision/image_processing_llava_onevision.d.ts.map +1 -0
  165. package/types/models/mask2former/image_processing_mask2former.d.ts +4 -0
  166. package/types/models/mask2former/image_processing_mask2former.d.ts.map +1 -0
  167. package/types/models/maskformer/image_processing_maskformer.d.ts +22 -0
  168. package/types/models/maskformer/image_processing_maskformer.d.ts.map +1 -0
  169. package/types/models/mgp_str/processing_mgp_str.d.ts +64 -0
  170. package/types/models/mgp_str/processing_mgp_str.d.ts.map +1 -0
  171. package/types/models/mobilenet_v1/image_processing_mobilenet_v1.d.ts +6 -0
  172. package/types/models/mobilenet_v1/image_processing_mobilenet_v1.d.ts.map +1 -0
  173. package/types/models/mobilenet_v2/image_processing_mobilenet_v2.d.ts +6 -0
  174. package/types/models/mobilenet_v2/image_processing_mobilenet_v2.d.ts.map +1 -0
  175. package/types/models/mobilenet_v3/image_processing_mobilenet_v3.d.ts +6 -0
  176. package/types/models/mobilenet_v3/image_processing_mobilenet_v3.d.ts.map +1 -0
  177. package/types/models/mobilenet_v4/image_processing_mobilenet_v4.d.ts +6 -0
  178. package/types/models/mobilenet_v4/image_processing_mobilenet_v4.d.ts.map +1 -0
  179. package/types/models/mobilevit/image_processing_mobilevit.d.ts +6 -0
  180. package/types/models/mobilevit/image_processing_mobilevit.d.ts.map +1 -0
  181. package/types/models/nougat/image_processing_nougat.d.ts +4 -0
  182. package/types/models/nougat/image_processing_nougat.d.ts.map +1 -0
  183. package/types/models/owlv2/image_processing_owlv2.d.ts +4 -0
  184. package/types/models/owlv2/image_processing_owlv2.d.ts.map +1 -0
  185. package/types/models/owlvit/image_processing_owlvit.d.ts +10 -0
  186. package/types/models/owlvit/image_processing_owlvit.d.ts.map +1 -0
  187. package/types/models/owlvit/processing_owlvit.d.ts +8 -0
  188. package/types/models/owlvit/processing_owlvit.d.ts.map +1 -0
  189. package/types/models/processors.d.ts +13 -0
  190. package/types/models/processors.d.ts.map +1 -0
  191. package/types/models/pvt/image_processing_pvt.d.ts +4 -0
  192. package/types/models/pvt/image_processing_pvt.d.ts.map +1 -0
  193. package/types/models/pyannote/feature_extraction_pyannote.d.ts +13 -0
  194. package/types/models/pyannote/feature_extraction_pyannote.d.ts.map +1 -0
  195. package/types/models/pyannote/processing_pyannote.d.ts +30 -0
  196. package/types/models/pyannote/processing_pyannote.d.ts.map +1 -0
  197. package/types/models/qwen2_vl/image_processing_qwen2_vl.d.ts +11 -0
  198. package/types/models/qwen2_vl/image_processing_qwen2_vl.d.ts.map +1 -0
  199. package/types/models/qwen2_vl/processing_qwen2_vl.d.ts +17 -0
  200. package/types/models/qwen2_vl/processing_qwen2_vl.d.ts.map +1 -0
  201. package/types/models/rt_detr/image_processing_rt_detr.d.ts +8 -0
  202. package/types/models/rt_detr/image_processing_rt_detr.d.ts.map +1 -0
  203. package/types/models/sam/image_processing_sam.d.ts +103 -0
  204. package/types/models/sam/image_processing_sam.d.ts.map +1 -0
  205. package/types/models/sam/processing_sam.d.ts +9 -0
  206. package/types/models/sam/processing_sam.d.ts.map +1 -0
  207. package/types/models/seamless_m4t/feature_extraction_seamless_m4t.d.ts +34 -0
  208. package/types/models/seamless_m4t/feature_extraction_seamless_m4t.d.ts.map +1 -0
  209. package/types/models/segformer/image_processing_segformer.d.ts +10 -0
  210. package/types/models/segformer/image_processing_segformer.d.ts.map +1 -0
  211. package/types/models/siglip/image_processing_siglip.d.ts +4 -0
  212. package/types/models/siglip/image_processing_siglip.d.ts.map +1 -0
  213. package/types/models/speecht5/feature_extraction_speecht5.d.ts +4 -0
  214. package/types/models/speecht5/feature_extraction_speecht5.d.ts.map +1 -0
  215. package/types/models/speecht5/processing_speecht5.d.ts +14 -0
  216. package/types/models/speecht5/processing_speecht5.d.ts.map +1 -0
  217. package/types/models/swin2sr/image_processing_swin2sr.d.ts +5 -0
  218. package/types/models/swin2sr/image_processing_swin2sr.d.ts.map +1 -0
  219. package/types/models/vit/image_processing_vit.d.ts +6 -0
  220. package/types/models/vit/image_processing_vit.d.ts.map +1 -0
  221. package/types/models/vitmatte/image_processing_vitmatte.d.ts +12 -0
  222. package/types/models/vitmatte/image_processing_vitmatte.d.ts.map +1 -0
  223. package/types/models/vitpose/image_processing_vitpose.d.ts +26 -0
  224. package/types/models/vitpose/image_processing_vitpose.d.ts.map +1 -0
  225. package/types/models/wav2vec2/feature_extraction_wav2vec2.d.ts +19 -0
  226. package/types/models/wav2vec2/feature_extraction_wav2vec2.d.ts.map +1 -0
  227. package/types/models/wav2vec2/processing_wav2vec2.d.ts +12 -0
  228. package/types/models/wav2vec2/processing_wav2vec2.d.ts.map +1 -0
  229. package/types/models/wespeaker/feature_extraction_wespeaker.d.ts +23 -0
  230. package/types/models/wespeaker/feature_extraction_wespeaker.d.ts.map +1 -0
  231. package/types/models/whisper/feature_extraction_whisper.d.ts +21 -0
  232. package/types/models/whisper/feature_extraction_whisper.d.ts.map +1 -0
  233. package/types/models/whisper/processing_whisper.d.ts +17 -0
  234. package/types/models/whisper/processing_whisper.d.ts.map +1 -0
  235. package/types/models/yolos/image_processing_yolos.d.ts +10 -0
  236. package/types/models/yolos/image_processing_yolos.d.ts.map +1 -0
  237. package/types/models.d.ts +150 -0
  238. package/types/models.d.ts.map +1 -1
  239. package/types/pipelines.d.ts +2 -3
  240. package/types/pipelines.d.ts.map +1 -1
  241. package/types/tokenizers.d.ts +3 -0
  242. package/types/tokenizers.d.ts.map +1 -1
  243. package/types/transformers.d.ts +10 -1
  244. package/types/utils/constants.d.ts +6 -0
  245. package/types/utils/constants.d.ts.map +1 -1
  246. package/types/utils/core.d.ts +65 -3
  247. package/types/utils/core.d.ts.map +1 -1
  248. package/types/utils/dtypes.d.ts +3 -2
  249. package/types/utils/dtypes.d.ts.map +1 -1
  250. package/types/utils/hub.d.ts +1 -1
  251. package/types/utils/hub.d.ts.map +1 -1
  252. package/types/utils/image.d.ts +14 -2
  253. package/types/utils/image.d.ts.map +1 -1
  254. package/types/utils/tensor.d.ts +39 -4
  255. package/types/utils/tensor.d.ts.map +1 -1
  256. package/src/processors.js +0 -2655
  257. package/types/processors.d.ts +0 -924
  258. package/types/processors.d.ts.map +0 -1
@@ -0,0 +1,323 @@
1
+ /**
2
+ * Post-processes the outputs of the model (for object detection).
3
+ * @param {Object} outputs The outputs of the model that must be post-processed
4
+ * @param {Tensor} outputs.logits The logits
5
+ * @param {Tensor} outputs.pred_boxes The predicted boxes.
6
+ * @param {number} [threshold=0.5] The threshold to use for the scores.
7
+ * @param {[number, number][]} [target_sizes=null] The sizes of the original images.
8
+ * @param {boolean} [is_zero_shot=false] Whether zero-shot object detection was performed.
9
+ * @return {Object[]} An array of objects containing the post-processed outputs.
10
+ */
11
+ export function post_process_object_detection(outputs: {
12
+ logits: Tensor;
13
+ pred_boxes: Tensor;
14
+ }, threshold?: number, target_sizes?: [number, number][], is_zero_shot?: boolean): any[];
15
+ /**
16
+ * Post-processes the outputs of the model (for semantic segmentation).
17
+ * @param {*} outputs Raw outputs of the model.
18
+ * @param {[number, number][]} [target_sizes=null] List of tuples corresponding to the requested final size
19
+ * (height, width) of each prediction. If unset, predictions will not be resized.
20
+ * @returns {{segmentation: Tensor; labels: number[]}[]} The semantic segmentation maps.
21
+ */
22
+ export function post_process_semantic_segmentation(outputs: any, target_sizes?: [number, number][]): {
23
+ segmentation: Tensor;
24
+ labels: number[];
25
+ }[];
26
+ /**
27
+ * Post-process the model output to generate the final panoptic segmentation.
28
+ * @param {*} outputs The model output to post process
29
+ * @param {number} [threshold=0.5] The probability score threshold to keep predicted instance masks.
30
+ * @param {number} [mask_threshold=0.5] Threshold to use when turning the predicted masks into binary values.
31
+ * @param {number} [overlap_mask_area_threshold=0.8] The overlap mask area threshold to merge or discard small disconnected parts within each binary instance mask.
32
+ * @param {Set<number>} [label_ids_to_fuse=null] The labels in this state will have all their instances be fused together.
33
+ * @param {[number, number][]} [target_sizes=null] The target sizes to resize the masks to.
34
+ * @returns {Array<{ segmentation: Tensor, segments_info: Array<{id: number, label_id: number, score: number}>}>}
35
+ */
36
+ export function post_process_panoptic_segmentation(outputs: any, threshold?: number, mask_threshold?: number, overlap_mask_area_threshold?: number, label_ids_to_fuse?: Set<number>, target_sizes?: [number, number][]): Array<{
37
+ segmentation: Tensor;
38
+ segments_info: Array<{
39
+ id: number;
40
+ label_id: number;
41
+ score: number;
42
+ }>;
43
+ }>;
44
+ /**
45
+ * Post-processes the outputs of the model (for instance segmentation).
46
+ * @param {*} outputs Raw outputs of the model.
47
+ * @param {number} [threshold=0.5] The probability score threshold to keep predicted instance masks.
48
+ * @param {[number, number][]} [target_sizes=null] List of tuples corresponding to the requested final size
49
+ * (height, width) of each prediction. If unset, predictions will not be resized.
50
+ * @returns {Array<{ segmentation: Tensor, segments_info: Array<{id: number, label_id: number, score: number}>}>}
51
+ */
52
+ export function post_process_instance_segmentation(outputs: any, threshold?: number, target_sizes?: [number, number][]): Array<{
53
+ segmentation: Tensor;
54
+ segments_info: Array<{
55
+ id: number;
56
+ label_id: number;
57
+ score: number;
58
+ }>;
59
+ }>;
60
+ declare const ImageProcessor_base: new () => {
61
+ (...args: any[]): any;
62
+ _call(...args: any[]): any;
63
+ };
64
+ /**
65
+ * @typedef {Object} ImageProcessorConfig A configuration object used to create an image processor.
66
+ * @property {function} [progress_callback=null] If specified, this function will be called during model construction, to provide the user with progress updates.
67
+ * @property {number[]} [image_mean] The mean values for image normalization.
68
+ * @property {number[]} [image_std] The standard deviation values for image normalization.
69
+ * @property {boolean} [do_rescale] Whether to rescale the image pixel values to the [0,1] range.
70
+ * @property {number} [rescale_factor] The factor to use for rescaling the image pixel values.
71
+ * @property {boolean} [do_normalize] Whether to normalize the image pixel values.
72
+ * @property {boolean} [do_resize] Whether to resize the image.
73
+ * @property {number} [resample] What method to use for resampling.
74
+ * @property {number|Object} [size] The size to resize the image to.
75
+ * @property {number|Object} [image_size] The size to resize the image to (same as `size`).
76
+ * @property {boolean} [do_flip_channel_order=false] Whether to flip the color channels from RGB to BGR.
77
+ * Can be overridden by the `do_flip_channel_order` parameter in the `preprocess` method.
78
+ * @property {boolean} [do_center_crop] Whether to center crop the image to the specified `crop_size`.
79
+ * Can be overridden by `do_center_crop` in the `preprocess` method.
80
+ * @property {boolean} [do_thumbnail] Whether to resize the image using thumbnail method.
81
+ * @property {boolean} [keep_aspect_ratio] If `true`, the image is resized to the largest possible size such that the aspect ratio is preserved.
82
+ * Can be overidden by `keep_aspect_ratio` in `preprocess`.
83
+ * @property {number} [ensure_multiple_of] If `do_resize` is `true`, the image is resized to a size that is a multiple of this value.
84
+ * Can be overidden by `ensure_multiple_of` in `preprocess`.
85
+ *
86
+ * @property {number[]} [mean] The mean values for image normalization (same as `image_mean`).
87
+ * @property {number[]} [std] The standard deviation values for image normalization (same as `image_std`).
88
+ */
89
+ export class ImageProcessor extends ImageProcessor_base {
90
+ /**
91
+ * Instantiate one of the processor classes of the library from a pretrained model.
92
+ *
93
+ * The processor class to instantiate is selected based on the `image_processor_type` (or `feature_extractor_type`; legacy)
94
+ * property of the config object (either passed as an argument or loaded from `pretrained_model_name_or_path` if possible)
95
+ *
96
+ * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
97
+ * - A string, the *model id* of a pretrained processor hosted inside a model repo on huggingface.co.
98
+ * Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
99
+ * user or organization name, like `dbmdz/bert-base-german-cased`.
100
+ * - A path to a *directory* containing processor files, e.g., `./my_model_directory/`.
101
+ * @param {import('../utils/hub.js').PretrainedOptions} options Additional options for loading the processor.
102
+ *
103
+ * @returns {Promise<ImageProcessor>} A new instance of the Processor class.
104
+ */
105
+ static from_pretrained(pretrained_model_name_or_path: string, options: import('../utils/hub.js').PretrainedOptions): Promise<ImageProcessor>;
106
+ /**
107
+ * Constructs a new `ImageProcessor`.
108
+ * @param {ImageProcessorConfig} config The configuration object.
109
+ */
110
+ constructor(config: ImageProcessorConfig);
111
+ image_mean: number[];
112
+ image_std: number[];
113
+ resample: number;
114
+ do_rescale: boolean;
115
+ rescale_factor: number;
116
+ do_normalize: boolean;
117
+ do_thumbnail: boolean;
118
+ size: any;
119
+ do_resize: boolean;
120
+ size_divisibility: any;
121
+ do_center_crop: boolean;
122
+ crop_size: any;
123
+ do_convert_rgb: any;
124
+ do_crop_margin: any;
125
+ pad_size: any;
126
+ do_pad: any;
127
+ do_flip_channel_order: boolean;
128
+ config: ImageProcessorConfig;
129
+ /**
130
+ * Resize the image to make a thumbnail. The image is resized so that no dimension is larger than any
131
+ * corresponding dimension of the specified size.
132
+ * @param {RawImage} image The image to be resized.
133
+ * @param {{height:number, width:number}} size The size `{"height": h, "width": w}` to resize the image to.
134
+ * @param {string | 0 | 1 | 2 | 3 | 4 | 5} [resample=2] The resampling filter to use.
135
+ * @returns {Promise<RawImage>} The resized image.
136
+ */
137
+ thumbnail(image: RawImage, size: {
138
+ height: number;
139
+ width: number;
140
+ }, resample?: string | 0 | 1 | 2 | 3 | 4 | 5): Promise<RawImage>;
141
+ /**
142
+ * Crops the margin of the image. Gray pixels are considered margin (i.e., pixels with a value below the threshold).
143
+ * @param {RawImage} image The image to be cropped.
144
+ * @param {number} gray_threshold Value below which pixels are considered to be gray.
145
+ * @returns {Promise<RawImage>} The cropped image.
146
+ */
147
+ crop_margin(image: RawImage, gray_threshold?: number): Promise<RawImage>;
148
+ /**
149
+ * Pad the image by a certain amount.
150
+ * @param {Float32Array} pixelData The pixel data to pad.
151
+ * @param {number[]} imgDims The dimensions of the image (height, width, channels).
152
+ * @param {{width:number; height:number}|number} padSize The dimensions of the padded image.
153
+ * @param {Object} options The options for padding.
154
+ * @param {'constant'|'symmetric'} [options.mode='constant'] The type of padding to add.
155
+ * @param {boolean} [options.center=false] Whether to center the image.
156
+ * @param {number|number[]} [options.constant_values=0] The constant value to use for padding.
157
+ * @returns {[Float32Array, number[]]} The padded pixel data and image dimensions.
158
+ */
159
+ pad_image(pixelData: Float32Array, imgDims: number[], padSize: {
160
+ width: number;
161
+ height: number;
162
+ } | number, { mode, center, constant_values, }?: {
163
+ mode?: 'constant' | 'symmetric';
164
+ center?: boolean;
165
+ constant_values?: number | number[];
166
+ }): [Float32Array, number[]];
167
+ /**
168
+ * Rescale the image' pixel values by `this.rescale_factor`.
169
+ * @param {Float32Array} pixelData The pixel data to rescale.
170
+ * @returns {void}
171
+ */
172
+ rescale(pixelData: Float32Array): void;
173
+ /**
174
+ * Find the target (width, height) dimension of the output image after
175
+ * resizing given the input image and the desired size.
176
+ * @param {RawImage} image The image to resize.
177
+ * @param {any} size The size to use for resizing the image.
178
+ * @returns {[number, number]} The target (width, height) dimension of the output image after resizing.
179
+ */
180
+ get_resize_output_image_size(image: RawImage, size: any): [number, number];
181
+ /**
182
+ * Resizes the image.
183
+ * @param {RawImage} image The image to resize.
184
+ * @returns {Promise<RawImage>} The resized image.
185
+ */
186
+ resize(image: RawImage): Promise<RawImage>;
187
+ /**
188
+ * @typedef {object} PreprocessedImage
189
+ * @property {HeightWidth} original_size The original size of the image.
190
+ * @property {HeightWidth} reshaped_input_size The reshaped input size of the image.
191
+ * @property {Tensor} pixel_values The pixel values of the preprocessed image.
192
+ */
193
+ /**
194
+ * Preprocesses the given image.
195
+ *
196
+ * @param {RawImage} image The image to preprocess.
197
+ * @param {Object} overrides The overrides for the preprocessing options.
198
+ * @returns {Promise<PreprocessedImage>} The preprocessed image.
199
+ */
200
+ preprocess(image: RawImage, { do_normalize, do_pad, do_convert_rgb, do_convert_grayscale, do_flip_channel_order, }?: any): Promise<{
201
+ /**
202
+ * The original size of the image.
203
+ */
204
+ original_size: HeightWidth;
205
+ /**
206
+ * The reshaped input size of the image.
207
+ */
208
+ reshaped_input_size: HeightWidth;
209
+ /**
210
+ * The pixel values of the preprocessed image.
211
+ */
212
+ pixel_values: Tensor;
213
+ }>;
214
+ /**
215
+ * Calls the feature extraction process on an array of images,
216
+ * preprocesses each image, and concatenates the resulting
217
+ * features into a single Tensor.
218
+ * @param {RawImage[]} images The image(s) to extract features from.
219
+ * @param {...any} args Additional arguments.
220
+ * @returns {Promise<ImageProcessorResult>} An object containing the concatenated pixel values (and other metadata) of the preprocessed images.
221
+ */
222
+ _call(images: RawImage[], ...args: any[]): Promise<ImageProcessorResult>;
223
+ }
224
+ /**
225
+ * Named tuple to indicate the order we are using is (height x width),
226
+ * even though the Graphics' industry standard is (width x height).
227
+ */
228
+ export type HeightWidth = [height: number, width: number];
229
+ export type ImageProcessorResult = {
230
+ /**
231
+ * The pixel values of the batched preprocessed images.
232
+ */
233
+ pixel_values: Tensor;
234
+ /**
235
+ * Array of two-dimensional tuples like [[480, 640]].
236
+ */
237
+ original_sizes: HeightWidth[];
238
+ /**
239
+ * Array of two-dimensional tuples like [[1000, 1330]].
240
+ */
241
+ reshaped_input_sizes: HeightWidth[];
242
+ };
243
+ /**
244
+ * A configuration object used to create an image processor.
245
+ */
246
+ export type ImageProcessorConfig = {
247
+ /**
248
+ * If specified, this function will be called during model construction, to provide the user with progress updates.
249
+ */
250
+ progress_callback?: Function;
251
+ /**
252
+ * The mean values for image normalization.
253
+ */
254
+ image_mean?: number[];
255
+ /**
256
+ * The standard deviation values for image normalization.
257
+ */
258
+ image_std?: number[];
259
+ /**
260
+ * Whether to rescale the image pixel values to the [0,1] range.
261
+ */
262
+ do_rescale?: boolean;
263
+ /**
264
+ * The factor to use for rescaling the image pixel values.
265
+ */
266
+ rescale_factor?: number;
267
+ /**
268
+ * Whether to normalize the image pixel values.
269
+ */
270
+ do_normalize?: boolean;
271
+ /**
272
+ * Whether to resize the image.
273
+ */
274
+ do_resize?: boolean;
275
+ /**
276
+ * What method to use for resampling.
277
+ */
278
+ resample?: number;
279
+ /**
280
+ * The size to resize the image to.
281
+ */
282
+ size?: number | any;
283
+ /**
284
+ * The size to resize the image to (same as `size`).
285
+ */
286
+ image_size?: number | any;
287
+ /**
288
+ * Whether to flip the color channels from RGB to BGR.
289
+ * Can be overridden by the `do_flip_channel_order` parameter in the `preprocess` method.
290
+ */
291
+ do_flip_channel_order?: boolean;
292
+ /**
293
+ * Whether to center crop the image to the specified `crop_size`.
294
+ * Can be overridden by `do_center_crop` in the `preprocess` method.
295
+ */
296
+ do_center_crop?: boolean;
297
+ /**
298
+ * Whether to resize the image using thumbnail method.
299
+ */
300
+ do_thumbnail?: boolean;
301
+ /**
302
+ * If `true`, the image is resized to the largest possible size such that the aspect ratio is preserved.
303
+ * Can be overidden by `keep_aspect_ratio` in `preprocess`.
304
+ */
305
+ keep_aspect_ratio?: boolean;
306
+ /**
307
+ * If `do_resize` is `true`, the image is resized to a size that is a multiple of this value.
308
+ * Can be overidden by `ensure_multiple_of` in `preprocess`.
309
+ */
310
+ ensure_multiple_of?: number;
311
+ /**
312
+ * The mean values for image normalization (same as `image_mean`).
313
+ */
314
+ mean?: number[];
315
+ /**
316
+ * The standard deviation values for image normalization (same as `image_std`).
317
+ */
318
+ std?: number[];
319
+ };
320
+ import { Tensor } from "../utils/tensor.js";
321
+ import { RawImage } from "../utils/image.js";
322
+ export {};
323
+ //# sourceMappingURL=image_processors_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image_processors_utils.d.ts","sourceRoot":"","sources":["../../src/base/image_processors_utils.js"],"names":[],"mappings":"AA+EA;;;;;;;;;GASG;AACH;IAP2B,MAAM,EAAtB,MAAM;IACU,UAAU,EAA1B,MAAM;eACN,MAAM,iBACN,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,iBAClB,OAAO,GACN,KAAQ,CAwEnB;AAGD;;;;;;GAMG;AACH,gFAJW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,CAwDtD;AAkPD;;;;;;;;;GASG;AACH,6EAPW,MAAM,mBACN,MAAM,gCACN,MAAM,sBACN,IAAI,MAAM,CAAC,iBACX,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAChB,MAAM;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM;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,6EALW,MAAM,iBACN,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB,MAAM;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,C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cAHW,QAAQ,GACN,QAAQ,QAAQ,CAAC,CAO7B;IAED;;;;;OAKG;IAEH;;;;;;OAMG;IACH,kBAJW,QAAQ;;;;;;;;;;;;sBANL,MAAM;OA8HnB;IAED;;;;;;;OAOG;IACH,cAJW,QAAQ,EAAE,WACP,GAAG,KACJ,QAAQ,oBAAoB,CAAC,CAqBzC;CAsBJ;;;;;0BArjCY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;;;;;kBAM9B,MAAM;;;;oBACN,aAAa;;;;0BACb,aAAa;;;;;;;;;;;;;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"}
@@ -0,0 +1,80 @@
1
+ declare const Processor_base: new () => {
2
+ (...args: any[]): any;
3
+ _call(...args: any[]): any;
4
+ };
5
+ /**
6
+ * @typedef {Object} ProcessorProperties Additional processor-specific properties.
7
+ * @typedef {import('../utils/hub.js').PretrainedOptions & ProcessorProperties} PretrainedProcessorOptions
8
+ */
9
+ /**
10
+ * Represents a Processor that extracts features from an input.
11
+ */
12
+ export class Processor extends Processor_base {
13
+ static classes: string[];
14
+ static uses_processor_config: boolean;
15
+ /**
16
+ * Instantiate one of the processor classes of the library from a pretrained model.
17
+ *
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)
20
+ *
21
+ * @param {string} pretrained_model_name_or_path The name or path of the pretrained model. Can be either:
22
+ * - A string, the *model id* of a pretrained processor hosted inside a model repo on huggingface.co.
23
+ * Valid model ids can be located at the root-level, like `bert-base-uncased`, or namespaced under a
24
+ * user or organization name, like `dbmdz/bert-base-german-cased`.
25
+ * - A path to a *directory* containing processor files, e.g., `./my_model_directory/`.
26
+ * @param {PretrainedProcessorOptions} options Additional options for loading the processor.
27
+ *
28
+ * @returns {Promise<Processor>} A new instance of the Processor class.
29
+ */
30
+ static from_pretrained(pretrained_model_name_or_path: string, options: PretrainedProcessorOptions): Promise<Processor>;
31
+ /**
32
+ * Creates a new Processor with the given components
33
+ * @param {Object} config
34
+ * @param {Record<string, Object>} components
35
+ */
36
+ constructor(config: any, components: Record<string, any>);
37
+ config: any;
38
+ components: Record<string, any>;
39
+ /**
40
+ * @returns {import('./image_processors_utils.js').ImageProcessor|undefined} The image processor of the processor, if it exists.
41
+ */
42
+ get image_processor(): import("./image_processors_utils.js").ImageProcessor;
43
+ /**
44
+ * @returns {import('../tokenizers.js').PreTrainedTokenizer|undefined} The tokenizer of the processor, if it exists.
45
+ */
46
+ get tokenizer(): import("../tokenizers.js").PreTrainedTokenizer;
47
+ /**
48
+ * @returns {import('./feature_extraction_utils.js').FeatureExtractor|undefined} The feature extractor of the processor, if it exists.
49
+ */
50
+ get feature_extractor(): import("./feature_extraction_utils.js").FeatureExtractor;
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[];
66
+ /**
67
+ * Calls the feature_extractor function with the given input.
68
+ * @param {any} input The input to extract features from.
69
+ * @param {...any} args Additional arguments.
70
+ * @returns {Promise<any>} A Promise that resolves with the extracted features.
71
+ */
72
+ _call(input: any, ...args: any[]): Promise<any>;
73
+ }
74
+ /**
75
+ * Additional processor-specific properties.
76
+ */
77
+ export type ProcessorProperties = any;
78
+ export type PretrainedProcessorOptions = import('../utils/hub.js').PretrainedOptions & ProcessorProperties;
79
+ export {};
80
+ //# sourceMappingURL=processing_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processing_utils.d.ts","sourceRoot":"","sources":["../../src/base/processing_utils.js"],"names":[],"mappings":";;;;AA2BA;;;GAGG;AAGH;;GAEG;AACH;IACI,yBAIC;IACD,sCAAqC;IAoErC;;;;;;;;;;;;;;OAcG;IACH,sDATW,MAAM,WAKN,0BAA0B,GAExB,QAAQ,SAAS,CAAC,CAoB9B;IAnGD;;;;OAIG;IACH,qCAFW,OAAO,MAAM,MAAS,EAMhC;IAFG,YAAoB;IACpB,gCAA4B;IAGhC;;OAEG;IACH,4EAEC;IAED;;OAEG;IACH,gEAEC;IAED;;OAEG;IACH,kFAEC;IAED;;;;;;;;;;;;;MAQC;IAED,uCAKC;IAGD;;;;;OAKG;IACH,aAJW,GAAG,WACA,GAAG,KACJ,QAAQ,GAAG,CAAC,CASxB;CAqCJ;;;;;yCAnHY,OAAO,iBAAiB,EAAE,iBAAiB,GAAG,mBAAmB"}
@@ -3,8 +3,9 @@
3
3
  * @param {PretrainedConfig} config
4
4
  * @returns {Record<string, number[]>}
5
5
  */
6
- export function getKeyValueShapes(config: PretrainedConfig, { prefix, }?: {
6
+ export function getKeyValueShapes(config: PretrainedConfig, { prefix, batch_size, }?: {
7
7
  prefix?: string;
8
+ batch_size?: number;
8
9
  }): Record<string, number[]>;
9
10
  /**
10
11
  * Base class for all configuration classes. For more information, see the corresponding
@@ -55,6 +56,8 @@ export class AutoConfig {
55
56
  static from_pretrained(pretrained_model_name_or_path: string, { progress_callback, config, cache_dir, local_files_only, revision, }?: import("./utils/hub.js").PretrainedOptions): Promise<PretrainedConfig>;
56
57
  }
57
58
  export type PretrainedOptions = import('./utils/hub.js').PretrainedOptions;
59
+ export type ProgressCallback = import('./utils/core.js').ProgressCallback;
60
+ export type ProgressInfo = import('./utils/core.js').ProgressInfo;
58
61
  /**
59
62
  * Transformers.js-specific configuration, possibly present in config.json under the key `transformers.js_config`.
60
63
  */
@@ -76,7 +79,7 @@ export type TransformersJSConfig = {
76
79
  /**
77
80
  * The default data type to use for the model.
78
81
  */
79
- dtype?: import('./utils/dtypes.js').DataType;
82
+ dtype?: import('./utils/dtypes.js').DataType | Record<string, import('./utils/dtypes.js').DataType>;
80
83
  /**
81
84
  * Whether to load the model using the external data format (used for models >= 2GB in size).
82
85
  */
@@ -1 +1 @@
1
- {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.js"],"names":[],"mappings":"AAqNA;;;;GAIG;AACH,0CAHW,gBAAgB;;IACd,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,CA6EpC;AACD;;;GAGG;AACH;IAwBI;;;;;;;;OAQG;IACH,sDANW,MAAM,0EACN,iBAAiB,GAGf,QAAQ,gBAAgB,CAAC,CAqBrC;IArCD;;;OAGG;IACH,6BAGC;IAnBD,0BAA0B;IAC1B,YADW,MAAM,GAAC,IAAI,CACJ;IAElB,sBAAsB;IACtB,oBADW,OAAO,CACS;IAE3B,qBAAqB;IACrB,yBADW,MAAM,CACO;IAExB,mCAAmC;IACnC,0BADW,oBAAoB,CACN;IAQrB,uBAAkD;CAgCzD;AAED;;;;;GAKG;AACH;IArCI;;;;;;;;OAQG;IACH,6MAmBC;CAcJ;gCAzUY,OAAO,gBAAgB,EAAE,iBAAiB;;;;;;;;qBA8UzC,OAAO,mBAAmB,EAAE,QAAQ,GAAC,OAAO,OAAO,mBAAmB,EAAE,QAAQ,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC;;;;;;+BACvH,OAAO,MAAM,EAAE,MAAM,CAAC;;;;aAGtB,OAAO,oBAAoB,EAAE,UAAU;;;;YACvC,OAAO,mBAAmB,EAAE,QAAQ;;;;+BACpC,OAAO,GAAC,OAAO,MAAM,EAAE,OAAO,CAAC"}
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.js"],"names":[],"mappings":"AAkOA;;;;GAIG;AACH,0CAHW,gBAAgB;;;IACd,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,CA2EpC;AACD;;;GAGG;AACH;IAwBI;;;;;;;;OAQG;IACH,sDANW,MAAM,0EACN,iBAAiB,GAGf,QAAQ,gBAAgB,CAAC,CAqBrC;IArCD;;;OAGG;IACH,6BAGC;IAnBD,0BAA0B;IAC1B,YADW,MAAM,GAAC,IAAI,CACJ;IAElB,sBAAsB;IACtB,oBADW,OAAO,CACS;IAE3B,qBAAqB;IACrB,yBADW,MAAM,CACO;IAExB,mCAAmC;IACnC,0BADW,oBAAoB,CACN;IAQrB,uBAAkD;CAgCzD;AAED;;;;;GAKG;AACH;IArCI;;;;;;;;OAQG;IACH,6MAmBC;CAcJ;gCApVY,OAAO,gBAAgB,EAAE,iBAAiB;+BAI1C,OAAO,iBAAiB,EAAE,gBAAgB;2BAI1C,OAAO,iBAAiB,EAAE,YAAY;;;;;;;;qBAiVrC,OAAO,mBAAmB,EAAE,QAAQ,GAAC,OAAO,OAAO,mBAAmB,EAAE,QAAQ,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC;;;;;;+BACvH,OAAO,MAAM,EAAE,MAAM,CAAC;;;;aAGtB,OAAO,oBAAoB,EAAE,UAAU;;;;YACvC,OAAO,mBAAmB,EAAE,QAAQ,GAAC,OAAO,MAAM,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC;;;;+BACzF,OAAO,GAAC,OAAO,MAAM,EAAE,OAAO,CAAC"}
package/types/env.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * A read-only object containing information about the APIs available in the current environment.
3
3
  */
4
4
  export const apis: Readonly<{
5
- /** Whether we are running in a browser environment */
5
+ /** Whether we are running in a browser environment (and not a web worker) */
6
6
  IS_BROWSER_ENV: boolean;
7
7
  /** Whether we are running in a web worker environment */
8
8
  IS_WEBWORKER_ENV: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.js"],"names":[],"mappings":"AA0CA;;GAEG;AACH;IACI,sDAAsD;;IAGtD,yDAAyD;;IAGzD,yCAAyC;;IAGzC,0CAA0C;;IAG1C,yCAAyC;;IAGzC,mDAAmD;;IAGnD,sDAAsD;;IAGtD,8CAA8C;;IAG9C,wCAAwC;;GAEzC;AA6BH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,sCAAsC;AACtC,kBADW,uBAAuB,CA6BjC;;;;;;;;aAhDa,MAAM;;;;;cACN;QAAC,IAAI,EAAE,QAAQ,OAAO,oBAAoB,EAAE,GAAG,CAAC,CAAA;KAAC;;;;;uBAEjD,OAAO;;;;gBAEP,MAAM;;;;wBACN,MAAM;;;;;sBACN,OAAO;;;;oBAEP,MAAM;;;;WACN,OAAO;;;;qBACP,OAAO;;;;gBACP,OAAO;;;;cACP,MAAM;;;;oBACN,OAAO"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.js"],"names":[],"mappings":"AA0CA;;GAEG;AACH;IACI,6EAA6E;;IAG7E,yDAAyD;;IAGzD,yCAAyC;;IAGzC,0CAA0C;;IAG1C,yCAAyC;;IAGzC,mDAAmD;;IAGnD,sDAAsD;;IAGtD,8CAA8C;;IAG9C,wCAAwC;;GAEzC;AA6BH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,sCAAsC;AACtC,kBADW,uBAAuB,CA6BjC;;;;;;;;aAhDa,MAAM;;;;;cACN;QAAC,IAAI,EAAE,QAAQ,OAAO,oBAAoB,EAAE,GAAG,CAAC,CAAA;KAAC;;;;;uBAEjD,OAAO;;;;gBAEP,MAAM;;;;wBACN,MAAM;;;;;sBACN,OAAO;;;;oBAEP,MAAM;;;;WACN,OAAO;;;;qBACP,OAAO;;;;gBACP,OAAO;;;;cACP,MAAM;;;;oBACN,OAAO"}
@@ -223,6 +223,12 @@ export class GenerationConfig {
223
223
  * @default null
224
224
  */
225
225
  suppress_tokens: number[];
226
+ /**
227
+ * A streamer that will be used to stream the generation.
228
+ * @type {import('./streamers.js').TextStreamer}
229
+ * @default null
230
+ */
231
+ streamer: import('./streamers.js').TextStreamer;
226
232
  /**
227
233
  * A list of tokens that will be suppressed at the beginning of the generation.
228
234
  * The `SuppressBeginTokens` logit processor will set their log probs to `-inf` so that they are not sampled.
@@ -1 +1 @@
1
- {"version":3,"file":"configuration_utils.d.ts","sourceRoot":"","sources":["../../src/generation/configuration_utils.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IA0WI;;;OAGG;IACH,oBAFW,gBAAgB,GAAC,OAAO,eAAe,EAAE,gBAAgB,EAInE;IA9WD;;;;;;OAMG;IACH,YAHU,MAAM,CAGA;IAEhB;;;;OAIG;IACH,gBAHU,MAAM,CAGM;IAEtB;;;;;;OAMG;IACH,YAHU,MAAM,CAGD;IAEf;;;;OAIG;IACH,gBAHU,MAAM,CAGM;IAEtB;;;;;;;OAOG;IACH,gBAHU,OAAO,GAAC,OAAO,CAGF;IAEvB;;;;;OAKG;IACH,UAHU,MAAM,CAGA;IAGhB;;;;OAIG;IACH,WAHU,OAAO,CAGC;IAElB;;;;OAIG;IACH,WAHU,MAAM,CAGF;IAEd;;;;;OAKG;IACH,iBAHU,MAAM,CAGI;IAEpB;;;;OAIG;IACH,eAHU,MAAM,CAGK;IAErB;;;;OAIG;IACH,WAHU,OAAO,CAGA;IAGjB;;;;OAIG;IACH,aAHU,MAAM,CAGE;IAElB;;;;OAIG;IACH,OAHU,MAAM,CAGL;IAEX;;;;OAIG;IACH,OAHU,MAAM,CAGJ;IAEZ;;;;;;OAMG;IACH,WAHU,MAAM,CAGA;IAEhB;;;;;;OAMG;IACH,gBAHU,MAAM,CAGK;IAErB;;;;;;;OAOG;IACH,YAHU,MAAM,CAGC;IAEjB;;;;;OAKG;IACH,mB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ACH,wBAHU,MAAM,CAGc;IAG9B;;;;;OAKG;IACH,uBAAuB;CAS1B"}
1
+ {"version":3,"file":"configuration_utils.d.ts","sourceRoot":"","sources":["../../src/generation/configuration_utils.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IAiXI;;;OAGG;IACH,oBAFW,gBAAgB,GAAC,OAAO,eAAe,EAAE,gBAAgB,EAInE;IArXD;;;;;;OAMG;IACH,YAHU,MAAM,CAGA;IAEhB;;;;OAIG;IACH,gBAHU,MAAM,CAGM;IAEtB;;;;;;OAMG;IACH,YAHU,MAAM,CAGD;IAEf;;;;OAIG;IACH,gBAHU,MAAM,CAGM;IAEtB;;;;;;;OAOG;IACH,gBAHU,OAAO,GAAC,OAAO,CAGF;IAEvB;;;;;OAKG;IACH,UAHU,MAAM,CAGA;IAGhB;;;;OAIG;IACH,WAHU,OAAO,CAGC;IAElB;;;;OAIG;IACH,WAHU,MAAM,CAGF;IAEd;;;;;OAKG;IACH,iBAHU,MAAM,CAGI;IAEpB;;;;OAIG;IACH,eAHU,MAAM,CAGK;IAErB;;;;OAIG;IACH,WAHU,OAAO,CAGA;IAGjB;;;;OAIG;IACH,aAHU,MAAM,CAGE;IAElB;;;;OAIG;IACH,OAHU,MAAM,CAGL;IAEX;;;;OAIG;IACH,OAHU,MAAM,CAGJ;IAEZ;;;;;;OAMG;IACH,WAHU,MAAM,CAGA;IAEhB;;;;;;OAMG;IACH,gBAHU,MAAM,CAGK;IAErB;;;;;;;OAOG;IACH,YAHU,MAAM,CAGC;IAEjB;;;;;OAKG;IACH,mBAHU,MAAM,CAGQ;IAExB;;;;;OAKG;IACH,oBAHU,MAAM,CAGS;IAEzB;;;;;;OAMG;IACH,4BAHU,MAAM,CAGiB;IAEjC;;;;;;OAMG;IACH,gBAHU,MAAM,CAGK;IAErB;;;;OAIG;IACH,sBAHU,MAAM,CAGS;IAEzB;;;;;;OAMG;IACH,eAHU,MAAM,EAAE,EAAE,CAGC;IAErB;;;;;;OAMG;IACH,iBAHU,MAAM,EAAE,EAAE,GAAC,MAAM,EAAE,EAAE,EAAE,CAGV;IAEvB;;;;;OAKG;IACH,oBAHU,OAAO,CAGU;IAE3B;;;;OAIG;IACH,aAHU,KAAQ,CAGC;IAEnB;;;;;OAKG;IACH,qBAHU,MAAM,CAGW;IAE3B;;;;;OAKG;IACH,qBAHU,MAAM,GAAC,MAAM,EAAE,CAGE;IAE3B;;;OAGG;IACH,uBAFU,OAAO,CAEa;IAE9B;;;;;OAKG;IACH,kCAHU,CAAC,MAAM,EAAE,MAAM,CAAC,CAGc;IAExC;;;;;OAKG;IACH,iBAHU,MAAM,EAAE,CAGK;IAEvB;;;;OAIG;IACH,UAHU,OAAO,gBAAgB,EAAE,YAAY,CAG/B;IAEhB;;;;;OAKG;IACH,uBAHU,MAAM,EAAE,CAGW;IAE7B;;;;;OAKG;IACH,oBAHU,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAGF;IAE1B;;;;;;OAMG;IACH,gBAHU,MAAM,CAGM;IAGtB;;;;OAIG;IACH,sBAHU,MAAM,CAGS;IAEzB;;;;;OAKG;IACH,mBAHU,OAAO,CAGS;IAE1B;;;;;OAKG;IACH,sBAHU,OAAO,CAGY;IAE7B;;;;;OAKG;IACH,eAHU,OAAO,CAGK;IAEtB;;;;OAIG;IACH,yBAHU,OAAO,CAGe;IAGhC;;;;OAIG;IACH,cAHU,MAAM,CAGI;IAEpB;;;;OAIG;IACH,cAHU,MAAM,CAGI;IAEpB;;;;;OAKG;IACH,cAHU,MAAM,GAAC,MAAM,EAAE,CAGL;IAGpB;;;;OAIG;IACH,8BAHU,MAAM,CAGiB;IAEjC;;;;OAIG;IACH,wBAHU,MAAM,CAGc;IAG9B;;;;;OAKG;IACH,uBAAuB;CAS1B"}
@@ -80,9 +80,9 @@ export class ForcedBOSTokenLogitsProcessor extends LogitsProcessor {
80
80
  * Apply the BOS token forcing to the logits.
81
81
  * @param {bigint[][]} input_ids The input IDs.
82
82
  * @param {Tensor} logits The logits.
83
- * @returns {Object} The logits with BOS token forcing.
83
+ * @returns {Tensor} The logits with BOS token forcing.
84
84
  */
85
- _call(input_ids: bigint[][], logits: Tensor): any;
85
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
86
86
  }
87
87
  /**
88
88
  * A logits processor that enforces the specified token as the last generated token when `max_length` is reached.
@@ -122,9 +122,9 @@ export class SuppressTokensAtBeginLogitsProcessor extends LogitsProcessor {
122
122
  * Apply the BOS token forcing to the logits.
123
123
  * @param {bigint[][]} input_ids The input IDs.
124
124
  * @param {Tensor} logits The logits.
125
- * @returns {Object} The logits with BOS token forcing.
125
+ * @returns {Tensor} The logits with BOS token forcing.
126
126
  */
127
- _call(input_ids: bigint[][], logits: Tensor): any;
127
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
128
128
  }
129
129
  /**
130
130
  * A LogitsProcessor that handles adding timestamps to generated text.
@@ -182,17 +182,27 @@ export class NoRepeatNGramLogitsProcessor extends LogitsProcessor {
182
182
  * Apply the no-repeat-ngram processor to the logits.
183
183
  * @param {bigint[][]} input_ids The input IDs.
184
184
  * @param {Tensor} logits The logits.
185
- * @returns {Object} The logits with no-repeat-ngram processing.
185
+ * @returns {Tensor} The logits with no-repeat-ngram processing.
186
186
  */
187
- _call(input_ids: bigint[][], logits: Tensor): any;
187
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
188
188
  }
189
189
  /**
190
- * A logits processor that penalises repeated output tokens.
190
+ * A logits processor that prevents the repetition of previous tokens through a penalty.
191
+ * This penalty is applied at most once per token. Note that, for decoder-only models like most LLMs,
192
+ * the considered tokens include the prompt.
193
+ *
194
+ * In the original [paper](https://arxiv.org/pdf/1909.05858.pdf), the authors suggest the use of a
195
+ * penalty of around 1.2 to achieve a good balance between truthful generation and lack of repetition.
196
+ * To penalize and reduce repetition, use `penalty` values above 1.0, where a higher value penalizes
197
+ * more strongly. To reward and encourage repetition, use `penalty` values between 0.0 and 1.0, where
198
+ * a lower value rewards more strongly.
191
199
  */
192
200
  export class RepetitionPenaltyLogitsProcessor extends LogitsProcessor {
193
201
  /**
194
202
  * Create a RepetitionPenaltyLogitsProcessor.
195
- * @param {number} penalty The penalty to apply for repeated tokens.
203
+ * @param {number} penalty The parameter for repetition penalty.
204
+ * - 1.0 means no penalty. Above 1.0 penalizes previously generated tokens.
205
+ * - Between 0.0 and 1.0 rewards previously generated tokens.
196
206
  */
197
207
  constructor(penalty: number);
198
208
  penalty: number;
@@ -200,9 +210,9 @@ export class RepetitionPenaltyLogitsProcessor extends LogitsProcessor {
200
210
  * Apply the repetition penalty to the logits.
201
211
  * @param {bigint[][]} input_ids The input IDs.
202
212
  * @param {Tensor} logits The logits.
203
- * @returns {Object} The logits with repetition penalty processing.
213
+ * @returns {Tensor} The logits with repetition penalty processing.
204
214
  */
205
- _call(input_ids: bigint[][], logits: Tensor): any;
215
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
206
216
  }
207
217
  /**
208
218
  * A logits processor that enforces a minimum number of tokens.
@@ -220,9 +230,9 @@ export class MinLengthLogitsProcessor extends LogitsProcessor {
220
230
  * Apply logit processor.
221
231
  * @param {bigint[][]} input_ids The input IDs.
222
232
  * @param {Tensor} logits The logits.
223
- * @returns {Object} The processed logits.
233
+ * @returns {Tensor} The processed logits.
224
234
  */
225
- _call(input_ids: bigint[][], logits: Tensor): any;
235
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
226
236
  }
227
237
  /**
228
238
  * A logits processor that enforces a minimum number of new tokens.
@@ -242,9 +252,9 @@ export class MinNewTokensLengthLogitsProcessor extends LogitsProcessor {
242
252
  * Apply logit processor.
243
253
  * @param {bigint[][]} input_ids The input IDs.
244
254
  * @param {Tensor} logits The logits.
245
- * @returns {Object} The processed logits.
255
+ * @returns {Tensor} The processed logits.
246
256
  */
247
- _call(input_ids: bigint[][], logits: Tensor): any;
257
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
248
258
  }
249
259
  export class NoBadWordsLogitsProcessor extends LogitsProcessor {
250
260
  /**
@@ -259,9 +269,9 @@ export class NoBadWordsLogitsProcessor extends LogitsProcessor {
259
269
  * Apply logit processor.
260
270
  * @param {bigint[][]} input_ids The input IDs.
261
271
  * @param {Tensor} logits The logits.
262
- * @returns {Object} The processed logits.
272
+ * @returns {Tensor} The processed logits.
263
273
  */
264
- _call(input_ids: bigint[][], logits: Tensor): any;
274
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
265
275
  }
266
276
  /**
267
277
  * [`LogitsProcessor`] for classifier free guidance (CFG). The scores are split over the batch dimension,
@@ -284,9 +294,9 @@ export class ClassifierFreeGuidanceLogitsProcessor extends LogitsProcessor {
284
294
  * Apply logit processor.
285
295
  * @param {bigint[][]} input_ids The input IDs.
286
296
  * @param {Tensor} logits The logits.
287
- * @returns {Object} The processed logits.
297
+ * @returns {Tensor} The processed logits.
288
298
  */
289
- _call(input_ids: bigint[][], logits: Tensor): any;
299
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
290
300
  }
291
301
  /**
292
302
  * [`LogitsWarper`] for temperature (exponential scaling output probability distribution), which effectively means
@@ -305,9 +315,9 @@ export class TemperatureLogitsWarper extends LogitsWarper {
305
315
  * Apply logit warper.
306
316
  * @param {bigint[][]} input_ids The input IDs.
307
317
  * @param {Tensor} logits The logits.
308
- * @returns {Object} The processed logits.
318
+ * @returns {Tensor} The processed logits.
309
319
  */
310
- _call(input_ids: bigint[][], logits: Tensor): any;
320
+ _call(input_ids: bigint[][], logits: Tensor): Tensor;
311
321
  }
312
322
  /**
313
323
  * [`LogitsWarper`] that performs top-p, i.e. restricting to top tokens summing to prob_cut_off <= prob_cut_off.
@@ -1 +1 @@
1
- {"version":3,"file":"logits_process.d.ts","sourceRoot":"","sources":["../../src/generation/logits_process.js"],"names":[],"mappings":";;;;AAUA;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,QAKhB;CACJ;;;;;AAGD;;GAEG;AACH;IACI;;;;;;;OAOG;I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;AACH;IACI;;;;;;;OAOG;IACH,mBANW,MAAM;QAGW,YAAY,GAA7B,MAAM;QACW,kBAAkB,GAAnC,MAAM;OAiBhB;IAHG,cAAkB;IAClB,qBAAgC;IAChC,2BAA4C;CAEnD;AAED;;;GAGG;AACH;IACI;;;;;;OAMG;IACH,mBALW,MAAM;QAEW,YAAY,GAA7B,MAAM;QACW,kBAAkB,GAAnC,MAAM;OAahB;IAFG,cAAgD;IAChD,qBAAgC;CAEvC;uBAxsBsB,oBAAoB"}
1
+ {"version":3,"file":"logits_process.d.ts","sourceRoot":"","sources":["../../src/generation/logits_process.js"],"names":[],"mappings":";;;;AAUA;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,QAKhB;CACJ;;;;;AAGD;;GAEG;AACH;IACI;;;;;;;OAOG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,QAKhB;CACJ;;;;;AAGD;;;;GAIG;AACH;IAMQ,kBAAoB;IAGxB;;;;OAIG;IACH,WAFW,eAAe,QAIzB;IAED;;;;OAIG;IACH,cAFW,eAAe,EAAE,QAI3B;IAED;;;;;OAKG;IACH,iBAHW,MAAM,EAAE,EAAE,UACV,MAAM,UAShB;IAED,2CAEC;CACJ;AAwCD;;GAEG;AACH;IACI;;;OAGG;IACH,0BAFW,MAAM,EAKhB;IADG,qBAAgC;IAGpC;;;;;OAKG;IACH,iBAJW,MAAM,EAAE,EAAE,UACV,MAAM,GACJ,MAAM,CAWlB;CACJ;AAED;;GAEG;AACH;IACI;;;;OAIG;IACH,wBAHW,MAAM,gBACN,MAAM,GAAC,MAAM,EAAE,EAMzB;IAFG,mBAA4B;IAC5B,uBAA+E;IAGnF;;;;;OAKG;IACH,iBAHW,MAAM,EAAE,EAAE,UACV,MAAM,UAahB;CACJ;AAED;;;;GAIG;AACH;IACI;;;;OAIG;IACH,mCAHW,MAAM,EAAE,eACR,MAAM,EAMhB;IAFG,gCAAkD;IAClD,oBAA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