Spaces:
Running
on
Zero
Running
on
Zero
xinjie.wang
commited on
Commit
·
d2b3ebc
1
Parent(s):
ef84893
update
Browse files
asset3d_gen/data/differentiable_render.py
CHANGED
@@ -400,13 +400,6 @@ def parse_args():
|
|
400 |
default=1.0,
|
401 |
help="Light factor for mesh PBR rendering (default: 2.)",
|
402 |
)
|
403 |
-
parser.add_argument(
|
404 |
-
"--device",
|
405 |
-
type=str,
|
406 |
-
choices=["cpu", "cuda"],
|
407 |
-
default="cuda",
|
408 |
-
help="Device to run on (default: 'cuda')",
|
409 |
-
)
|
410 |
parser.add_argument(
|
411 |
"--with_mtl",
|
412 |
action="store_true",
|
@@ -463,7 +456,7 @@ def entrypoint(**kwargs) -> None:
|
|
463 |
distance=args.distance,
|
464 |
resolution_hw=args.resolution_hw,
|
465 |
fov=math.radians(args.fov),
|
466 |
-
device=
|
467 |
)
|
468 |
|
469 |
render_items = [
|
|
|
400 |
default=1.0,
|
401 |
help="Light factor for mesh PBR rendering (default: 2.)",
|
402 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
parser.add_argument(
|
404 |
"--with_mtl",
|
405 |
action="store_true",
|
|
|
456 |
distance=args.distance,
|
457 |
resolution_hw=args.resolution_hw,
|
458 |
fov=math.radians(args.fov),
|
459 |
+
device="cuda",
|
460 |
)
|
461 |
|
462 |
render_items = [
|
asset3d_gen/utils/process_media.py
CHANGED
@@ -6,7 +6,7 @@ import subprocess
|
|
6 |
from glob import glob
|
7 |
from io import BytesIO
|
8 |
from typing import Union
|
9 |
-
|
10 |
import cv2
|
11 |
import imageio
|
12 |
import numpy as np
|
@@ -26,6 +26,7 @@ __all__ = [
|
|
26 |
]
|
27 |
|
28 |
|
|
|
29 |
def render_asset3d(
|
30 |
mesh_path: str,
|
31 |
output_root: str,
|
@@ -38,7 +39,6 @@ def render_asset3d(
|
|
38 |
gen_color_mp4: bool = False,
|
39 |
gen_viewnormal_mp4: bool = False,
|
40 |
gen_glonormal_mp4: bool = False,
|
41 |
-
device: str = "cpu",
|
42 |
) -> list[str]:
|
43 |
command = [
|
44 |
"python3",
|
@@ -58,8 +58,6 @@ def render_asset3d(
|
|
58 |
"--pbr_light_factor",
|
59 |
str(pbr_light_factor),
|
60 |
"--with_mtl",
|
61 |
-
"--device",
|
62 |
-
device,
|
63 |
]
|
64 |
if gen_color_mp4:
|
65 |
command.append("--gen_color_mp4")
|
|
|
6 |
from glob import glob
|
7 |
from io import BytesIO
|
8 |
from typing import Union
|
9 |
+
import spaces
|
10 |
import cv2
|
11 |
import imageio
|
12 |
import numpy as np
|
|
|
26 |
]
|
27 |
|
28 |
|
29 |
+
@spaces.GPU
|
30 |
def render_asset3d(
|
31 |
mesh_path: str,
|
32 |
output_root: str,
|
|
|
39 |
gen_color_mp4: bool = False,
|
40 |
gen_viewnormal_mp4: bool = False,
|
41 |
gen_glonormal_mp4: bool = False,
|
|
|
42 |
) -> list[str]:
|
43 |
command = [
|
44 |
"python3",
|
|
|
58 |
"--pbr_light_factor",
|
59 |
str(pbr_light_factor),
|
60 |
"--with_mtl",
|
|
|
|
|
61 |
]
|
62 |
if gen_color_mp4:
|
63 |
command.append("--gen_color_mp4")
|