Skip to content
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] Gradients are Exploding given Different Mesh #400

Open
rrzhang139 opened this issue Dec 17, 2024 · 1 comment
Open

[QUESTION] Gradients are Exploding given Different Mesh #400

rrzhang139 opened this issue Dec 17, 2024 · 1 comment
Assignees
Labels
question The issue author requires information

Comments

@rrzhang139
Copy link
Contributor

Hello,

I was able to successfully write a script that optimizes material parameters for a soft mesh using add_soft_grid. The environment starts with two identical models (model and target_model) and applying a force on the mesh watching it deform. Now, I tried to replace the mesh with the bear example. However, the gradients are exploding giving NaNs along the entire gradient path.

At first, I thought it was because there were more particles for the bear mesh (1986) than the soft grid (125), accumulating more loss per particle. However, when I measured the same number of particles the gradients still explode. I also removed the force on the mesh so they are fixed. Still the loss between the target and model is very high.

Is there something wrong with the initialization of the models? I can try clipping the model but is there some way to stabilize the gradients regardless of the mesh that is inputted? I guess this comes down to difficult gradient optimization architecture design. Would batching possibly work? The thing is, we can't reliably split the model into batches like traditional neural network architectures because we need the entire mesh model to be passed through.

Let me know what you think. Thank you again for this amazing project!

@rrzhang139 rrzhang139 added the question The issue author requires information label Dec 17, 2024
@rrzhang139
Copy link
Contributor Author

Upon closer inspection, Seems like add_soft_mesh does not compute mass and consideres all particles as mass=0. In example_walker it seems like modifying the tet_activations is valid, but my script is applying force on particles instead of tetrahedrons.

Could these deficiencies from the soft grid explain this erratic behavior? I'd be happy to submit a PR to extend the robustness of add_soft_mesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue author requires information
Projects
None yet
Development

No branches or pull requests

2 participants