Views
No views yet
transformers and with the original llama codebase.transformers >= 4.43.0 onward, you can run conversational inference using the Transformers pipeline abstraction or by leveraging the Auto classes with the generate() function.pip install --upgrade transformers.1import torch
2from transformers import pipeline
3
4model_id = "meta-llama/Llama-3.2-3B-Instruct"
5pipe = pipeline(
6 "text-generation",
7 model=model_id,
8 torch_dtype=torch.bfloat16,
9 device_map="auto",
10)
11messages = [
12 {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
13 {"role": "user", "content": "Who are you?"},
14]
15outputs = pipe(
16 messages,
17 max_new_tokens=256,
18)
19print(outputs[0]["generated_text"][-1])torch.compile(), assisted generations, quantised and more at huggingface-llama-recipesllamahuggingface-cli:huggingface-cli download meta-llama/Llama-3.2-3B-Instruct --include "original/*" --local-dir Llama-3.2-3B-Instruct