inoki-giskard commited on
Commit
44ac6bc
1 Parent(s): a89dee4

Add GPU detection before running for logging

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -31,6 +31,20 @@ def read_logs():
31
  except Exception:
32
  return "ML worker not running"
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  previous_url = ""
36
  ml_worker = None
 
31
  except Exception:
32
  return "ML worker not running"
33
 
34
+ def detect_gpu():
35
+ try:
36
+ import torch
37
+ logger.info(f"PyTorch GPU: {torch.cuda.is_available()}")
38
+ except ImportError:
39
+ logger.warn("No PyTorch installed")
40
+
41
+ try:
42
+ import tensorflow as tf
43
+ logger.info(f"Tensorflow GPU: {len(tf.config.list_physical_devices('GPU')) > 0}")
44
+ except ImportError:
45
+ logger.warn("No Tensorflow installed")
46
+
47
+ detect_gpu()
48
 
49
  previous_url = ""
50
  ml_worker = None