google / nerfies

This is the code for Deformable Neural Radiance Fields, a.k.a. Nerfies.
https://nerfies.github.io
Apache License 2.0
1.64k stars 221 forks source link

JAX error: RuntimeError: optional has no value #13

Closed mengdong closed 3 years ago

mengdong commented 3 years ago

When Parse data in https://github.com/google/nerfies/blob/main/notebooks/Nerfies_Capture_Processing.ipynb

executing following cell:

if colmap_image_scale > 1:
  print(f'Scaling COLMAP cameras back to 1x from {colmap_image_scale}x.')
  for item_id in scene_manager.image_ids:
    camera = scene_manager.camera_dict[item_id]
    scene_manager.camera_dict[item_id] = camera.scale(colmap_image_scale)

Run into error below, seems to be a JAX error, how should we address this? Thanks

Scaling COLMAP cameras back to 1x from 4x.
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-24-32db5f4d2f95> in <module>
     11   for item_id in scene_manager.image_ids:
     12     camera = scene_manager.camera_dict[item_id]
---> 13     scene_manager.camera_dict[item_id] = camera.scale(colmap_image_scale)
     14 
     15 

/usr/local/lib/python3.8/dist-packages/nerfies/camera.py in scale(self, scale)
    315         radial_distortion=self.radial_distortion.copy(),
    316         tangential_distortion=self.tangential_distortion.copy(),
--> 317         image_size=jnp.array((int(round(self.image_size[0] * scale)),
    318                               int(round(self.image_size[1] * scale)))),
    319     )

/usr/local/lib/python3.8/dist-packages/jax/_src/numpy/lax_numpy.py in array(object, dtype, copy, order, ndmin)
   2903     _inferred_dtype = object.dtype and dtypes.canonicalize_dtype(object.dtype)
   2904     lax._check_user_dtype_supported(_inferred_dtype, "array")
-> 2905     out = _device_put_raw(object, weak_type=weak_type)
   2906     if dtype: assert _dtype(out) == dtype
   2907   elif isinstance(object, (DeviceArray, core.Tracer)):

/usr/local/lib/python3.8/dist-packages/jax/_src/lax/lax.py in _device_put_raw(x, weak_type)
   1493   else:
   1494     aval = raise_to_shaped(core.get_aval(x), weak_type=weak_type)
-> 1495     return xla.array_result_handler(None, aval)(*xla.device_put(x))
   1496 
   1497 def iota(dtype: DType, size: int) -> Array:

/usr/local/lib/python3.8/dist-packages/jax/interpreters/xla.py in make_device_array(aval, device, device_buffer)
   1032   if (isinstance(device_buffer, _CppDeviceArray)):
   1033 
-> 1034     if device_buffer.aval == aval and device_buffer._device == device:
   1035       return device_buffer
   1036     device_buffer = device_buffer.clone()

RuntimeError: optional has no value
mengdong commented 3 years ago

it is a jax issue, fixed.

Carinazhao22 commented 3 years ago

Hi, I got a similar issue. How can you fix it? thanks

mengdong commented 3 years ago

Hi please install latest JAX : pip install --upgrade jax jaxlib==0.1.64+cuda110 -f https://storage.googleapis.com/jax-releases/jax_releases.html

Carinazhao22 commented 3 years ago

it works. thanks