abrakjamson commited on
Commit
c50cfb4
·
1 Parent(s): f7a1bd4

handle no GPU

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -26,7 +26,8 @@ model = AutoModelForCausalLM.from_pretrained(
26
  )
27
  model = model.to("cuda:0" if torch.cuda.is_available() else "cpu")
28
  print(f"Is CUDA available: {torch.cuda.is_available()}")
29
- print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
 
30
 
31
  model = ControlModel(model, list(range(-5, -18, -1)))
32
 
 
26
  )
27
  model = model.to("cuda:0" if torch.cuda.is_available() else "cpu")
28
  print(f"Is CUDA available: {torch.cuda.is_available()}")
29
+ if torch.cuda.is_available():
30
+ print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")
31
 
32
  model = ControlModel(model, list(range(-5, -18, -1)))
33