web-llm-runner 0.1.12 → 0.1.14

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/lib/index.js CHANGED
@@ -36738,14 +36738,17 @@ class ONNXEngine {
36738
36738
  });
36739
36739
  }
36740
36740
  try {
36741
- // For fallback, we default to text-generation as it is the most common for LLMs
36742
- this.generator = await pipeline('text-generation', repoId, {
36741
+ // For T5 models, text2text-generation is the standard task in transformers.js
36742
+ const task = repoId.toLowerCase().includes("t5") ? "text2text-generation" : "text-generation";
36743
+ this.generator = await pipeline(task, repoId, {
36743
36744
  progress_callback: (p) => {
36744
36745
  if (this.initProgressCallback && (p.status === 'progress' || p.status === 'downloading')) {
36746
+ const pctValue = (typeof p.progress === 'number') ? p.progress : 0;
36747
+ const pctText = ` (${pctValue.toFixed(1)}%)`;
36745
36748
  this.initProgressCallback({
36746
- progress: p.progress / 100,
36749
+ progress: pctValue / 100,
36747
36750
  timeElapsed: 0,
36748
- text: `Downloading ${p.file || 'model files'}...`
36751
+ text: `Downloading ${p.file || 'model weights'}${pctText}...`
36749
36752
  });
36750
36753
  }
36751
36754
  if (p.status === 'ready' && this.initProgressCallback) {