Public
Edited
Jan 1, 2024
Insert cell
Insert cell
transformers = import("https://cdn.jsdelivr.net/npm/@xenova/transformers")
Insert cell
generator = await transformers.pipeline(
"text-generation",
"Xenova/TinyLlama-1.1B-Chat-v1.0"
)
Insert cell
messages = [
{ role: "system", content: "You are a friendly assistant." },
{ role: "user", content: "Explain thermodynamics in simple terms." }
]
Insert cell
prompt = generator.tokenizer.apply_chat_template(messages, {
tokenize: false,
add_generation_prompt: true
})
Insert cell
generator(prompt, {
max_new_tokens: 256,
temperature: 0.7,
do_sample: true,
top_k: 50
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more