Spaces:
Running
on
Zero
Running
on
Zero
Dan Bochman
commited on
Update model device to "cuda" after acquiring it with ZERO
Browse files
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)
|