mfrashad commited on
Commit
d415739
1 Parent(s): 933de75

Use CPU if no GPU

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. requirements.txt +1 -1
app.py CHANGED
@@ -32,9 +32,10 @@ config = Config(
32
  use_w=True,
33
  batch_size=5_000, # style layer quite small
34
  )
 
35
 
36
  inst = get_instrumented_model(config.model, config.output_class,
37
- config.layer, torch.device('cuda'), use_w=config.use_w)
38
 
39
  path_to_components = get_or_compute(config, inst)
40
 
 
32
  use_w=True,
33
  batch_size=5_000, # style layer quite small
34
  )
35
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
36
 
37
  inst = get_instrumented_model(config.model, config.output_class,
38
+ config.layer, torch.device(device), use_w=config.use_w)
39
 
40
  path_to_components = get_or_compute(config, inst)
41
 
requirements.txt CHANGED
@@ -8,5 +8,5 @@ torchvision==0.10.0
8
  torchtext==0.10.0
9
  scikit_learn==1.0
10
  scikit-image==0.18.3
11
- tqdm==4.49.0
12
  gdown
 
8
  torchtext==0.10.0
9
  scikit_learn==1.0
10
  scikit-image==0.18.3
11
+ tqdm
12
  gdown