@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
@@ -882,7 +882,7 @@ var import_node_fs = __toESM(require("fs"), 1);
882
882
  var import_node_path = __toESM(require("path"), 1);
883
883
  var import_node_url = __toESM(require("url"), 1);
884
884
  var import_meta = {};
885
- var VERSION = "4.0.0-next.2";
885
+ var VERSION = "4.0.0-next.3";
886
886
  var IS_PROCESS_AVAILABLE = typeof process !== "undefined";
887
887
  var IS_NODE_ENV = IS_PROCESS_AVAILABLE && process?.release?.name === "node";
888
888
  var IS_FS_AVAILABLE = !isEmpty(import_node_fs.default);
@@ -7627,7 +7627,7 @@ var uint16_to_float32 = /* @__PURE__ */ (function() {
7627
7627
  // src/backends/onnx.js
7628
7628
  var ONNX_NODE = __toESM(require("onnxruntime-node"), 1);
7629
7629
 
7630
- // ../../node_modules/.pnpm/onnxruntime-web@1.25.0-dev.20260209-a3749f1353/node_modules/onnxruntime-web/dist/ort.webgpu.bundle.min.mjs
7630
+ // ../../node_modules/.pnpm/onnxruntime-web@1.25.0-dev.20260212-1a71a5f46e/node_modules/onnxruntime-web/dist/ort.webgpu.bundle.min.mjs
7631
7631
  var ort_webgpu_bundle_min_exports = {};
7632
7632
  __export(ort_webgpu_bundle_min_exports, {
7633
7633
  InferenceSession: () => nc,
@@ -9597,7 +9597,7 @@ async function is(a = {}) {
9597
9597
  we(`invalid type for getValue: ${t}`);
9598
9598
  }
9599
9599
  }, r.UTF8ToString = ct, r.stringToUTF8 = Pe, r.lengthBytesUTF8 = _e;
9600
- 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) => {
9600
+ 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) => {
9601
9601
  if (r === void 0 || !r.Zc) return 1;
9602
9602
  if ((e = ct(Number(e >>> 0))).startsWith("./") && (e = e.substring(2)), !(e = r.Zc.get(e))) return 2;
9603
9603
  if (t = Number(t >>> 0), n = Number(n >>> 0), o = Number(o >>> 0), t + n > e.byteLength) return 3;
@@ -9617,11 +9617,11 @@ async function is(a = {}) {
9617
9617
  } catch {
9618
9618
  return 4;
9619
9619
  }
9620
- }, 1117652: (e, t, n) => {
9620
+ }, 1118228: (e, t, n) => {
9621
9621
  r.ke(e, (l(), J).subarray(t >>> 0, t + n >>> 0));
9622
- }, 1117716: () => r.Ie(), 1117758: (e) => {
9622
+ }, 1118292: () => r.Ie(), 1118334: (e) => {
9623
9623
  r.je(e);
9624
- }, 1117795: () => typeof wasmOffsetConverter < "u" };
9624
+ }, 1118371: () => typeof wasmOffsetConverter < "u" };
9625
9625
  function lf() {
9626
9626
  return typeof wasmOffsetConverter < "u";
9627
9627
  }
@@ -11549,7 +11549,7 @@ var qs = F(() => {
11549
11549
  ze();
11550
11550
  ze();
11551
11551
  ze();
11552
- var rs = "1.25.0-dev.20260209-a3749f1353";
11552
+ var rs = "1.25.0-dev.20260212-1a71a5f46e";
11553
11553
  var Ol = tn;
11554
11554
  {
11555
11555
  let a = (qs(), Ht(Ys)).wasmBackend;
@@ -23184,7 +23184,7 @@ var PreTrainedModel = class extends Callable2 {
23184
23184
  /**
23185
23185
  *
23186
23186
  * @param {GenerationConfig} generation_config
23187
- * @param {StoppingCriteriaList} [stopping_criteria=null]
23187
+ * @param {import('../generation/stopping_criteria.js').StoppingCriteria|import('../generation/stopping_criteria.js').StoppingCriteria[]|StoppingCriteriaList} [stopping_criteria=null]
23188
23188
  */
23189
23189
  _get_stopping_criteria(generation_config, stopping_criteria = null) {
23190
23190
  const criteria = new StoppingCriteriaList();
@@ -30993,6 +30993,7 @@ var TextStreamer = class extends BaseStreamer {
30993
30993
  this.token_cache = [];
30994
30994
  this.print_len = 0;
30995
30995
  this.next_tokens_are_prompt = true;
30996
+ this.special_ids = new Set(this.tokenizer.all_special_ids.map(BigInt));
30996
30997
  }
30997
30998
  /**
30998
30999
  * Receives tokens, decodes them, and prints them to stdout as soon as they form entire words.
@@ -31009,6 +31010,19 @@ var TextStreamer = class extends BaseStreamer {
31009
31010
  }
31010
31011
  const tokens = value[0];
31011
31012
  this.token_callback_function?.(tokens);
31013
+ if (tokens.length === 1 && this.special_ids.has(tokens[0])) {
31014
+ if (this.decode_kwargs.skip_special_tokens) return;
31015
+ if (this.token_cache.length > 0) {
31016
+ const text2 = this.tokenizer.decode(this.token_cache, this.decode_kwargs);
31017
+ const printable_text2 = text2.slice(this.print_len);
31018
+ this.on_finalized_text(printable_text2, false);
31019
+ this.token_cache = [];
31020
+ this.print_len = 0;
31021
+ }
31022
+ const special_text = this.tokenizer.decode(tokens, this.decode_kwargs);
31023
+ this.on_finalized_text(special_text, false);
31024
+ return;
31025
+ }
31012
31026
  this.token_cache = mergeArrays(this.token_cache, tokens);
31013
31027
  const text = this.tokenizer.decode(this.token_cache, this.decode_kwargs);
31014
31028
  let printable_text;
@@ -32068,7 +32082,7 @@ async function load_video(src, { num_frames = null, fps = null } = {}) {
32068
32082
 
32069
32083
  onnxruntime-web/dist/ort.webgpu.bundle.min.mjs:
32070
32084
  (*!
32071
- * ONNX Runtime Web v1.25.0-dev.20260209-a3749f1353
32085
+ * ONNX Runtime Web v1.25.0-dev.20260212-1a71a5f46e
32072
32086
  * Copyright (c) Microsoft Corporation. All rights reserved.
32073
32087
  * Licensed under the MIT License.
32074
32088
  *)