Update models/ISOMER/mesh_reconstruction/render.py
Browse files
models/ISOMER/mesh_reconstruction/render.py
CHANGED
@@ -4,6 +4,13 @@ import torch
|
|
4 |
from typing import Tuple
|
5 |
import spaces
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
def _warmup(glctx, device=None):
|
8 |
device = 'cuda' if device is None else device
|
9 |
#windows workaround for https://github.com/NVlabs/nvdiffrast/issues/59
|
@@ -16,12 +23,7 @@ def _warmup(glctx, device=None):
|
|
16 |
dr.rasterize(glctx, pos, tri, resolution=[256, 256])
|
17 |
|
18 |
# glctx = dr.RasterizeGLContext(output_db=False, device="cuda")
|
19 |
-
|
20 |
-
@spaces.GPU
|
21 |
-
def init_render():
|
22 |
-
global glctx
|
23 |
-
glctx = dr.RasterizeCudaContext(device="cuda")
|
24 |
-
init_render()
|
25 |
class NormalsRenderer:
|
26 |
|
27 |
_glctx:dr.RasterizeCudaContext = None
|
|
|
4 |
from typing import Tuple
|
5 |
import spaces
|
6 |
|
7 |
+
glctx = None
|
8 |
+
@spaces.GPU
|
9 |
+
def init_render():
|
10 |
+
global glctx
|
11 |
+
glctx = dr.RasterizeCudaContext(device="cuda")
|
12 |
+
init_render()
|
13 |
+
|
14 |
def _warmup(glctx, device=None):
|
15 |
device = 'cuda' if device is None else device
|
16 |
#windows workaround for https://github.com/NVlabs/nvdiffrast/issues/59
|
|
|
23 |
dr.rasterize(glctx, pos, tri, resolution=[256, 256])
|
24 |
|
25 |
# glctx = dr.RasterizeGLContext(output_db=False, device="cuda")
|
26 |
+
|
|
|
|
|
|
|
|
|
|
|
27 |
class NormalsRenderer:
|
28 |
|
29 |
_glctx:dr.RasterizeCudaContext = None
|