play7284 commited on
Commit
92f1d91
1 Parent(s): 7b700dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -1,3 +1,19 @@
1
- import gradio as gr
 
2
 
3
- gr.load("models/meta-llama/Llama-3.2-1B").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import pipeline
3
 
4
+ model_id = "meta-llama/Llama-3.2-1B-Instruct"
5
+ pipe = pipeline(
6
+ "text-generation",
7
+ model=model_id,
8
+ torch_dtype=torch.bfloat16,
9
+ device_map="auto",
10
+ )
11
+ messages = [
12
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
13
+ {"role": "user", "content": "Who are you?"},
14
+ ]
15
+ outputs = pipe(
16
+ messages,
17
+ max_new_tokens=256,
18
+ )
19
+ print(outputs[0]["generated_text"][-1])