Could not locate file model.onnx
harryradford opened this issue · comments
During development, the decoder_model_merged.onnx
and encoder_model.onnx
models are fetched fine from Hugging Face or from my Express server. After building the React app with Create React App, transformers.js is trying to fetch model.onnx
which cannot be found.
Error: Could not locate file: "https://huggingface.co/Xenova/whisper-tiny.en/resolve/output_attentions/onnx/model.onnx".
My pipeline options are { progress_callback, revision: "output_attentions", quantized: false }
. The task is "automatic-speech-recognition" and the model is "Xenova/whisper-tiny.en". @xenova What is model.onnx
?
I believe this is because of create react app, which others have also had problems with. For more information, see xenova/transformers.js#185
Is there a reason you have to use CRA? These days, it is generally not considered to be a good build tool. I recommend Vite instead.
Alternatively, if you are forced to use CRA for some reason, you can import the pre-built version from jsdelivr (or other CDN):
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.4.4';
Switching from CRA to Vite resolved the issue.