taichi-dev / difftaichi

10 differentiable physical simulators built with Taichi differentiable programming (DiffTaichi, ICLR 2020)
2.47k stars 260 forks source link

New examples not working #49

Closed 1234shel closed 2 years ago

1234shel commented 2 years ago

I updated taichi to the latest version and tried to run the examples as instructed in the readme. Still cant get it to run. The compile and build phase gives all sorts of errors. I have tried this across two different devices and still it doesnt work.

k-ye commented 2 years ago

Which version are you using & which platform?

1234shel commented 2 years ago

I am using Taichi v0.8.2 on an apple machine. However, I have also tried this on a Linux ubuntu machine.

k-ye commented 2 years ago

Thanks. And what error are you getting?

erizmr commented 2 years ago

Thanks. And which example did you try to run?

1234shel commented 2 years ago

I am trying to run diffmpm.py and get the following error: Traceback (most recent call last): File "diffmpm.py", line 388, in main() File "diffmpm.py", line 377, in main visualize(s, 'diffmpm/iter{:03d}/'.format(iter)) File "diffmpm.py", line 332, in visualize color = ti.rgb_to_hex((0.5 - act, 0.5 - abs(act), 0.5 + act)) File "/opt/anaconda3/lib/python3.7/site-packages/taichi/misc/gui.py", line 838, in rgb_to_hex return (to255(c[0]) << 16) + (to255(c[1]) << 8) + to255(c[2]) File "/opt/anaconda3/lib/python3.7/site-packages/taichi/misc/gui.py", line 837, in to255 = lambda x: np.clip(np.int32(x * 255), 0, 255) ValueError: cannot convert float NaN to integer

1234shel commented 2 years ago

When running diffmpm3d I get the following error:

i= 18 loss= nan per iter 45.59s i= 19 loss= nan per iter 46.28s Writing particle data to disk... (Please be patient)... Traceback (most recent call last): File "diffmpm3d.py", line 503, in main() File "diffmpm3d.py", line 464, in main xs.append(x_[s, i][0]) IndexError: index 512 is out of bounds for axis 1 with size 512

k-ye commented 2 years ago

https://github.com/yuanming-hu/difftaichi/issues/49#issuecomment-951548229

Huh, could this relate to our axis refactor? @strongoier

strongoier commented 2 years ago

#49 (comment)

Huh, could this relate to our axis refactor? @strongoier

Yes. @erizmr has already planned to update this repo accordingly.

@1234shel Please use Taichi v0.8.1 for now. After this repo is updated, you can use Taichi v0.8.3+.

k-ye commented 2 years ago

We should also cover this repo in our CI

erizmr commented 2 years ago

I am working on fixing the axis related issues, there are several examples involved and will be finished today.

1234shel commented 2 years ago

Thanks guys it seems to be running now. Can you tell me how I can get the visualisation similar to what was shown on the readme?

erizmr commented 2 years ago

For the diffmpm.py case, I think the visualization provided in it is exactly the same to that in the readme. The color red and blue represent the actuation magnitude.

1234shel commented 2 years ago

I cant seem to get any visualisation for the 3d stuff which I am particularly interested in. Also do you guys have any user-guide on how to go about building soft robots using difftaichi. I am interested in building various different types of soft robots so if there was a reference guide with regards to the basic building blocks that would be great.

erizmr commented 2 years ago

For 3D case, it requires more complex rendering post-processing, we have an open-source particle render in another repo https://github.com/taichi-dev/taichi_elements and have the plan to make use of it for the 3D rendering of this repo recently. There is a bit work to do but we will keep updating.

As for the user-guide of designing soft robots, for the mpm case, the basic building block is rectangular filled by particles (check the class Scene in the diffmpm3d). For mass-spring case, the basic building block is squares with each edge a spring. We do have an in-house robot design tool for this two cases but still under construction. It will be more convenient to design robots when it release.