Dan Bochman commited on
Commit
3a1cfd0
·
unverified ·
1 Parent(s): 05346fa

Update model device to "cuda" after acquiring it with ZERO

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -107,12 +107,12 @@ if not os.path.exists(model_path):
107
 
108
  model = torch.jit.load(model_path)
109
  model.eval()
110
- model.to("cuda")
111
 
112
 
113
  @spaces.GPU
114
  @torch.inference_mode()
115
  def run_model(input_tensor, height, width):
 
116
  output = model(input_tensor)
117
  output = torch.nn.functional.interpolate(output, size=(height, width), mode="bilinear", align_corners=False)
118
  _, preds = torch.max(output, 1)
 
107
 
108
  model = torch.jit.load(model_path)
109
  model.eval()
 
110
 
111
 
112
  @spaces.GPU
113
  @torch.inference_mode()
114
  def run_model(input_tensor, height, width):
115
+ model.to("cuda") # set the device after acquiring it with ZERO
116
  output = model(input_tensor)
117
  output = torch.nn.functional.interpolate(output, size=(height, width), mode="bilinear", align_corners=False)
118
  _, preds = torch.max(output, 1)