dylanebert commited on
Commit
c8a48ed
1 Parent(s): b788c50

optional progress callback

Browse files
Files changed (2) hide show
  1. lrm/lrm.py +0 -0
  2. pipeline.py +9 -1
lrm/lrm.py CHANGED
The diff for this file is too large to render. See raw diff
 
pipeline.py CHANGED
@@ -1,4 +1,5 @@
1
  from dataclasses import dataclass
 
2
 
3
  import cv2
4
  import numpy as np
@@ -97,7 +98,12 @@ class InstantMeshPipeline(DiffusionPipeline):
97
  self.register_modules(lrm=self.lrm)
98
 
99
  @torch.no_grad()
100
- def __call__(self, images: torch.Tensor, generate_texture: bool = False):
 
 
 
 
 
101
  self.lrm.init_flexicubes_geometry(self._execution_device, fovy=30.0)
102
  cameras = get_zero123plus_input_cameras().to(self._execution_device)
103
  planes = self.lrm.forward_planes(images, cameras)
@@ -107,6 +113,7 @@ class InstantMeshPipeline(DiffusionPipeline):
107
  planes,
108
  use_texture_map=True,
109
  texture_resolution=1024,
 
110
  )
111
  vertices, vertex_indices, uvs, uv_indices, texture = mesh_out
112
 
@@ -149,6 +156,7 @@ class InstantMeshPipeline(DiffusionPipeline):
149
  mesh_out = self.lrm.extract_mesh(
150
  planes,
151
  use_texture_map=False,
 
152
  )
153
  vertices, faces, _ = mesh_out
154
 
 
1
  from dataclasses import dataclass
2
+ from typing import Callable, Optional
3
 
4
  import cv2
5
  import numpy as np
 
98
  self.register_modules(lrm=self.lrm)
99
 
100
  @torch.no_grad()
101
+ def __call__(
102
+ self,
103
+ images: torch.Tensor,
104
+ generate_texture: bool = False,
105
+ progress_callback: Optional[Callable[[float], None]] = None,
106
+ ):
107
  self.lrm.init_flexicubes_geometry(self._execution_device, fovy=30.0)
108
  cameras = get_zero123plus_input_cameras().to(self._execution_device)
109
  planes = self.lrm.forward_planes(images, cameras)
 
113
  planes,
114
  use_texture_map=True,
115
  texture_resolution=1024,
116
+ progress_callback=progress_callback,
117
  )
118
  vertices, vertex_indices, uvs, uv_indices, texture = mesh_out
119
 
 
156
  mesh_out = self.lrm.extract_mesh(
157
  planes,
158
  use_texture_map=False,
159
+ progress_callback=progress_callback,
160
  )
161
  vertices, faces, _ = mesh_out
162