Spaces:
Running on Zero
Running on Zero
Commit ·
2ae8744
1
Parent(s): 142a3fb
Match reference inference dtype handling, drop autocast
Browse filesReference script (scripts/inference_detailgen3d.py) casts surface to
model dtype and runs inference without autocast. app.py was leaving
surface as float32 while the pipeline is bfloat16, then wrapping the
call in @torch .autocast(device_type=cuda) which defaults to fp16 — the
fp32/bf16/fp16 mismatch surfaces as torch.AcceleratorError on the GPU
matmul. Mirror the reference: cast surface to (DEVICE, DTYPE) and drop
the autocast decorators.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
app.py
CHANGED
|
@@ -97,12 +97,11 @@ def load_mesh(mesh_path, num_pc=20480):
|
|
| 97 |
ind = rng.choice(surface.shape[0], num_pc, replace=False)
|
| 98 |
surface = torch.FloatTensor(surface[ind])
|
| 99 |
normal = torch.FloatTensor(normal[ind])
|
| 100 |
-
surface = torch.cat([surface, normal], dim=-1).unsqueeze(0).
|
| 101 |
|
| 102 |
return surface
|
| 103 |
|
| 104 |
@torch.no_grad()
|
| 105 |
-
@torch.autocast(device_type=DEVICE)
|
| 106 |
def run_detailgen3d(
|
| 107 |
pipeline,
|
| 108 |
image,
|
|
@@ -140,7 +139,6 @@ def run_detailgen3d(
|
|
| 140 |
|
| 141 |
@spaces.GPU(duration=180)
|
| 142 |
@torch.no_grad()
|
| 143 |
-
@torch.autocast(device_type=DEVICE)
|
| 144 |
def run_refinement(
|
| 145 |
rgb_image: Any,
|
| 146 |
mesh: Any,
|
|
|
|
| 97 |
ind = rng.choice(surface.shape[0], num_pc, replace=False)
|
| 98 |
surface = torch.FloatTensor(surface[ind])
|
| 99 |
normal = torch.FloatTensor(normal[ind])
|
| 100 |
+
surface = torch.cat([surface, normal], dim=-1).unsqueeze(0).to(DEVICE, dtype=DTYPE)
|
| 101 |
|
| 102 |
return surface
|
| 103 |
|
| 104 |
@torch.no_grad()
|
|
|
|
| 105 |
def run_detailgen3d(
|
| 106 |
pipeline,
|
| 107 |
image,
|
|
|
|
| 139 |
|
| 140 |
@spaces.GPU(duration=180)
|
| 141 |
@torch.no_grad()
|
|
|
|
| 142 |
def run_refinement(
|
| 143 |
rgb_image: Any,
|
| 144 |
mesh: Any,
|