xenova / whisper-web

ML-powered speech recognition directly in your browser
https://hf.co/spaces/Xenova/whisper-web
MIT License
1.29k stars 152 forks source link

Could not locate file model.onnx #15

Closed harryradford closed 11 months ago

harryradford commented 11 months ago

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".

image

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?

xenova commented 11 months ago

I believe this is because of create react app, which others have also had problems with. For more information, see https://github.com/xenova/transformers.js/issues/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';
harryradford commented 11 months ago

Switching from CRA to Vite resolved the issue.