-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] How to use Autodifferentiation for soft-body parameters #346
Comments
Hey there ! To differentiate soft body parameters like Here is the doc about it: |
I'm not an expert on the
|
Thank you! |
Sorry, I tried implementing your method of computing gradients on
The gradients are 0.0, and I compute loss by calculating the MSE between Here is my entire script in case you'd like to reproduce it. Thank you so much for your help!
|
Hey @rrzhang139, I think your script makes reference to some local code so I can't run it on my system, but one issue I see is that you're only using two model states and swapping them at the end of each warp/warp/examples/optim/example_cloth_throw.py Lines 104 to 107 in 3f9038d
Also, in your first snippet, the @eric-heiden for viz |
Thank you @shi-eric, my gradients were flipflopping that indicated the swapped states. The problem I have now is instability and non-convergence. Does warp have an example script on materials prediction? Inherently it seems difficult because you have to track a target model's movement trajectory which introduces a moving optimization target. Also the material parameter may not contain enough information to smoothly update the gradients. Let me know what your thoughts are, I have pasted a gist of my updated code. And there should be no dependencies anymore so you can run the script entirely. https://gist.github.com/rrzhang139/707d9920be003faf142c32e2ac8e892b Thanks for your help! |
Hey @rrzhang139, I don't have experience with that, but I'll ask around to see if anyone else from the team can weigh in. One of our favorite examples from the community is NCLaw: https://github.com/PingchuanMa/NCLaw Maybe they employ some techniques to get around the issues you are running into. |
Thank you! @shi-eric One quick question that may help me. One improvement is to scale the gradients in logspace. Is there a way to do forward pass in simulation in regular space then convert to log space for gradient calculation? Would I need to modify the source code? |
Hello, thank you for building this first of all.
I have a question about differentiating the parameters in Warp. If I wanted to differentiate soft body parameters like k_mu or k_lambda in soft_grid, how would that generally work? Would I initialize some tensors and pass them into kernels to get that working? Do you have any code samples that does this for soft body simulation? Thanks!
The text was updated successfully, but these errors were encountered: