@huggingface/transformers 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -47,7 +47,7 @@ npm i @huggingface/transformers
47
47
  Alternatively, you can use it in vanilla JS, without any bundler, by using a CDN or static hosting. For example, using [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), you can import the library with:
48
48
  ```html
49
49
  <script type="module">
50
- import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.2.2';
50
+ import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.2.3';
51
51
  </script>
52
52
  ```
53
53
 
@@ -155,7 +155,7 @@ Check out the Transformers.js [template](https://huggingface.co/new-space?templa
155
155
 
156
156
 
157
157
 
158
- By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models?library=transformers.js) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.2.2/dist/), which should work out-of-the-box. You can customize this as follows:
158
+ By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models?library=transformers.js) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.2.3/dist/), which should work out-of-the-box. You can customize this as follows:
159
159
 
160
160
  ### Settings
161
161
 
@@ -313,6 +313,7 @@ You can refine your search by selecting the task you're interested in (e.g., [te
313
313
  1. **Depth Pro** (from Apple) released with the paper [Depth Pro: Sharp Monocular Metric Depth in Less Than a Second](https://arxiv.org/abs/2410.02073) by Aleksei Bochkovskii, Amaël Delaunoy, Hugo Germain, Marcel Santos, Yichao Zhou, Stephan R. Richter, Vladlen Koltun.
314
314
  1. **[DETR](https://huggingface.co/docs/transformers/model_doc/detr)** (from Facebook) released with the paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) by Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko.
315
315
  1. **[DINOv2](https://huggingface.co/docs/transformers/model_doc/dinov2)** (from Meta AI) released with the paper [DINOv2: Learning Robust Visual Features without Supervision](https://arxiv.org/abs/2304.07193) by Maxime Oquab, Timothée Darcet, Théo Moutakanni, Huy Vo, Marc Szafraniec, Vasil Khalidov, Pierre Fernandez, Daniel Haziza, Francisco Massa, Alaaeldin El-Nouby, Mahmoud Assran, Nicolas Ballas, Wojciech Galuba, Russell Howes, Po-Yao Huang, Shang-Wen Li, Ishan Misra, Michael Rabbat, Vasu Sharma, Gabriel Synnaeve, Hu Xu, Hervé Jegou, Julien Mairal, Patrick Labatut, Armand Joulin, Piotr Bojanowski.
316
+ 1. **[DINOv2 with Registers](https://huggingface.co/docs/transformers/model_doc/dinov2_with_registers)** (from Meta AI) released with the paper [DINOv2 with Registers](https://arxiv.org/abs/2309.16588) by Timothée Darcet, Maxime Oquab, Julien Mairal, Piotr Bojanowski.
316
317
  1. **[DistilBERT](https://huggingface.co/docs/transformers/model_doc/distilbert)** (from HuggingFace), released together with the paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108) by Victor Sanh, Lysandre Debut and Thomas Wolf. The same method has been applied to compress GPT2 into [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), RoBERTa into [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), Multilingual BERT into [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation) and a German version of DistilBERT.
317
318
  1. **[DiT](https://huggingface.co/docs/transformers/model_doc/dit)** (from Microsoft Research) released with the paper [DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378) by Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
318
319
  1. **[Donut](https://huggingface.co/docs/transformers/model_doc/donut)** (from NAVER), released together with the paper [OCR-free Document Understanding Transformer](https://arxiv.org/abs/2111.15664) by Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, Seunghyun Park.
@@ -5932,7 +5932,7 @@ __webpack_require__.r(__webpack_exports__);
5932
5932
 
5933
5933
 
5934
5934
 
5935
- const VERSION = '3.2.2';
5935
+ const VERSION = '3.2.3';
5936
5936
 
5937
5937
  // Check if various APIs are available (depends on environment)
5938
5938
  const IS_BROWSER_ENV = typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -8008,6 +8008,9 @@ __webpack_require__.r(__webpack_exports__);
8008
8008
  /* harmony export */ Dinov2ForImageClassification: () => (/* binding */ Dinov2ForImageClassification),
8009
8009
  /* harmony export */ Dinov2Model: () => (/* binding */ Dinov2Model),
8010
8010
  /* harmony export */ Dinov2PreTrainedModel: () => (/* binding */ Dinov2PreTrainedModel),
8011
+ /* harmony export */ Dinov2WithRegistersForImageClassification: () => (/* binding */ Dinov2WithRegistersForImageClassification),
8012
+ /* harmony export */ Dinov2WithRegistersModel: () => (/* binding */ Dinov2WithRegistersModel),
8013
+ /* harmony export */ Dinov2WithRegistersPreTrainedModel: () => (/* binding */ Dinov2WithRegistersPreTrainedModel),
8011
8014
  /* harmony export */ DistilBertForMaskedLM: () => (/* binding */ DistilBertForMaskedLM),
8012
8015
  /* harmony export */ DistilBertForQuestionAnswering: () => (/* binding */ DistilBertForQuestionAnswering),
8013
8016
  /* harmony export */ DistilBertForSequenceClassification: () => (/* binding */ DistilBertForSequenceClassification),
@@ -11742,7 +11745,7 @@ class MoonshinePreTrainedModel extends PreTrainedModel {
11742
11745
  */
11743
11746
  class MoonshineModel extends MoonshinePreTrainedModel { }
11744
11747
 
11745
- class MoonshineForConditionalGeneration extends MoonshinePreTrainedModel { }
11748
+ class MoonshineForConditionalGeneration extends MoonshinePreTrainedModel { }
11746
11749
  //////////////////////////////////////////////////
11747
11750
 
11748
11751
 
@@ -12142,9 +12145,9 @@ class CLIPTextModel extends CLIPPreTrainedModel {
12142
12145
  /** @type {typeof PreTrainedModel.from_pretrained} */
12143
12146
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12144
12147
  return super.from_pretrained(pretrained_model_name_or_path, {
12145
- // Update default model file name if not provided
12146
- model_file_name: 'text_model',
12147
12148
  ...options,
12149
+ // Update default model file name if not provided
12150
+ model_file_name: options.model_file_name ?? 'text_model',
12148
12151
  });
12149
12152
  }
12150
12153
  }
@@ -12179,9 +12182,9 @@ class CLIPTextModelWithProjection extends CLIPPreTrainedModel {
12179
12182
  /** @type {typeof PreTrainedModel.from_pretrained} */
12180
12183
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12181
12184
  return super.from_pretrained(pretrained_model_name_or_path, {
12182
- // Update default model file name if not provided
12183
- model_file_name: 'text_model',
12184
12185
  ...options,
12186
+ // Update default model file name if not provided
12187
+ model_file_name: options.model_file_name ?? 'text_model',
12185
12188
  });
12186
12189
  }
12187
12190
  }
@@ -12193,9 +12196,9 @@ class CLIPVisionModel extends CLIPPreTrainedModel {
12193
12196
  /** @type {typeof PreTrainedModel.from_pretrained} */
12194
12197
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12195
12198
  return super.from_pretrained(pretrained_model_name_or_path, {
12196
- // Update default model file name if not provided
12197
- model_file_name: 'vision_model',
12198
12199
  ...options,
12200
+ // Update default model file name if not provided
12201
+ model_file_name: options.model_file_name ?? 'vision_model',
12199
12202
  });
12200
12203
  }
12201
12204
  }
@@ -12230,9 +12233,9 @@ class CLIPVisionModelWithProjection extends CLIPPreTrainedModel {
12230
12233
  /** @type {typeof PreTrainedModel.from_pretrained} */
12231
12234
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12232
12235
  return super.from_pretrained(pretrained_model_name_or_path, {
12233
- // Update default model file name if not provided
12234
- model_file_name: 'vision_model',
12235
12236
  ...options,
12237
+ // Update default model file name if not provided
12238
+ model_file_name: options.model_file_name ?? 'vision_model',
12236
12239
  });
12237
12240
  }
12238
12241
  }
@@ -12318,9 +12321,9 @@ class SiglipTextModel extends SiglipPreTrainedModel {
12318
12321
  /** @type {typeof PreTrainedModel.from_pretrained} */
12319
12322
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12320
12323
  return super.from_pretrained(pretrained_model_name_or_path, {
12321
- // Update default model file name if not provided
12322
- model_file_name: 'text_model',
12323
12324
  ...options,
12325
+ // Update default model file name if not provided
12326
+ model_file_name: options.model_file_name ?? 'text_model',
12324
12327
  });
12325
12328
  }
12326
12329
  }
@@ -12355,9 +12358,9 @@ class SiglipVisionModel extends CLIPPreTrainedModel {
12355
12358
  /** @type {typeof PreTrainedModel.from_pretrained} */
12356
12359
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12357
12360
  return super.from_pretrained(pretrained_model_name_or_path, {
12358
- // Update default model file name if not provided
12359
- model_file_name: 'vision_model',
12360
12361
  ...options,
12362
+ // Update default model file name if not provided
12363
+ model_file_name: options.model_file_name ?? 'vision_model',
12361
12364
  });
12362
12365
  }
12363
12366
  }
@@ -12414,9 +12417,9 @@ class JinaCLIPTextModel extends JinaCLIPPreTrainedModel {
12414
12417
  /** @type {typeof PreTrainedModel.from_pretrained} */
12415
12418
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12416
12419
  return super.from_pretrained(pretrained_model_name_or_path, {
12417
- // Update default model file name if not provided
12418
- model_file_name: 'text_model',
12419
12420
  ...options,
12421
+ // Update default model file name if not provided
12422
+ model_file_name: options.model_file_name ?? 'text_model',
12420
12423
  });
12421
12424
  }
12422
12425
  }
@@ -12425,9 +12428,9 @@ class JinaCLIPVisionModel extends JinaCLIPPreTrainedModel {
12425
12428
  /** @type {typeof PreTrainedModel.from_pretrained} */
12426
12429
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
12427
12430
  return super.from_pretrained(pretrained_model_name_or_path, {
12428
- // Update default model file name if not provided
12429
- model_file_name: 'vision_model',
12430
12431
  ...options,
12432
+ // Update default model file name if not provided
12433
+ model_file_name: options.model_file_name ?? 'vision_model',
12431
12434
  });
12432
12435
  }
12433
12436
  }
@@ -13710,6 +13713,26 @@ class Dinov2ForImageClassification extends Dinov2PreTrainedModel {
13710
13713
  }
13711
13714
  //////////////////////////////////////////////////
13712
13715
 
13716
+ //////////////////////////////////////////////////
13717
+ class Dinov2WithRegistersPreTrainedModel extends PreTrainedModel { }
13718
+
13719
+ /**
13720
+ * The bare Dinov2WithRegisters Model transformer outputting raw hidden-states without any specific head on top.
13721
+ */
13722
+ class Dinov2WithRegistersModel extends Dinov2WithRegistersPreTrainedModel { }
13723
+
13724
+ /**
13725
+ * Dinov2WithRegisters Model transformer with an image classification head on top (a linear layer on top of the final hidden state of the [CLS] token) e.g. for ImageNet.
13726
+ */
13727
+ class Dinov2WithRegistersForImageClassification extends Dinov2WithRegistersPreTrainedModel {
13728
+ /**
13729
+ * @param {any} model_inputs
13730
+ */
13731
+ async _call(model_inputs) {
13732
+ return new SequenceClassifierOutput(await super._call(model_inputs));
13733
+ }
13734
+ }
13735
+ //////////////////////////////////////////////////
13713
13736
 
13714
13737
  //////////////////////////////////////////////////
13715
13738
  class YolosPreTrainedModel extends PreTrainedModel { }
@@ -14659,9 +14682,9 @@ class ClapTextModelWithProjection extends ClapPreTrainedModel {
14659
14682
  /** @type {typeof PreTrainedModel.from_pretrained} */
14660
14683
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
14661
14684
  return super.from_pretrained(pretrained_model_name_or_path, {
14662
- // Update default model file name if not provided
14663
- model_file_name: 'text_model',
14664
14685
  ...options,
14686
+ // Update default model file name if not provided
14687
+ model_file_name: options.model_file_name ?? 'text_model',
14665
14688
  });
14666
14689
  }
14667
14690
  }
@@ -14696,9 +14719,9 @@ class ClapAudioModelWithProjection extends ClapPreTrainedModel {
14696
14719
  /** @type {typeof PreTrainedModel.from_pretrained} */
14697
14720
  static async from_pretrained(pretrained_model_name_or_path, options = {}) {
14698
14721
  return super.from_pretrained(pretrained_model_name_or_path, {
14699
- // Update default model file name if not provided
14700
- model_file_name: 'audio_model',
14701
14722
  ...options,
14723
+ // Update default model file name if not provided
14724
+ model_file_name: options.model_file_name ?? 'audio_model',
14702
14725
  });
14703
14726
  }
14704
14727
  }
@@ -15339,6 +15362,7 @@ const MODEL_MAPPING_NAMES_ENCODER_ONLY = new Map([
15339
15362
  ['convnext', ['ConvNextModel', ConvNextModel]],
15340
15363
  ['convnextv2', ['ConvNextV2Model', ConvNextV2Model]],
15341
15364
  ['dinov2', ['Dinov2Model', Dinov2Model]],
15365
+ ['dinov2_with_registers', ['Dinov2WithRegistersModel', Dinov2WithRegistersModel]],
15342
15366
  ['resnet', ['ResNetModel', ResNetModel]],
15343
15367
  ['swin', ['SwinModel', SwinModel]],
15344
15368
  ['swin2sr', ['Swin2SRModel', Swin2SRModel]],
@@ -15584,6 +15608,7 @@ const MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES = new Map([
15584
15608
  ['convnext', ['ConvNextForImageClassification', ConvNextForImageClassification]],
15585
15609
  ['convnextv2', ['ConvNextV2ForImageClassification', ConvNextV2ForImageClassification]],
15586
15610
  ['dinov2', ['Dinov2ForImageClassification', Dinov2ForImageClassification]],
15611
+ ['dinov2_with_registers', ['Dinov2WithRegistersForImageClassification', Dinov2WithRegistersForImageClassification]],
15587
15612
  ['resnet', ['ResNetForImageClassification', ResNetForImageClassification]],
15588
15613
  ['swin', ['SwinForImageClassification', SwinForImageClassification]],
15589
15614
  ['segformer', ['SegformerForImageClassification', SegformerForImageClassification]],
@@ -34784,6 +34809,9 @@ __webpack_require__.r(__webpack_exports__);
34784
34809
  /* harmony export */ Dinov2ForImageClassification: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.Dinov2ForImageClassification),
34785
34810
  /* harmony export */ Dinov2Model: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.Dinov2Model),
34786
34811
  /* harmony export */ Dinov2PreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.Dinov2PreTrainedModel),
34812
+ /* harmony export */ Dinov2WithRegistersForImageClassification: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.Dinov2WithRegistersForImageClassification),
34813
+ /* harmony export */ Dinov2WithRegistersModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.Dinov2WithRegistersModel),
34814
+ /* harmony export */ Dinov2WithRegistersPreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.Dinov2WithRegistersPreTrainedModel),
34787
34815
  /* harmony export */ DistilBertForMaskedLM: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.DistilBertForMaskedLM),
34788
34816
  /* harmony export */ DistilBertForQuestionAnswering: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.DistilBertForQuestionAnswering),
34789
34817
  /* harmony export */ DistilBertForSequenceClassification: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.DistilBertForSequenceClassification),