loading time
Opened this issue · 0 comments
Oussemamri commented
@get(':id/text')
async getText(@param('id') id: string): Promise {
try {
const doc = await this.documentModel.findById(id).exec();
let TransformersApi = Function('return import("@xenova/transformers")')();
const insets: any = doc.data;
// Log the insets to see its structure
console.log("Insets:", insets);
// Access the 'ops' array if it exists
const ops = insets.ops || [];
let concatenatedText = '';
for (const op of ops) {
concatenatedText += op.insert;
}
console.log(concatenatedText);
const { pipeline, env } = await TransformersApi;
env.allowRemoteModels = false;
env.localModelPath = 'C:\Users\haithem\Desktop\node\COLLABORABACK\node_modules\@xenova\transformers\src\models.js';
const pipe = await pipeline("summarization");
const result = await pipe(concatenatedText,{max_length: 30});
console.log("result",result);
console.log("oussema")
return result;
} catch (error) {
console.error("Error in getText:", error);
throw error; // Handle the error appropriately
}
}
the methode take to much time to load and i got message in the console that keep spamming
2024-04-30 14:55:19.3268747 [W:onnxruntime:, graph.cc:3490 onnxruntime::Graph::CleanUnusedInitializersAndNodeArgs] Removing initializer '/model/decoder/embed_positions/Shape_output_0'. It is not used by any node and should be removed from the model.