onnx-community/Llama-3.2-1B-Instruct-q4f16 · Hugging Face

PHOTO EMBED

Sat Jul 05 2025 23:20:35 GMT+0000 (Coordinated Universal Time)

Saved by @Shookthadev999

import { pipeline } from '@huggingface/transformers';

// Create a text generation pipeline
const generator = await pipeline('text-generation', 'onnx-community/Llama-3.2-1B-Instruct-q4f16', {
  device: 'webgpu', // <- Run on WebGPU
});

// Define the list of messages
const messages = [
  { role: "system", content: "You are a helpful assistant." },
  { role: "user", content: "What is the capital of France?" },
];

// Generate a response
const output = await generator(messages, { max_new_tokens: 128 });
console.log(output[0].generated_text.at(-1).content);
content_copyCOPY

https://huggingface.co/onnx-community/Llama-3.2-1B-Instruct-q4f16