It looks like a bug or I can’t get it why it fails.
Running script with Vite just generates output of array with generated text:
"<extra_id_0>”
Here’s the code script with selecting dtype q4:
import { pipeline } from '@huggingface/transformers';
const generator = await pipeline('text2text-generation', 'Xenova/mt5-small', {dtype:"q4"});
const text = 'Once upon a time';
const output = await generator(text);
console.log(output)
And that’s the error :
Uncaught Error: Could not locate file: "https://huggingface.co/Xenova/mt5-small/resolve/main/onnx/decoder_model_merged_q4.onnx".
Running script without setting dtype in node.js results:
dtype not specified for "encoder_model". Using the default dtype (fp32) for this device (cpu).
dtype not specified for "decoder_model_merged". Using the default dtype (fp32) for this device (cpu).
C:\Users\user\Desktop\ML TEST\node_modules\onnxruntime-node\dist\backend.js:25
__classPrivateFieldGet(this, _OnnxruntimeSessionHandler_inferenceSession, "f").loadModel(pathOrBuffer, options);
^
Error: Load model from C:\Users\user\Desktop\ML TEST\node_modules\@huggingface\transformers\.cache\Xenova\mt5-small\onnx\encoder_model.onnx failed:Protobuf parsing failed.
at new OnnxruntimeSessionHandler (C:\Users\user\Desktop\ML TEST\node_modules\onnxruntime-node\dist\backend.js:25:92)
at Immediate.<anonymous> (C:\Users\user\Desktop\ML TEST\node_modules\onnxruntime-node\dist\backend.js:67:29)
at process.processImmediate (node:internal/timers:485:21)