Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,8 @@ import gradio as gr
|
|
6 |
#Setting device to cuda
|
7 |
torch.set_default_device("cuda")
|
8 |
|
|
|
|
|
9 |
|
10 |
model = "deepapaikar/katzbot-phi2"
|
11 |
|
@@ -23,7 +25,7 @@ def predict_answer(question, token=25):
|
|
23 |
messages = [{"role": "user", "content": f"{question}"}]
|
24 |
|
25 |
|
26 |
-
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
27 |
|
28 |
|
29 |
outputs = pipeline(prompt, max_new_tokens=token, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
|
|
6 |
#Setting device to cuda
|
7 |
torch.set_default_device("cuda")
|
8 |
|
9 |
+
device = 'cuda' if torch.cuda.is_availble() else 'cpu'
|
10 |
+
|
11 |
|
12 |
model = "deepapaikar/katzbot-phi2"
|
13 |
|
|
|
25 |
messages = [{"role": "user", "content": f"{question}"}]
|
26 |
|
27 |
|
28 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True).to(device)
|
29 |
|
30 |
|
31 |
outputs = pipeline(prompt, max_new_tokens=token, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|