Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading time #731

Open
Oussemamri opened this issue Apr 30, 2024 · 0 comments
Open

loading time #731

Oussemamri opened this issue Apr 30, 2024 · 0 comments

Comments

@Oussemamri
Copy link

@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

image
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant