Open junaid-shirur opened 5 months ago
Can you check your network tab to see the which URL it is attempting to access? The error you are seeing is most likely an (1) incorrect WASM version (should be https://cdn.jsdelivr.net/npm/onnxruntime-web@1.14.0/dist/) or (2) it is unable to find the files.
Hope that helps!
Thank you for the response and the suggestion to update the version, @xenova.
I have updated the version as recommended.I checked my network tab,all seems good to me. Here's a screenshot of my network tab for your reference:
Okay good, network traffic looks okay. Have you maybe looked at our sample browser extension/template? https://github.com/xenova/transformers.js/tree/main/examples/extension. Maybe that might assist.
Yes, I haven't cloned the repository, but I did try running the code directly from background.js.
static task:any = 'text-classification';
static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english';
static instance = null;
static async getInstance(progress_callback = null) {
if (this.instance === null) {
this.instance = pipeline(this.task, this.model, { progress_callback });
}
return this.instance;
}
}
// Create generic classify function, which will be reused for the different types of events.
const classify = async (text) => {
// Get the pipeline instance. This will load and build the model when run for the first time.
let model = await PipelineSingleton.getInstance((data) => {
// You can track the progress of the pipeline creation here.
// e.g., you can send `data` back to the UI to indicate a progress bar
console.log('progress', data)
});
// Actually run the model on the input text
let result = await model(text);
return result;
};```
is there anything specific to look for in extension template? that might i missing out
Hey @junaid-shirur , I have exactly the same issue as you. Have you already found a solution?
Hi, facing a similiar issue. I'm getting this error when using xenova through a discord proxy
System Info
"@xenova/transformers": "^2.17.1", node : v20.12.2 npm: 10.5.0 windows 11
Environment/Platform
Description
I encountered an issue when trying to initialize a transformer pipeline using the example provided in the
@xenova/transformers
repository. Below is the code snippet I used:I encountered the following error related to the Content Security Policy (CSP):
Here is my current CSP configuration, modified after a bit of research:
Despite the CSP settings seemingly correct, the WebAssembly module is still not being compiled,. Here are the additional steps and configurations I've tried:
@xenova/transformers
,node_modules
, and updating CSP with CDN domain.All attempts have resulted in the same error. Any assistance or guidance on how to properly configure the CSP or modify the library setup to work would be greatly appreciated.
Reproduction
1: install @xenova/transformers 2: try running example from repository