@huggingface/transformers 4.0.0-next.2 → 4.0.0-next.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.
Files changed (42) hide show
  1. package/README.md +2 -2
  2. package/dist/ort-wasm-simd-threaded.jsep.mjs +23 -23
  3. package/dist/transformers.js +32 -18
  4. package/dist/transformers.min.js +18 -18
  5. package/dist/transformers.node.cjs +23 -9
  6. package/dist/transformers.node.min.cjs +4 -4
  7. package/dist/transformers.node.min.mjs +4 -4
  8. package/dist/transformers.node.mjs +23 -9
  9. package/dist/transformers.web.js +16 -2
  10. package/dist/transformers.web.min.js +15 -15
  11. package/package.json +2 -2
  12. package/src/env.js +1 -1
  13. package/src/generation/parameters.js +1 -1
  14. package/src/generation/streamers.js +21 -0
  15. package/src/models/modeling_utils.js +1 -1
  16. package/src/pipelines/automatic-speech-recognition.js +1 -1
  17. package/src/pipelines/document-question-answering.js +1 -1
  18. package/src/pipelines/image-to-text.js +2 -2
  19. package/src/pipelines/summarization.js +1 -1
  20. package/src/pipelines/text-generation.js +1 -1
  21. package/src/pipelines/text2text-generation.js +1 -1
  22. package/src/pipelines/translation.js +1 -1
  23. package/types/generation/parameters.d.ts +1 -1
  24. package/types/generation/parameters.d.ts.map +1 -1
  25. package/types/generation/streamers.d.ts +1 -0
  26. package/types/generation/streamers.d.ts.map +1 -1
  27. package/types/models/modeling_utils.d.ts +2 -2
  28. package/types/models/modeling_utils.d.ts.map +1 -1
  29. package/types/pipelines/automatic-speech-recognition.d.ts +2 -2
  30. package/types/pipelines/automatic-speech-recognition.d.ts.map +1 -1
  31. package/types/pipelines/document-question-answering.d.ts +2 -2
  32. package/types/pipelines/document-question-answering.d.ts.map +1 -1
  33. package/types/pipelines/image-to-text.d.ts +4 -4
  34. package/types/pipelines/image-to-text.d.ts.map +1 -1
  35. package/types/pipelines/summarization.d.ts +2 -2
  36. package/types/pipelines/summarization.d.ts.map +1 -1
  37. package/types/pipelines/text-generation.d.ts +2 -2
  38. package/types/pipelines/text-generation.d.ts.map +1 -1
  39. package/types/pipelines/text2text-generation.d.ts +3 -3
  40. package/types/pipelines/text2text-generation.d.ts.map +1 -1
  41. package/types/pipelines/translation.d.ts +2 -2
  42. package/types/pipelines/translation.d.ts.map +1 -1
@@ -14,7 +14,7 @@ var __export = (target, all) => {
14
14
  import fs from "fs";
15
15
  import path from "path";
16
16
  import url from "url";
17
- var VERSION = "4.0.0-next.2";
17
+ var VERSION = "4.0.0-next.3";
18
18
  var IS_PROCESS_AVAILABLE = typeof process !== "undefined";
19
19
  var IS_NODE_ENV = IS_PROCESS_AVAILABLE && process?.release?.name === "node";
20
20
  var IS_FS_AVAILABLE = !isEmpty(fs);
@@ -6759,7 +6759,7 @@ var uint16_to_float32 = /* @__PURE__ */ (function() {
6759
6759
  // src/backends/onnx.js
6760
6760
  import * as ONNX_NODE from "onnxruntime-node";
6761
6761
 
6762
- // ../../node_modules/.pnpm/onnxruntime-web@1.25.0-dev.20260209-a3749f1353/node_modules/onnxruntime-web/dist/ort.webgpu.bundle.min.mjs
6762
+ // ../../node_modules/.pnpm/onnxruntime-web@1.25.0-dev.20260212-1a71a5f46e/node_modules/onnxruntime-web/dist/ort.webgpu.bundle.min.mjs
6763
6763
  var ort_webgpu_bundle_min_exports = {};
6764
6764
  __export(ort_webgpu_bundle_min_exports, {
6765
6765
  InferenceSession: () => nc,
@@ -8728,7 +8728,7 @@ async function is(a = {}) {
8728
8728
  we(`invalid type for getValue: ${t}`);
8729
8729
  }
8730
8730
  }, r.UTF8ToString = ct, r.stringToUTF8 = Pe, r.lengthBytesUTF8 = _e;
8731
- var bo, wo, Rr, $t, Te, mt, go, To, vo, Eo, So, Ao, Io, xo, Lo, Oo, Bo, Nr, Wr, kr, Fr, Et, Gr, Mo, $r, Uo, Co, Do, zr, Po, _o, Vr, k, St, Ro, C, zt, D, No, Hr, Wo, ko, Fo, jr, Go, $o, zo, Vo, Ho, jo, Yo, qo, Jo, Xo, Zo, Ko, Qo, ea, ta, ra, na, oa, aa, sa, ia, ua, fa, ca, da, la, pa, ma, ha, ya, ba, wa, ga, Ta, va, Ea, Sa, Aa, Ia, xa, Ne, df = [Ye, gr, In, Mn, Un, Cn, Dn, Pn, _n, Rn, Nn, Wn, kn, Fn, Gn, $n, eo, to, ro, co, lo, po, mo, ho, yo], Yr = { 1116828: (e, t, n, o, u) => {
8731
+ var bo, wo, Rr, $t, Te, mt, go, To, vo, Eo, So, Ao, Io, xo, Lo, Oo, Bo, Nr, Wr, kr, Fr, Et, Gr, Mo, $r, Uo, Co, Do, zr, Po, _o, Vr, k, St, Ro, C, zt, D, No, Hr, Wo, ko, Fo, jr, Go, $o, zo, Vo, Ho, jo, Yo, qo, Jo, Xo, Zo, Ko, Qo, ea, ta, ra, na, oa, aa, sa, ia, ua, fa, ca, da, la, pa, ma, ha, ya, ba, wa, ga, Ta, va, Ea, Sa, Aa, Ia, xa, Ne, df = [Ye, gr, In, Mn, Un, Cn, Dn, Pn, _n, Rn, Nn, Wn, kn, Fn, Gn, $n, eo, to, ro, co, lo, po, mo, ho, yo], Yr = { 1117404: (e, t, n, o, u) => {
8732
8732
  if (r === void 0 || !r.Zc) return 1;
8733
8733
  if ((e = ct(Number(e >>> 0))).startsWith("./") && (e = e.substring(2)), !(e = r.Zc.get(e))) return 2;
8734
8734
  if (t = Number(t >>> 0), n = Number(n >>> 0), o = Number(o >>> 0), t + n > e.byteLength) return 3;
@@ -8748,11 +8748,11 @@ async function is(a = {}) {
8748
8748
  } catch {
8749
8749
  return 4;
8750
8750
  }
8751
- }, 1117652: (e, t, n) => {
8751
+ }, 1118228: (e, t, n) => {
8752
8752
  r.ke(e, (l(), J).subarray(t >>> 0, t + n >>> 0));
8753
- }, 1117716: () => r.Ie(), 1117758: (e) => {
8753
+ }, 1118292: () => r.Ie(), 1118334: (e) => {
8754
8754
  r.je(e);
8755
- }, 1117795: () => typeof wasmOffsetConverter < "u" };
8755
+ }, 1118371: () => typeof wasmOffsetConverter < "u" };
8756
8756
  function lf() {
8757
8757
  return typeof wasmOffsetConverter < "u";
8758
8758
  }
@@ -10680,7 +10680,7 @@ var qs = F(() => {
10680
10680
  ze();
10681
10681
  ze();
10682
10682
  ze();
10683
- var rs = "1.25.0-dev.20260209-a3749f1353";
10683
+ var rs = "1.25.0-dev.20260212-1a71a5f46e";
10684
10684
  var Ol = tn;
10685
10685
  {
10686
10686
  let a = (qs(), Ht(Ys)).wasmBackend;
@@ -22314,7 +22314,7 @@ var PreTrainedModel = class extends Callable2 {
22314
22314
  /**
22315
22315
  *
22316
22316
  * @param {GenerationConfig} generation_config
22317
- * @param {StoppingCriteriaList} [stopping_criteria=null]
22317
+ * @param {import('../generation/stopping_criteria.js').StoppingCriteria|import('../generation/stopping_criteria.js').StoppingCriteria[]|StoppingCriteriaList} [stopping_criteria=null]
22318
22318
  */
22319
22319
  _get_stopping_criteria(generation_config, stopping_criteria = null) {
22320
22320
  const criteria = new StoppingCriteriaList();
@@ -30123,6 +30123,7 @@ var TextStreamer = class extends BaseStreamer {
30123
30123
  this.token_cache = [];
30124
30124
  this.print_len = 0;
30125
30125
  this.next_tokens_are_prompt = true;
30126
+ this.special_ids = new Set(this.tokenizer.all_special_ids.map(BigInt));
30126
30127
  }
30127
30128
  /**
30128
30129
  * Receives tokens, decodes them, and prints them to stdout as soon as they form entire words.
@@ -30139,6 +30140,19 @@ var TextStreamer = class extends BaseStreamer {
30139
30140
  }
30140
30141
  const tokens = value[0];
30141
30142
  this.token_callback_function?.(tokens);
30143
+ if (tokens.length === 1 && this.special_ids.has(tokens[0])) {
30144
+ if (this.decode_kwargs.skip_special_tokens) return;
30145
+ if (this.token_cache.length > 0) {
30146
+ const text2 = this.tokenizer.decode(this.token_cache, this.decode_kwargs);
30147
+ const printable_text2 = text2.slice(this.print_len);
30148
+ this.on_finalized_text(printable_text2, false);
30149
+ this.token_cache = [];
30150
+ this.print_len = 0;
30151
+ }
30152
+ const special_text = this.tokenizer.decode(tokens, this.decode_kwargs);
30153
+ this.on_finalized_text(special_text, false);
30154
+ return;
30155
+ }
30142
30156
  this.token_cache = mergeArrays(this.token_cache, tokens);
30143
30157
  const text = this.tokenizer.decode(this.token_cache, this.decode_kwargs);
30144
30158
  let printable_text;
@@ -31197,7 +31211,7 @@ export {
31197
31211
 
31198
31212
  onnxruntime-web/dist/ort.webgpu.bundle.min.mjs:
31199
31213
  (*!
31200
- * ONNX Runtime Web v1.25.0-dev.20260209-a3749f1353
31214
+ * ONNX Runtime Web v1.25.0-dev.20260212-1a71a5f46e
31201
31215
  * Copyright (c) Microsoft Corporation. All rights reserved.
31202
31216
  * Licensed under the MIT License.
31203
31217
  *)
@@ -17,7 +17,7 @@ var emptyObj3 = {};
17
17
  var node_url_default = emptyObj3;
18
18
 
19
19
  // src/env.js
20
- var VERSION = "4.0.0-next.2";
20
+ var VERSION = "4.0.0-next.3";
21
21
  var IS_PROCESS_AVAILABLE = typeof process !== "undefined";
22
22
  var IS_NODE_ENV = IS_PROCESS_AVAILABLE && process?.release?.name === "node";
23
23
  var IS_FS_AVAILABLE = !isEmpty(node_fs_default);
@@ -18414,7 +18414,7 @@ var PreTrainedModel = class extends Callable2 {
18414
18414
  /**
18415
18415
  *
18416
18416
  * @param {GenerationConfig} generation_config
18417
- * @param {StoppingCriteriaList} [stopping_criteria=null]
18417
+ * @param {import('../generation/stopping_criteria.js').StoppingCriteria|import('../generation/stopping_criteria.js').StoppingCriteria[]|StoppingCriteriaList} [stopping_criteria=null]
18418
18418
  */
18419
18419
  _get_stopping_criteria(generation_config, stopping_criteria = null) {
18420
18420
  const criteria = new StoppingCriteriaList();
@@ -26223,6 +26223,7 @@ var TextStreamer = class extends BaseStreamer {
26223
26223
  this.token_cache = [];
26224
26224
  this.print_len = 0;
26225
26225
  this.next_tokens_are_prompt = true;
26226
+ this.special_ids = new Set(this.tokenizer.all_special_ids.map(BigInt));
26226
26227
  }
26227
26228
  /**
26228
26229
  * Receives tokens, decodes them, and prints them to stdout as soon as they form entire words.
@@ -26239,6 +26240,19 @@ var TextStreamer = class extends BaseStreamer {
26239
26240
  }
26240
26241
  const tokens = value[0];
26241
26242
  this.token_callback_function?.(tokens);
26243
+ if (tokens.length === 1 && this.special_ids.has(tokens[0])) {
26244
+ if (this.decode_kwargs.skip_special_tokens) return;
26245
+ if (this.token_cache.length > 0) {
26246
+ const text2 = this.tokenizer.decode(this.token_cache, this.decode_kwargs);
26247
+ const printable_text2 = text2.slice(this.print_len);
26248
+ this.on_finalized_text(printable_text2, false);
26249
+ this.token_cache = [];
26250
+ this.print_len = 0;
26251
+ }
26252
+ const special_text = this.tokenizer.decode(tokens, this.decode_kwargs);
26253
+ this.on_finalized_text(special_text, false);
26254
+ return;
26255
+ }
26242
26256
  this.token_cache = mergeArrays(this.token_cache, tokens);
26243
26257
  const text = this.tokenizer.decode(this.token_cache, this.decode_kwargs);
26244
26258
  let printable_text;