Views
No views yet
npm i @huggingface/transformersonnx-community/MobileLLM-125M.1import { pipeline } from "@huggingface/transformers";
2
3// Create a text generation pipeline
4const generator = await pipeline(
5 "text-generation",
6 "onnx-community/MobileLLM-125M",
7 { dtype: "fp32" },
8);
9
10// Define the list of messages
11const text = "Q: What is the capital of France?\nA: Paris\nQ: What is the capital of England?\nA:";
12
13// Generate a response
14const output = await generator(text, { max_new_tokens: 30 });
15console.log(output[0].generated_text);Q: What is the capital of France?
A: Paris
Q: What is the capital of England?
A: London
Q: What is the capital of Scotland?
A: Edinburgh
Q: What is the capital of Wales?
A: Cardiffonnx).