shap-e icon indicating copy to clipboard operation
shap-e copied to clipboard

Assertion error in renderer.py

Open atkulp opened this issue 1 year ago • 4 comments

In shap_e/models/renderer.py, on line 208:

207 |    ray_batch_size = batch.get("ray_batch_size", batch.get("inner_batch_size", 4096))
208 |    assert rays.shape[1] % ray_batch_size == 0
209 |    n_batches = rays.shape[1] // ray_batch_size

I'm getting "AssertionError". I changed batch_size from 4 to 2 due to running out of VRAM (RTX 3070, 8GB) and size from 64 to 32. All else is the same. Running in WSL 2.0 on Windows 11.

CPU: Intel(R) Core(TM) i7-10700KF CPU @ 3.80GHz RAM: 32GB

Full stack:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[5], line 6
      4 cameras = create_pan_cameras(size, device)
      5 for i, latent in enumerate(latents):
----> 6     images = decode_latent_images(xm, latent, cameras, rendering_mode=render_mode)
      7     display(gif_widget(images))

File [~/miniconda3/lib/python3.8/site-packages/torch/utils/_contextlib.py:115](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/home/arian/source/shap-e/shap_e/examples/~/miniconda3/lib/python3.8/site-packages/torch/utils/_contextlib.py:115), in context_decorator..decorate_context(*args, **kwargs)
    112 @functools.wraps(func)
    113 def decorate_context(*args, **kwargs):
    114     with ctx_factory():
--> 115         return func(*args, **kwargs)

File [~/source/shap-e/shap_e/util/notebooks.py:53](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/home/arian/source/shap-e/shap_e/examples/~/source/shap-e/shap_e/util/notebooks.py:53), in decode_latent_images(xm, latent, cameras, rendering_mode)
     46 @torch.no_grad()
     47 def decode_latent_images(
     48     xm: Union[Transmitter, VectorDecoder],
   (...)
     51     rendering_mode: str = "stf",
     52 ):
---> 53     decoded = xm.renderer.render_views(
     54         AttrDict(cameras=cameras),
     55         params=(xm.encoder if isinstance(xm, Transmitter) else xm).bottleneck_to_params(
     56             latent[None]
...
--> 208 assert rays.shape[1] % ray_batch_size == 0
    209 n_batches = rays.shape[1] // ray_batch_size
    211 output_list = AttrDict(aux_losses=dict())```

atkulp avatar May 15 '23 17:05 atkulp

https://www.youtube.com/watch?v=UFQ8xVUp4w8

YVS007 avatar May 16 '23 10:05 YVS007

I think you responded to the wrong thread. I'm trying to troubleshoot the assertion error above. it might be a python (or other similar) version error though since I had to remove the generic type arguments from Dict types to get it to run at all

atkulp avatar May 19 '23 23:05 atkulp

Have you found a solution? I get the same error. Tried different batch_size but it persists

mhmtemnacr avatar Jun 04 '23 20:06 mhmtemnacr

I got rid of it by making some code fixes, but then it didn't actually work! I haven't gone back to it since then.

atkulp avatar Jun 04 '23 23:06 atkulp