Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,12 @@ model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it",
|
|
13 |
tok = AutoTokenizer.from_pretrained("google/gemma-2b-it",token=token)
|
14 |
# using CUDA for an optimal experience
|
15 |
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
model = model.to(device)
|
18 |
|
19 |
|
|
|
13 |
tok = AutoTokenizer.from_pretrained("google/gemma-2b-it",token=token)
|
14 |
# using CUDA for an optimal experience
|
15 |
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
16 |
+
if torch.cuda.is_available():
|
17 |
+
device = torch.device('cuda')
|
18 |
+
print(f"Using GPU: {torch.cuda.get_device_name(device)}")
|
19 |
+
else:
|
20 |
+
device = torch.device('cpu')
|
21 |
+
print("Using CPU")
|
22 |
model = model.to(device)
|
23 |
|
24 |
|