hibble commited on
Commit
9850940
·
verified ·
1 Parent(s): a655c4f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import pipeline
3
+
4
+ chat = [
5
+ {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."},
6
+ {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"}
7
+ ]
8
+
9
+ pipeline = pipeline(task="text-generation", model="meta-llama/Meta-Llama-3-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto")
10
+ response = pipeline(chat, max_new_tokens=512)
11
+ print(response[0]["generated_text"][-1]["content"])