@omnimedia/omnitool
Version:
open source video processing tools
24 lines • 786 B
JavaScript
//@ts-ignore
import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.0/dist/transformers.min.js";
export class PipelineFactory {
task;
instance = null;
model = null;
constructor(task) {
this.task = task;
}
async createInstance(model, progressCallback) {
this.model = model;
return this.instance = await pipeline(this.task, this.model, {
dtype: {
encoder_model: this.model === "onnx-community/whisper-large-v3-turbo"
? "fp16"
: "fp32",
decoder_model_merged: "q4",
},
device: "webgpu",
progress_callback: progressCallback,
});
}
}
//# sourceMappingURL=transformer-pipeline.js.map