Spaces:
Running
on
Zero
Running
on
Zero
Dan Bochman
commited on
remove casting to bf16
Browse files
app.py
CHANGED
|
@@ -112,9 +112,7 @@ model.to("cuda")
|
|
| 112 |
|
| 113 |
@spaces.GPU
|
| 114 |
@torch.inference_mode()
|
| 115 |
-
@torch.autocast(device_type="cuda", dtype=torch.bfloat16)
|
| 116 |
def run_model(input_tensor, height, width):
|
| 117 |
-
input_tensor = input_tensor.to(device="cuda", dtype=torch.bfloat16) # explicit cast to bfloat16
|
| 118 |
output = model(input_tensor)
|
| 119 |
output = torch.nn.functional.interpolate(output, size=(height, width), mode="bilinear", align_corners=False)
|
| 120 |
_, preds = torch.max(output, 1)
|
|
|
|
| 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)
|