Spaces:
Sleeping
Sleeping
eljanmahammadli
commited on
Commit
·
28324bf
1
Parent(s):
db6559c
added device support
Browse files
app.py
CHANGED
@@ -2,8 +2,12 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from transformers import pipeline
|
4 |
|
|
|
|
|
5 |
model_name = "eljanmahammadli/AzLlama-152M-Alpaca"
|
6 |
-
model = pipeline("text-generation", model=model_name, torch_dtype=torch.float16)
|
|
|
|
|
7 |
logo_path = "AzLlama-logo.webp"
|
8 |
|
9 |
|
|
|
2 |
import torch
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
6 |
+
print(f"Using device: {device}")
|
7 |
model_name = "eljanmahammadli/AzLlama-152M-Alpaca"
|
8 |
+
model = pipeline("text-generation", model=model_name, torch_dtype=torch.float16).to(
|
9 |
+
device=device
|
10 |
+
)
|
11 |
logo_path = "AzLlama-logo.webp"
|
12 |
|
13 |
|