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 +7 -4
- package/lib/index.js.map +1 -1
- package/lib/onnx_engine.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -36738,14 +36738,17 @@ class ONNXEngine {
|
|
|
36738
36738
|
});
|
|
36739
36739
|
}
|
|
36740
36740
|
try {
|
|
36741
|
-
// For
|
|
36742
|
-
|
|
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:
|
|
36749
|
+
progress: pctValue / 100,
|
|
36747
36750
|
timeElapsed: 0,
|
|
36748
|
-
text: `Downloading ${p.file || 'model
|
|
36751
|
+
text: `Downloading ${p.file || 'model weights'}${pctText}...`
|
|
36749
36752
|
});
|
|
36750
36753
|
}
|
|
36751
36754
|
if (p.status === 'ready' && this.initProgressCallback) {
|