Views
No views yet
npm i @huggingface/transformersonnx-community/moondream2.text_model-ONNX.1import { pipeline } from "@huggingface/transformers";
2
3// Create a text generation pipeline
4const generator = await pipeline(
5 "text-generation",
6 "onnx-community/moondream2.text_model-ONNX",
7 { dtype: "q4" },
8);
9
10// Generate a response
11const text = "Once upon a time";
12const output = await generator(text, { max_new_tokens: 128 });
13console.log(output[0].generated_text);Once upon a time, there was a young girl named Lily who loved to read books. She would spend hours lost in the pages of her favorite stories, imagining herself as the main characters. One day, while reading a book about a magical forest, Lily had an idea. She wanted to create her own magical forest, filled with all the wonders and adventures she had read about in her books.
Lily knew that she needed to gather the right materials to create her magical forest. She decided to use her imagination and creativity to make the forest come to life. She gathered her friends and family to help her, and together they began to build the forestonnx).