eswardivi commited on
Commit
64d8a64
1 Parent(s): 44d2b59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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
- device = torch.device('cuda')
 
 
 
 
 
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