@huggingface/transformers 3.5.1 → 3.5.2

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.
@@ -4346,7 +4346,7 @@ __webpack_require__.r(__webpack_exports__);
4346
4346
 
4347
4347
 
4348
4348
 
4349
- const VERSION = '3.5.1';
4349
+ const VERSION = '3.5.2';
4350
4350
 
4351
4351
  // Check if various APIs are available (depends on environment)
4352
4352
  const IS_BROWSER_ENV = typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -4575,7 +4575,7 @@ class GenerationConfig {
4575
4575
 
4576
4576
  /**
4577
4577
  * Number of groups to divide `num_beams` into in order to ensure diversity among different groups of beams.
4578
- * See [this paper](https://arxiv.org/pdf/1610.02424.pdf) for more details.
4578
+ * See [this paper](https://huggingface.co/papers/1610.02424) for more details.
4579
4579
  * @type {number}
4580
4580
  * @default 1
4581
4581
  */
@@ -4620,7 +4620,7 @@ class GenerationConfig {
4620
4620
  /**
4621
4621
  * Local typicality measures how similar the conditional probability of predicting a target token next is to the expected conditional probability of predicting a random token next, given the partial text already generated.
4622
4622
  * If set to float < 1, the smallest set of the most locally typical tokens with probabilities that add up to `typical_p` or higher are kept for generation.
4623
- * See [this paper](https://arxiv.org/pdf/2202.00666.pdf) for more details.
4623
+ * See [this paper](https://huggingface.co/papers/2202.00666) for more details.
4624
4624
  * @type {number}
4625
4625
  * @default 1.0
4626
4626
  */
@@ -4629,7 +4629,7 @@ class GenerationConfig {
4629
4629
  /**
4630
4630
  * If set to float strictly between 0 and 1, only tokens with a conditional probability greater than `epsilon_cutoff` will be sampled.
4631
4631
  * In the paper, suggested values range from 3e-4 to 9e-4, depending on the size of the model.
4632
- * See [Truncation Sampling as Language Model Desmoothing](https://arxiv.org/abs/2210.15191) for more details.
4632
+ * See [Truncation Sampling as Language Model Desmoothing](https://huggingface.co/papers/2210.15191) for more details.
4633
4633
  * @type {number}
4634
4634
  * @default 0.0
4635
4635
  */
@@ -4639,7 +4639,7 @@ class GenerationConfig {
4639
4639
  * Eta sampling is a hybrid of locally typical sampling and epsilon sampling.
4640
4640
  * If set to float strictly between 0 and 1, a token is only considered if it is greater than either `eta_cutoff` or `sqrt(eta_cutoff) * exp(-entropy(softmax(next_token_logits)))`.
4641
4641
  * The latter term is intuitively the expected next token probability, scaled by `sqrt(eta_cutoff)`. In the paper, suggested values range from 3e-4 to 2e-3, depending on the size of the model.
4642
- * See [Truncation Sampling as Language Model Desmoothing](https://arxiv.org/abs/2210.15191) for more details.
4642
+ * See [Truncation Sampling as Language Model Desmoothing](https://huggingface.co/papers/2210.15191) for more details.
4643
4643
  * @type {number}
4644
4644
  * @default 0.0
4645
4645
  */
@@ -4655,7 +4655,7 @@ class GenerationConfig {
4655
4655
 
4656
4656
  /**
4657
4657
  * The parameter for repetition penalty. 1.0 means no penalty.
4658
- * See [this paper](https://arxiv.org/pdf/1909.05858.pdf) for more details.
4658
+ * See [this paper](https://huggingface.co/papers/1909.05858) for more details.
4659
4659
  * @type {number}
4660
4660
  * @default 1.0
4661
4661
  */
@@ -5328,7 +5328,7 @@ class NoRepeatNGramLogitsProcessor extends LogitsProcessor {
5328
5328
  * This penalty is applied at most once per token. Note that, for decoder-only models like most LLMs,
5329
5329
  * the considered tokens include the prompt.
5330
5330
  *
5331
- * In the original [paper](https://arxiv.org/pdf/1909.05858.pdf), the authors suggest the use of a
5331
+ * In the original [paper](https://huggingface.co/papers/1909.05858), the authors suggest the use of a
5332
5332
  * penalty of around 1.2 to achieve a good balance between truthful generation and lack of repetition.
5333
5333
  * To penalize and reduce repetition, use `penalty` values above 1.0, where a higher value penalizes
5334
5334
  * more strongly. To reward and encourage repetition, use `penalty` values between 0.0 and 1.0, where
@@ -5498,7 +5498,7 @@ class NoBadWordsLogitsProcessor extends LogitsProcessor {
5498
5498
  * correspond to the unconditional logits (predicted from an empty or 'null' prompt). The processor computes a
5499
5499
  * weighted average across the conditional and unconditional logits, parameterised by the `guidance_scale`.
5500
5500
  *
5501
- * See [the paper](https://arxiv.org/abs/2306.05284) for more information.
5501
+ * See [the paper](https://huggingface.co/papers/2306.05284) for more information.
5502
5502
  */
5503
5503
  class ClassifierFreeGuidanceLogitsProcessor extends LogitsProcessor {
5504
5504
 
@@ -6265,7 +6265,11 @@ class WhisperTextStreamer extends TextStreamer {
6265
6265
  this.on_chunk_start?.(time);
6266
6266
  }
6267
6267
  this.waiting_for_timestamp = !this.waiting_for_timestamp; // Toggle
6268
- value = [[]]; // Skip timestamp
6268
+
6269
+ // NOTE: Timestamp tokens should not be printed. Although, since they
6270
+ // aren't classified as "special tokens", we need to handle them here.
6271
+ this.token_callback_function?.(tokens);
6272
+ return;
6269
6273
  }
6270
6274
  }
6271
6275
  return super.put(value);
@@ -13847,7 +13851,7 @@ class DecisionTransformerPreTrainedModel extends PreTrainedModel { }
13847
13851
 
13848
13852
  /**
13849
13853
  * The model builds upon the GPT2 architecture to perform autoregressive prediction of actions in an offline RL setting.
13850
- * Refer to the paper for more details: https://arxiv.org/abs/2106.01345
13854
+ * Refer to the paper for more details: https://huggingface.co/papers/2106.01345
13851
13855
  */
13852
13856
  class DecisionTransformerModel extends DecisionTransformerPreTrainedModel { }
13853
13857
 
@@ -22267,7 +22271,7 @@ class AutomaticSpeechRecognitionPipeline extends (/** @type {new (options: TextA
22267
22271
  for (const aud of preparedAudios) {
22268
22272
  const inputs = await this.processor(aud);
22269
22273
 
22270
- // According to the [paper](https://arxiv.org/pdf/2410.15608):
22274
+ // According to the [paper](https://huggingface.co/papers/2410.15608):
22271
22275
  // "We use greedy decoding, with a heuristic limit of 6 output tokens
22272
22276
  // per second of audio to avoid repeated output sequences."
22273
22277
  const max_new_tokens = Math.floor(aud.length / sampling_rate) * 6;
@@ -24303,15 +24307,19 @@ class TokenizerModel extends _utils_generic_js__WEBPACK_IMPORTED_MODULE_0__.Call
24303
24307
  return new BPE(config);
24304
24308
 
24305
24309
  default:
24306
- // Some older tokenizers, like `google-t5/t5-small` and `distilbert/distilbert-base-uncased`, do not have a `type` field.
24310
+ // Some older tokenizers, like `google-t5/t5-small`, `openai-community/gpt2`, and `distilbert/distilbert-base-uncased`, do not have a `type` field.
24307
24311
  // In this case, we can infer the tokenizer type based on the structure of the `vocab` field and other properties.
24308
24312
  if (config.vocab) {
24309
24313
  if (Array.isArray(config.vocab)) {
24310
24314
  // config.vocab is of type `[string, number][]`
24311
24315
  // @ts-ignore
24312
24316
  return new Unigram(config, ...args);
24313
- } else if (typeof config.vocab === 'object' && config.continuing_subword_prefix && config.unk_token) {
24314
- return new WordPieceTokenizer(config);
24317
+ } else if (Object.hasOwn(config, 'continuing_subword_prefix') && Object.hasOwn(config, 'unk_token')) {
24318
+ if (Object.hasOwn(config, 'merges')) {
24319
+ return new BPE(config);
24320
+ } else {
24321
+ return new WordPieceTokenizer(config);
24322
+ }
24315
24323
  } else {
24316
24324
  // @ts-ignore
24317
24325
  return new LegacyTokenizerModel(config, ...args);
@@ -27452,7 +27460,7 @@ function _build_translation_inputs(self, raw_inputs, tokenizer_options, generate
27452
27460
  * between any pair of 200+ languages — including low-resource languages like Asturian,
27453
27461
  * Luganda, Urdu and more. It aims to help people communicate with anyone, anywhere,
27454
27462
  * regardless of their language preferences. For more information, check out their
27455
- * [paper](https://arxiv.org/abs/2207.04672).
27463
+ * [paper](https://huggingface.co/papers/2207.04672).
27456
27464
  *
27457
27465
  * For a list of supported languages (along with their language codes),
27458
27466
  * @see {@link https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200}
@@ -27483,7 +27491,7 @@ class NllbTokenizer extends PreTrainedTokenizer {
27483
27491
  * The M2M100Tokenizer class is used to tokenize text for M2M100 ("Many-to-Many") models.
27484
27492
  *
27485
27493
  * M2M100 is a multilingual encoder-decoder (seq-to-seq) model trained for Many-to-Many
27486
- * multilingual translation. It was introduced in this [paper](https://arxiv.org/abs/2010.11125)
27494
+ * multilingual translation. It was introduced in this [paper](https://huggingface.co/papers/2010.11125)
27487
27495
  * and first released in [this](https://github.com/pytorch/fairseq/tree/master/examples/m2m_100) repository.
27488
27496
  *
27489
27497
  * For a list of supported languages (along with their language codes),
@@ -35677,6 +35685,14 @@ __webpack_require__.r(__webpack_exports__);
35677
35685
 
35678
35686
 
35679
35687
 
35688
+
35689
+ // Expose common types used across the library for developers to access
35690
+ /**
35691
+ * @typedef {import('./utils/hub.js').PretrainedModelOptions} PretrainedModelOptions
35692
+ * @typedef {import('./base/processing_utils.js').PretrainedProcessorOptions} PretrainedProcessorOptions
35693
+ * @typedef {import('./utils/dtypes.js').DataType} DataType
35694
+ * @typedef {import('./utils/devices.js').DeviceType} DeviceType
35695
+ */
35680
35696
 
35681
35697
  })();
35682
35698