-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Question
Background
I have developed a chrome extension which is followed by the example. The example was used the package @xenova/transformers.
Motivation
It seems that multithreads is work now. Issue Issue2
Question
I change the package from @xenova/transformers@2.17.2 to @huggingface/transformers@3.4.1. It shows a error TypeError: sharp__WEBPACK_IMPORTED_MODULE_4__ is not a function which have no been shown before. Anyone can help?
Code (background.js)
// import { pipeline, env } from '@xenova/transformers';
// env.localModelPath = './';
// env.allowRemoteModels = false;
// env.backends.onnx.wasm.numThreads = 1;
import { env, pipeline } from '@huggingface/transformers';
env.localModelPath = './';
class ImagePipelineSingleton {
static task = 'image-classification';
static model = '/deepfake/';
static instance = null;
static async getInstance() {
try {
if (this.instance === null) {
this.instance = await pipeline(this.task, this.model);
}
} catch (error) {
console.error("Initialization error:", error);
}
return this.instance;
}
}
...
try{
let model = await ImagePipelineSingleton.getInstance();
let classification = await model(url);
}catch (error) {
console.error("image processing error:", error); //error here
}
...
Folder Structure
- deepfake
- onnx
- model_quantized.onnx
- onnx
aungKhantPaing and karan-garg
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested