Create app.py
Browse files
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"])
|