play_craftax does not work due to numpy/jax issue?
windweller opened this issue · 4 comments
Hi,
It doesn't seem like this is an issue for most people, but I'm running into it :(
Traceback (most recent call last):
File "/Users/miniconda3/lib/python3.10/site-packages/craftax/craftax/play_craftax.py", line 163, in main
renderer.render(env_state)
File "/Users/miniconda3/lib/python3.10/site-packages/craftax/craftax/play_craftax.py", line 112, in render
pixels = self._render(env_state, block_pixel_size=BLOCK_PIXEL_SIZE_HUMAN)
File "/Users/miniconda3/lib/python3.10/site-packages/craftax/craftax/renderer.py", line 241, in render_craftax_pixels
map_pixels, _ = jax.lax.scan(
File "/Users/miniconda3/lib/python3.10/site-packages/craftax/craftax/renderer.py", line 236, in _add_block_type_to_pixels
+ textures["full_map_block_textures"][block_index]
File "/Users/miniconda3/lib/python3.10/site-packages/jax/_src/numpy/array_methods.py", line 739, in op
return getattr(self.aval, f"_{name}")(self, *args)
File "/Users/miniconda3/lib/python3.10/site-packages/jax/_src/numpy/array_methods.py", line 265, in deferring_binary_op
return binary_op(*args)
File "/Users/miniconda3/lib/python3.10/site-packages/jax/_src/numpy/ufuncs.py", line 102, in fn
return lax_fn(x1, x2) if x1.dtype != np.bool_ else bool_lax_fn(x1, x2)
TypeError: mul got incompatible shapes for broadcasting: (576, 1216, 3), (576, 704, 3).
My dependencies are:
jax 0.4.27
jaxlib 0.4.27
gym 0.26.2
gymnasium 0.29.1
gymnax 0.0.8
numpy 1.26.4
I hope this is just some version incompatibility :( or if there are others who run into the same problem.
play_craftax_classic
works for me.
I manually upgraded/downgraded a few packages...but seems to still have the same issue
Can you try running with the following environment variable set
CRAFTAX_RELOAD_TEXTURES=true
Let me know if that changes anything
EDIT: you shouldn't need to do this anymore (although it will work). Just update to the latest version of Craftax.
Okay so I actually just ran into the same issue.
For some reason the texture cache was using a map size of 9x18, whereas the agent observation should be 9x11.
I have not been able to figure out how or why this emerged in the texture cache, but have updated the texture loading to validate the cache and reload it if it contains images of the wrong size.
If you try running again with the latest version then the issue should be fixed.
I'm not entirely satisfied however as I can't figure out how this erroneous cache emerged more than once...
Please let me know if this has fixed it for you.
Closing due to inactivity and presuming that this is solved.