Anton Bushuiev commited on
Commit
f44e701
·
1 Parent(s): e54fd6f

load to cpu first

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -394,17 +394,18 @@ def update_plot(dropdown, dropdown_choices_to_plot_args):
394
 
395
 
396
  # Set device
397
- device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
398
- # device = torch.device('cuda')
399
 
400
  # Load models
401
  models = [
402
  DDGPPIformer.load_from_checkpoint(
403
  PPIFORMER_WEIGHTS_DIR / f'ddg_regression/{i}.ckpt',
404
- map_location=device
405
  ).eval()
406
  for i in range(3)
407
  ]
 
408
 
409
 
410
  app = gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="pink"))
 
394
 
395
 
396
  # Set device
397
+ # device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
398
+ device = 'cuda' if torch.cuda.is_available() else 'cpu'
399
 
400
  # Load models
401
  models = [
402
  DDGPPIformer.load_from_checkpoint(
403
  PPIFORMER_WEIGHTS_DIR / f'ddg_regression/{i}.ckpt',
404
+ map_location=torch.device('cpu')
405
  ).eval()
406
  for i in range(3)
407
  ]
408
+ models = [model.to(device) for model in models]
409
 
410
 
411
  app = gr.Blocks(theme=gr.themes.Default(primary_hue="green", secondary_hue="pink"))