@huggingface/transformers 3.0.0-alpha.11 → 3.0.0-alpha.13

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
@@ -101,7 +101,7 @@ npm i @huggingface/transformers
101
101
  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:
102
102
  ```html
103
103
  <script type="module">
104
- import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0-alpha.11';
104
+ import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0-alpha.13';
105
105
  </script>
106
106
  ```
107
107
 
@@ -134,7 +134,7 @@ Check out the Transformers.js [template](https://huggingface.co/new-space?templa
134
134
 
135
135
 
136
136
 
137
- 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.0.0-alpha.11/dist/), which should work out-of-the-box. You can customize this as follows:
137
+ 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.0.0-alpha.13/dist/), which should work out-of-the-box. You can customize this as follows:
138
138
 
139
139
  ### Settings
140
140
 
@@ -311,6 +311,7 @@ You can refine your search by selecting the task you're interested in (e.g., [te
311
311
  1. **[GPTBigCode](https://huggingface.co/docs/transformers/model_doc/gpt_bigcode)** (from BigCode) released with the paper [SantaCoder: don't reach for the stars!](https://arxiv.org/abs/2301.03988) by Loubna Ben Allal, Raymond Li, Denis Kocetkov, Chenghao Mou, Christopher Akiki, Carlos Munoz Ferrandis, Niklas Muennighoff, Mayank Mishra, Alex Gu, Manan Dey, Logesh Kumar Umapathi, Carolyn Jane Anderson, Yangtian Zi, Joel Lamy Poirier, Hailey Schoelkopf, Sergey Troshin, Dmitry Abulkhanov, Manuel Romero, Michael Lappert, Francesco De Toni, Bernardo García del Río, Qian Liu, Shamik Bose, Urvashi Bhattacharyya, Terry Yue Zhuo, Ian Yu, Paulo Villegas, Marco Zocca, Sourab Mangrulkar, David Lansky, Huu Nguyen, Danish Contractor, Luis Villa, Jia Li, Dzmitry Bahdanau, Yacine Jernite, Sean Hughes, Daniel Fried, Arjun Guha, Harm de Vries, Leandro von Werra.
312
312
  1. **[HerBERT](https://huggingface.co/docs/transformers/model_doc/herbert)** (from Allegro.pl, AGH University of Science and Technology) released with the paper [KLEJ: Comprehensive Benchmark for Polish Language Understanding](https://www.aclweb.org/anthology/2020.acl-main.111.pdf) by Piotr Rybak, Robert Mroczkowski, Janusz Tracz, Ireneusz Gawlik.
313
313
  1. **[Hubert](https://huggingface.co/docs/transformers/model_doc/hubert)** (from Facebook) released with the paper [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447) by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed.
314
+ 1. **JAIS** (from Core42) released with the paper [Jais and Jais-chat: Arabic-Centric Foundation and Instruction-Tuned Open Generative Large Language Models](https://arxiv.org/pdf/2308.16149) by Neha Sengupta, Sunil Kumar Sahu, Bokang Jia, Satheesh Katipomu, Haonan Li, Fajri Koto, William Marshall, Gurpreet Gosal, Cynthia Liu, Zhiming Chen, Osama Mohammed Afzal, Samta Kamboj, Onkar Pandit, Rahul Pal, Lalit Pradhan, Zain Muhammad Mujahid, Massa Baali, Xudong Han, Sondos Mahmoud Bsharat, Alham Fikri Aji, Zhiqiang Shen, Zhengzhong Liu, Natalia Vassilieva, Joel Hestness, Andy Hock, Andrew Feldman, Jonathan Lee, Andrew Jackson, Hector Xuguang Ren, Preslav Nakov, Timothy Baldwin, Eric Xing.
314
315
  1. **[LongT5](https://huggingface.co/docs/transformers/model_doc/longt5)** (from Google AI) released with the paper [LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/abs/2112.07916) by Mandy Guo, Joshua Ainslie, David Uthus, Santiago Ontanon, Jianmo Ni, Yun-Hsuan Sung, Yinfei Yang.
315
316
  1. **[LLaMA](https://huggingface.co/docs/transformers/model_doc/llama)** (from The FAIR team of Meta AI) released with the paper [LLaMA: Open and Efficient Foundation Language Models](https://arxiv.org/abs/2302.13971) by Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, Guillaume Lample.
316
317
  1. **[Llama2](https://huggingface.co/docs/transformers/model_doc/llama2)** (from The FAIR team of Meta AI) released with the paper [Llama2: Open Foundation and Fine-Tuned Chat Models](https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/XXX) by Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushka rMishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing EllenTan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, Thomas Scialom.
@@ -4104,6 +4104,7 @@ function getNormalizedConfig(config) {
4104
4104
  // Decoder-only models
4105
4105
  case 'gpt2':
4106
4106
  case 'gptj':
4107
+ case 'jais':
4107
4108
  case 'codegen':
4108
4109
  case 'gpt_bigcode':
4109
4110
  mapping['num_heads'] = 'n_head';
@@ -4436,7 +4437,7 @@ __webpack_require__.r(__webpack_exports__);
4436
4437
 
4437
4438
 
4438
4439
 
4439
- const VERSION = '3.0.0-alpha.11';
4440
+ const VERSION = '3.0.0-alpha.13';
4440
4441
 
4441
4442
  // Check if various APIs are available (depends on environment)
4442
4443
  const IS_BROWSER_ENV = typeof self !== 'undefined';
@@ -6371,6 +6372,7 @@ __webpack_require__.r(__webpack_exports__);
6371
6372
  /* harmony export */ AutoModelForImageToImage: () => (/* binding */ AutoModelForImageToImage),
6372
6373
  /* harmony export */ AutoModelForMaskGeneration: () => (/* binding */ AutoModelForMaskGeneration),
6373
6374
  /* harmony export */ AutoModelForMaskedLM: () => (/* binding */ AutoModelForMaskedLM),
6375
+ /* harmony export */ AutoModelForNormalEstimation: () => (/* binding */ AutoModelForNormalEstimation),
6374
6376
  /* harmony export */ AutoModelForObjectDetection: () => (/* binding */ AutoModelForObjectDetection),
6375
6377
  /* harmony export */ AutoModelForQuestionAnswering: () => (/* binding */ AutoModelForQuestionAnswering),
6376
6378
  /* harmony export */ AutoModelForSemanticSegmentation: () => (/* binding */ AutoModelForSemanticSegmentation),
@@ -6533,6 +6535,9 @@ __webpack_require__.r(__webpack_exports__);
6533
6535
  /* harmony export */ HubertModel: () => (/* binding */ HubertModel),
6534
6536
  /* harmony export */ HubertPreTrainedModel: () => (/* binding */ HubertPreTrainedModel),
6535
6537
  /* harmony export */ ImageMattingOutput: () => (/* binding */ ImageMattingOutput),
6538
+ /* harmony export */ JAISLMHeadModel: () => (/* binding */ JAISLMHeadModel),
6539
+ /* harmony export */ JAISModel: () => (/* binding */ JAISModel),
6540
+ /* harmony export */ JAISPreTrainedModel: () => (/* binding */ JAISPreTrainedModel),
6536
6541
  /* harmony export */ LlamaForCausalLM: () => (/* binding */ LlamaForCausalLM),
6537
6542
  /* harmony export */ LlamaModel: () => (/* binding */ LlamaModel),
6538
6543
  /* harmony export */ LlamaPreTrainedModel: () => (/* binding */ LlamaPreTrainedModel),
@@ -10500,6 +10505,33 @@ class GPT2LMHeadModel extends GPT2PreTrainedModel { }
10500
10505
  // }
10501
10506
  //////////////////////////////////////////////////
10502
10507
 
10508
+ //////////////////////////////////////////////////
10509
+ // JAIS models
10510
+ class JAISPreTrainedModel extends PreTrainedModel {
10511
+ /**
10512
+ * Creates a new instance of the `JAISPreTrainedModel` class.
10513
+ * @param {Object} config The model configuration.
10514
+ * @param {Record<string, any>} sessions The inference sessions for the model.
10515
+ * @param {GenerationConfig} generation_config The generation configuration.
10516
+ */
10517
+ constructor(config, sessions, generation_config) {
10518
+ super(config, sessions);
10519
+ this.generation_config = generation_config;
10520
+ }
10521
+ }
10522
+
10523
+ /**
10524
+ * The bare JAIS Model transformer outputting raw hidden-states without any specific head on top.
10525
+ */
10526
+ class JAISModel extends JAISPreTrainedModel { }
10527
+
10528
+ /**
10529
+ * The JAIS Model transformer with a language modeling head on top (linear layer with weights tied to the input embeddings).
10530
+ */
10531
+ class JAISLMHeadModel extends JAISPreTrainedModel { }
10532
+ //////////////////////////////////////////////////
10533
+
10534
+
10503
10535
  //////////////////////////////////////////////////
10504
10536
  // GPTNeo models
10505
10537
  class GPTNeoPreTrainedModel extends PreTrainedModel {
@@ -13062,6 +13094,7 @@ const MODEL_MAPPING_NAMES_ENCODER_DECODER = new Map([
13062
13094
 
13063
13095
  const MODEL_MAPPING_NAMES_DECODER_ONLY = new Map([
13064
13096
  ['bloom', ['BloomModel', BloomModel]],
13097
+ ['jais', ['JAISModel', JAISModel]],
13065
13098
  ['gpt2', ['GPT2Model', GPT2Model]],
13066
13099
  ['gptj', ['GPTJModel', GPTJModel]],
13067
13100
  ['gpt_bigcode', ['GPTBigCodeModel', GPTBigCodeModel]],
@@ -13150,6 +13183,7 @@ const MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES = new Map([
13150
13183
  const MODEL_FOR_CAUSAL_LM_MAPPING_NAMES = new Map([
13151
13184
  ['bloom', ['BloomForCausalLM', BloomForCausalLM]],
13152
13185
  ['gpt2', ['GPT2LMHeadModel', GPT2LMHeadModel]],
13186
+ ['jais', ['JAISLMHeadModel', JAISLMHeadModel]],
13153
13187
  ['gptj', ['GPTJForCausalLM', GPTJForCausalLM]],
13154
13188
  ['gpt_bigcode', ['GPTBigCodeForCausalLM', GPTBigCodeForCausalLM]],
13155
13189
  ['gpt_neo', ['GPTNeoForCausalLM', GPTNeoForCausalLM]],
@@ -13315,6 +13349,10 @@ const MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES = new Map([
13315
13349
  ['sapiens', ['SapiensForDepthEstimation', SapiensForDepthEstimation]],
13316
13350
  ])
13317
13351
 
13352
+ const MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES = new Map([
13353
+ ['sapiens', ['SapiensForNormalEstimation', SapiensForNormalEstimation]],
13354
+ ])
13355
+
13318
13356
  // NOTE: This is custom to Transformers.js, and is necessary because certain models
13319
13357
  // (e.g., CLIP) are split into vision and text components
13320
13358
  const MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES = new Map([
@@ -13341,6 +13379,7 @@ const MODEL_CLASS_TYPE_MAPPING = [
13341
13379
  [MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
13342
13380
  [MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
13343
13381
  [MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
13382
+ [MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
13344
13383
  [MODEL_FOR_OBJECT_DETECTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
13345
13384
  [MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
13346
13385
  [MODEL_FOR_MASK_GENERATION_MAPPING_NAMES, MODEL_TYPES.MaskGeneration],
@@ -13597,6 +13636,10 @@ class AutoModelForDepthEstimation extends PretrainedMixin {
13597
13636
  static MODEL_CLASS_MAPPINGS = [MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES];
13598
13637
  }
13599
13638
 
13639
+ class AutoModelForNormalEstimation extends PretrainedMixin {
13640
+ static MODEL_CLASS_MAPPINGS = [MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES];
13641
+ }
13642
+
13600
13643
  class AutoModelForImageFeatureExtraction extends PretrainedMixin {
13601
13644
  static MODEL_CLASS_MAPPINGS = [MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES];
13602
13645
  }
@@ -28994,6 +29037,7 @@ class Tensor {
28994
29037
  }
28995
29038
  return this;
28996
29039
  }
29040
+
28997
29041
  /**
28998
29042
  * Return a new Tensor with every element added by a constant.
28999
29043
  * @param {number} val The value to add by.
@@ -29016,6 +29060,28 @@ class Tensor {
29016
29060
  return this;
29017
29061
  }
29018
29062
 
29063
+ /**
29064
+ * Return a new Tensor with every element subtracted by a constant.
29065
+ * @param {number} val The value to subtract by.
29066
+ * @returns {Tensor} The new tensor.
29067
+ */
29068
+ sub(val) {
29069
+ return this.clone().sub_(val);
29070
+ }
29071
+
29072
+ /**
29073
+ * Subtract the tensor by a constant in place.
29074
+ * @param {number} val The value to subtract by.
29075
+ * @returns {Tensor} Returns `this`.
29076
+ */
29077
+ sub_(val) {
29078
+ const this_data = this.data;
29079
+ for (let i = 0; i < this_data.length; ++i) {
29080
+ this_data[i] -= val;
29081
+ }
29082
+ return this;
29083
+ }
29084
+
29019
29085
  clone() {
29020
29086
  return new Tensor(this.type, this.data.slice(), this.dims.slice());
29021
29087
  }
@@ -30224,6 +30290,7 @@ __webpack_require__.r(__webpack_exports__);
30224
30290
  /* harmony export */ AutoModelForImageToImage: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForImageToImage),
30225
30291
  /* harmony export */ AutoModelForMaskGeneration: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForMaskGeneration),
30226
30292
  /* harmony export */ AutoModelForMaskedLM: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForMaskedLM),
30293
+ /* harmony export */ AutoModelForNormalEstimation: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForNormalEstimation),
30227
30294
  /* harmony export */ AutoModelForObjectDetection: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForObjectDetection),
30228
30295
  /* harmony export */ AutoModelForQuestionAnswering: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForQuestionAnswering),
30229
30296
  /* harmony export */ AutoModelForSemanticSegmentation: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.AutoModelForSemanticSegmentation),
@@ -30442,6 +30509,9 @@ __webpack_require__.r(__webpack_exports__);
30442
30509
  /* harmony export */ ImageToImagePipeline: () => (/* reexport safe */ _pipelines_js__WEBPACK_IMPORTED_MODULE_1__.ImageToImagePipeline),
30443
30510
  /* harmony export */ ImageToTextPipeline: () => (/* reexport safe */ _pipelines_js__WEBPACK_IMPORTED_MODULE_1__.ImageToTextPipeline),
30444
30511
  /* harmony export */ InterruptableStoppingCriteria: () => (/* reexport safe */ _generation_stopping_criteria_js__WEBPACK_IMPORTED_MODULE_11__.InterruptableStoppingCriteria),
30512
+ /* harmony export */ JAISLMHeadModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.JAISLMHeadModel),
30513
+ /* harmony export */ JAISModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.JAISModel),
30514
+ /* harmony export */ JAISPreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.JAISPreTrainedModel),
30445
30515
  /* harmony export */ LlamaForCausalLM: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.LlamaForCausalLM),
30446
30516
  /* harmony export */ LlamaModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.LlamaModel),
30447
30517
  /* harmony export */ LlamaPreTrainedModel: () => (/* reexport safe */ _models_js__WEBPACK_IMPORTED_MODULE_2__.LlamaPreTrainedModel),