Views
No views yet

npm i @huggingface/transformers1import { pipeline, TextStreamer } from "@huggingface/transformers";
2
3// Create a text generation pipeline
4const generator = await pipeline(
5 "text-generation",
6 "onnx-community/Falcon-H1-Tiny-90M-Instruct-ONNX",
7 { dtype: "q4", device: "webgpu" },
8);
9
10// Define the list of messages
11const messages = [
12 { role: "user", content: "What's the capital of France?" },
13];
14
15// Generate a response
16const output = await generator(messages, {
17 max_new_tokens: 512,
18 do_sample: false,
19 streamer: new TextStreamer(generator.tokenizer, {
20 skip_prompt: true,
21 skip_special_tokens: true,
22 }),
23});
24console.log(output[0].generated_text.at(-1).content);The capital of France is Paris, which is the largest city in France. It is located in the Province of Orleans-sur-Mer and is known for its architectural beauty and cultural heritage. Paris is famous for its canals, bridges, and the Eiffel Tower, making it a key hub for both art and commerce.@misc{falcon_h1_tiny,
title={Falcon-H1-Tiny: A series of extremely small, yet powerful language models redefining capabilities at small scale},
author={Falcon-LLM Team},
year={2026},
}