Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -347,7 +347,7 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
|
|
347 |
# GLB λ³ν
|
348 |
with torch.inference_mode():
|
349 |
try:
|
350 |
-
# λͺ¨λ ν
μλ₯Ό CUDAλ‘
|
351 |
device = torch.device('cuda:0')
|
352 |
|
353 |
# Gaussian ν
μλ€μ λ³ν
|
@@ -355,24 +355,23 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
|
|
355 |
if hasattr(gs, attr_name):
|
356 |
tensor = getattr(gs, attr_name)
|
357 |
if torch.is_tensor(tensor):
|
358 |
-
|
359 |
-
new_tensor = tensor.detach().clone().float().to(device).requires_grad_(True)
|
360 |
setattr(gs, attr_name, new_tensor)
|
361 |
|
362 |
# Mesh ν
μλ€μ λ³ν
|
363 |
if hasattr(mesh, 'vertices') and torch.is_tensor(mesh.vertices):
|
364 |
-
mesh.vertices = mesh.vertices.detach().clone().float().to(device)
|
365 |
if hasattr(mesh, 'faces') and torch.is_tensor(mesh.faces):
|
366 |
mesh.faces = mesh.faces.detach().clone().long().to(device)
|
367 |
|
368 |
-
# μΆκ° μμ± νμΈ λ° λ³ν
|
369 |
for attr_name in dir(mesh):
|
370 |
if attr_name.startswith('_'):
|
371 |
continue
|
372 |
attr = getattr(mesh, attr_name)
|
373 |
if torch.is_tensor(attr):
|
374 |
if attr.dtype in [torch.float32, torch.float64]:
|
375 |
-
setattr(mesh, attr_name, attr.to(device)
|
376 |
else:
|
377 |
setattr(mesh, attr_name, attr.to(device))
|
378 |
|
@@ -425,6 +424,7 @@ def extract_glb(state: dict, mesh_simplify: float, texture_size: int) -> Tuple[s
|
|
425 |
clear_gpu_memory()
|
426 |
|
427 |
|
|
|
428 |
def activate_button() -> gr.Button:
|
429 |
return gr.Button(interactive=True)
|
430 |
|
|
|
347 |
# GLB λ³ν
|
348 |
with torch.inference_mode():
|
349 |
try:
|
350 |
+
# λͺ¨λ ν
μλ₯Ό CUDAλ‘ μ΄λ (gradient λΆνμ)
|
351 |
device = torch.device('cuda:0')
|
352 |
|
353 |
# Gaussian ν
μλ€μ λ³ν
|
|
|
355 |
if hasattr(gs, attr_name):
|
356 |
tensor = getattr(gs, attr_name)
|
357 |
if torch.is_tensor(tensor):
|
358 |
+
new_tensor = tensor.detach().clone().float().to(device)
|
|
|
359 |
setattr(gs, attr_name, new_tensor)
|
360 |
|
361 |
# Mesh ν
μλ€μ λ³ν
|
362 |
if hasattr(mesh, 'vertices') and torch.is_tensor(mesh.vertices):
|
363 |
+
mesh.vertices = mesh.vertices.detach().clone().float().to(device)
|
364 |
if hasattr(mesh, 'faces') and torch.is_tensor(mesh.faces):
|
365 |
mesh.faces = mesh.faces.detach().clone().long().to(device)
|
366 |
|
367 |
+
# μΆκ° μμ± νμΈ λ° λ³ν (gradient λΆνμ)
|
368 |
for attr_name in dir(mesh):
|
369 |
if attr_name.startswith('_'):
|
370 |
continue
|
371 |
attr = getattr(mesh, attr_name)
|
372 |
if torch.is_tensor(attr):
|
373 |
if attr.dtype in [torch.float32, torch.float64]:
|
374 |
+
setattr(mesh, attr_name, attr.to(device))
|
375 |
else:
|
376 |
setattr(mesh, attr_name, attr.to(device))
|
377 |
|
|
|
424 |
clear_gpu_memory()
|
425 |
|
426 |
|
427 |
+
|
428 |
def activate_button() -> gr.Button:
|
429 |
return gr.Button(interactive=True)
|
430 |
|