tzmtwtr's picture
update
af57887
raw
history blame
435 Bytes
import { env, pipeline } from "@xenova/transformers";
env.localModelPath = __dirname + '/model'
let pipe = null;
const piping = pipeline("feature-extraction", "sentence-transformers/paraphrase-multilingual-mpnet-base-v2", { local_files_only: true, quantized: true }).then(p => { pipe = p; })
export async function embedding_calc(text) {
await piping;
if (pipe) {
return [...(await pipe(text)).data.values()];
}
}