sparkleman commited on
Commit
dac6105
·
1 Parent(s): 271e92e
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -34,13 +34,12 @@ CONFIG = Config()
34
  import numpy as np
35
  import torch
36
 
37
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
38
 
39
- if device == "cpu" and CONFIG.STRATEGY != "cpu":
40
- logger.info(f"Cuda not found, fall back to cpu")
41
  CONFIG.STRATEGY = "cpu"
42
 
43
- if "cuda" in CONFIG.STRATEGY:
44
  from pynvml import *
45
 
46
  nvmlInit()
 
34
  import numpy as np
35
  import torch
36
 
 
37
 
38
+ if "cuda" in CONFIG.STRATEGY.lower() and not torch.cuda.is_available():
39
+ logger.info(f"CUDA not found, fall back to cpu")
40
  CONFIG.STRATEGY = "cpu"
41
 
42
+ if "cuda" in CONFIG.STRATEGY.lower():
43
  from pynvml import *
44
 
45
  nvmlInit()