You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Example of saving the latents as meshes.
from shap_e.util.notebooks import decode_latent_mesh
for i, latent in enumerate(latents):
t = decode_latent_mesh(xm, latent).tri_mesh()
with open(f'example_mesh_{i}.ply', 'wb') as f:
t.write_ply(f)
with open(f'example_mesh_{i}.obj', 'w') as f:
t.write_obj(f)
i have a proplem
`---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[6], line 5
2 from shap_e.util.notebooks import decode_latent_mesh
4 for i, latent in enumerate(latents):
----> 5 t = decode_latent_mesh(xm, latent).tri_mesh()
6 with open(f'example_mesh_{i}.ply', 'wb') as f:
7 t.write_ply(f)
File ~\anaconda3\envs\shap-e\lib\site-packages\torch\utils\_contextlib.py:115, in context_decorator.<locals>.decorate_context(*args, **kwargs)
112 @functools.wraps(func)
113 def decorate_context(*args, **kwargs):
114 with ctx_factory():
--> 115 return func(*args, **kwargs)
File c:\users\taras\shap-e\shap_e\util\notebooks.py:69, in decode_latent_mesh(xm, latent)
64 @torch.no_grad()
65 def decode_latent_mesh(
66 xm: Union[Transmitter, VectorDecoder],
67 latent: torch.Tensor,
68 ) -> TorchMesh:
---> 69 decoded = xm.renderer.render_views(
70 AttrDict(cameras=create_pan_cameras(2, latent.device)), # lowest resolution possible
71 params=(xm.encoder if isinstance(xm, Transmitter) else xm).bottleneck_to_params(
72 latent[None]
73 ),
74 options=AttrDict(rendering_mode="stf", render_with_direction=False),
75 )
76 return decoded.raw_meshes[0]
File c:\users\taras\shap-e\shap_e\models\nerstf\renderer.py:243, in NeRSTFRenderer.render_views(self, batch, params, options)
233 sdf_fn = partial(
234 self.sdf.forward_batched,
235 params=subdict(params, "sdf"),
236 options=options,
237 )
238 tf_fn = partial(
239 self.tf.forward_batched,
240 params=subdict(params, "tf"),
241 options=options,
242 )
--> 243 output = render_views_from_stf(
244 batch,
245 options,
246 sdf_fn=sdf_fn,
247 tf_fn=tf_fn,
248 nerstf_fn=nerstf_fn,
249 volume=self.volume,
250 grid_size=self.grid_size,
251 channel_scale=self.channel_scale,
252 texture_channels=self.texture_channels,
253 ambient_color=self.ambient_color,
254 diffuse_color=self.diffuse_color,
255 specular_color=self.specular_color,
256 output_srgb=self.output_srgb,
257 device=self.device,
258 )
260 else:
262 raise NotImplementedError
File c:\users\taras\shap-e\shap_e\models\stf\renderer.py:284, in render_views_from_stf(batch, options, sdf_fn, tf_fn, nerstf_fn, volume, grid_size, channel_scale, texture_channels, ambient_color, diffuse_color, specular_color, output_srgb, device)
269 args = dict(
270 options=options,
271 texture_channels=texture_channels,
(...)
280 tf_out=tf_out,
281 )
283 try:
--> 284 out = _render_with_pytorch3d(**args)
285 except ModuleNotFoundError as exc:
286 warnings.warn(f"exception rendering with PyTorch3D: {exc}")
File c:\users\taras\shap-e\shap_e\models\stf\renderer.py:366, in _render_with_pytorch3d(options, texture_channels, ambient_color, diffuse_color, specular_color, camera, batch_size, inner_shape, inner_batch_size, raw_meshes, tf_out)
362 for i in range(inner_batch_size):
363 sub_cams = convert_cameras_torch(
364 position[:, i], x[:, i], y[:, i], z[:, i], fov=camera.x_fov
365 )
--> 366 imgs = render_images(
367 camera.width,
368 meshes,
369 sub_cams,
370 lights,
371 use_checkpoint=options.checkpoint_render,
372 **options.get("render_options", {}),
373 )
374 results.append(imgs)
375 views = torch.stack(results, dim=1)
File c:\users\taras\shap-e\shap_e\rendering\pytorch3d_util.py:109, in render_images(image_size, meshes, cameras, lights, sigma, gamma, max_faces_per_bin, faces_per_pixel, bin_size, use_checkpoint)
92 raster_settings_soft = RasterizationSettings(
93 image_size=image_size,
94 blur_radius=np.log(1.0 / 1e-4 - 1.0) * sigma,
(...)
98 perspective_correct=False,
99 )
100 renderer = MeshRenderer(
101 rasterizer=MeshRasterizer(cameras=cameras, raster_settings=raster_settings_soft),
102 shader=SoftPhongShader(
(...)
107 ),
108 )
--> 109 result = renderer(meshes)
111 return result
File ~\anaconda3\envs\shap-e\lib\site-packages\torch\nn\modules\module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)
1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1517 else:
-> 1518 return self._call_impl(*args, **kwargs)
File ~\anaconda3\envs\shap-e\lib\site-packages\torch\nn\modules\module.py:1527, in Module._call_impl(self, *args, **kwargs)
1522 # If we don't have any hooks, we want to skip the rest of the logic in
1523 # this function, and just call forward.
1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1529 try:
1530 result = None
File ~\anaconda3\envs\shap-e\lib\site-packages\pytorch3d\renderer\mesh\renderer.py:61, in MeshRenderer.forward(self, meshes_world, **kwargs)
48 def forward(self, meshes_world: Meshes, **kwargs) -> torch.Tensor:
49 """
50 Render a batch of images from a batch of meshes by rasterizing and then
51 shading.
(...)
59 For this set rasterizer.raster_settings.clip_barycentric_coords=True
60 """
---> 61 fragments = self.rasterizer(meshes_world, **kwargs)
62 images = self.shader(fragments, meshes_world, **kwargs)
64 return images
File ~\anaconda3\envs\shap-e\lib\site-packages\torch\nn\modules\module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)
1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1517 else:
-> 1518 return self._call_impl(*args, **kwargs)
File ~\anaconda3\envs\shap-e\lib\site-packages\torch\nn\modules\module.py:1527, in Module._call_impl(self, *args, **kwargs)
1522 # If we don't have any hooks, we want to skip the rest of the logic in
1523 # this function, and just call forward.
1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1529 try:
1530 result = None
File ~\anaconda3\envs\shap-e\lib\site-packages\pytorch3d\renderer\mesh\rasterizer.py:252, in MeshRasterizer.forward(self, meshes_world, **kwargs)
246 z_clip = None if not perspective_correct or znear is None else znear / 2
248 # By default, turn on clip_barycentric_coords if blur_radius > 0.
249 # When blur_radius > 0, a face can be matched to a pixel that is outside the
250 # face, resulting in negative barycentric coordinates.
--> 252 pix_to_face, zbuf, bary_coords, dists = rasterize_meshes(
253 meshes_proj,
254 image_size=raster_settings.image_size,
255 blur_radius=raster_settings.blur_radius,
256 faces_per_pixel=raster_settings.faces_per_pixel,
257 bin_size=raster_settings.bin_size,
258 max_faces_per_bin=raster_settings.max_faces_per_bin,
259 clip_barycentric_coords=clip_barycentric_coords,
260 perspective_correct=perspective_correct,
261 cull_backfaces=raster_settings.cull_backfaces,
262 z_clip_value=z_clip,
263 cull_to_frustum=raster_settings.cull_to_frustum,
264 )
266 return Fragments(
267 pix_to_face=pix_to_face,
268 zbuf=zbuf,
269 bary_coords=bary_coords,
270 dists=dists,
271 )
File ~\anaconda3\envs\shap-e\lib\site-packages\pytorch3d\renderer\mesh\rasterize_meshes.py:223, in rasterize_meshes(meshes, image_size, blur_radius, faces_per_pixel, bin_size, max_faces_per_bin, perspective_correct, clip_barycentric_coords, cull_backfaces, z_clip_value, cull_to_frustum)
220 if max_faces_per_bin is None:
221 max_faces_per_bin = int(max(10000, meshes._F / 5))
--> 223 pix_to_face, zbuf, barycentric_coords, dists = _RasterizeFaceVerts.apply(
224 face_verts,
225 mesh_to_face_first_idx,
226 num_faces_per_mesh,
227 clipped_faces_neighbor_idx,
228 im_size,
229 blur_radius,
230 faces_per_pixel,
231 bin_size,
232 max_faces_per_bin,
233 perspective_correct,
234 clip_barycentric_coords,
235 cull_backfaces,
236 )
238 if z_clip_value is not None or cull_to_frustum:
239 # If faces were clipped, map the rasterization result to be in terms of the
240 # original unclipped faces. This may involve converting barycentric
241 # coordinates
242 outputs = convert_clipped_rasterization_to_original_faces(
243 pix_to_face,
244 barycentric_coords,
245 # pyre-fixme[61]: `clipped_faces` may not be initialized here.
246 clipped_faces,
247 )
File ~\anaconda3\envs\shap-e\lib\site-packages\torch\autograd\function.py:539, in Function.apply(cls, *args, **kwargs)
536 if not torch._C._are_functorch_transforms_active():
537 # See NOTE: [functorch vjp and autograd interaction]
538 args = _functorch.utils.unwrap_dead_wrappers(args)
--> 539 return super().apply(*args, **kwargs) # type: ignore[misc]
541 if cls.setup_context == _SingleLevelFunction.setup_context:
542 raise RuntimeError(
543 "In order to use an autograd.Function with functorch transforms "
544 "(vmap, grad, jvp, jacrev, ...), it must override the setup_context "
545 "staticmethod. For more details, please see "
546 "https://pytorch.org/docs/master/notes/extending.func.html"
547 )
File ~\anaconda3\envs\shap-e\lib\site-packages\pytorch3d\renderer\mesh\rasterize_meshes.py:297, in _RasterizeFaceVerts.forward(ctx, face_verts, mesh_to_face_first_idx, num_faces_per_mesh, clipped_faces_neighbor_idx, image_size, blur_radius, faces_per_pixel, bin_size, max_faces_per_bin, perspective_correct, clip_barycentric_coords, cull_backfaces, z_clip_value, cull_to_frustum)
277 @staticmethod
278 # pyre-fixme[14]: `forward` overrides method defined in `Function` inconsistently.
279 def forward(
(...)
295 ):
296 # pyre-fixme[16]: Module `pytorch3d` has no attribute `_C`.
--> 297 pix_to_face, zbuf, barycentric_coords, dists = _C.rasterize_meshes(
298 face_verts,
299 mesh_to_face_first_idx,
300 num_faces_per_mesh,
301 clipped_faces_neighbor_idx,
302 image_size,
303 blur_radius,
304 faces_per_pixel,
305 bin_size,
306 max_faces_per_bin,
307 perspective_correct,
308 clip_barycentric_coords,
309 cull_backfaces,
310 )
312 ctx.save_for_backward(face_verts, pix_to_face)
313 ctx.mark_non_differentiable(pix_to_face)
RuntimeError: Not compiled with GPU support`
The text was updated successfully, but these errors were encountered:
When i run this command
i have a proplem
The text was updated successfully, but these errors were encountered: