Views
No views yet
npm i @huggingface/transformersonnx-community/AMD-OLMo-1B-SFT-DPO".1import { pipeline } from "@huggingface/transformers";
2
3// Create a text generation pipeline
4const generator = await pipeline(
5 "text-generation",
6 "onnx-community/AMD-OLMo-1B-SFT-DPO",
7 { dtype: "q4" },
8);
9
10// Define the list of messages
11const messages = [
12 { role: "system", content: "You are a helpful assistant." },
13 { role: "user", content: "Tell me a joke." },
14];
15
16// Generate a response
17const output = await generator(messages, { max_new_tokens: 128 });
18console.log(output[0].generated_text.at(-1).content);
19// "Why don't scientists trust atoms?\n\nBecause they make up everything!"onnx).