SebastianItamari commited on
Commit
123ddf9
·
verified ·
1 Parent(s): 4f0ed48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -1,13 +1,19 @@
1
  import torch
2
  from transformers import pipeline
3
 
4
- model_id = "meta-llama/Llama-3.2-1B"
5
-
6
  pipe = pipeline(
7
- "text-generation",
8
- model=model_id,
9
- torch_dtype=torch.bfloat16,
10
- device_map="auto"
11
  )
12
-
13
- pipe("You are a pirate chatbot who always responds in english, how are you?")
 
 
 
 
 
 
 
 
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])