warp icon indicating copy to clipboard operation
warp copied to clipboard

Is there a way to get all requires_grad=True variables and do variable or gradient clipping inside simulator of warp?

Open zoezhou1999 opened this issue 2 years ago • 3 comments

Hi Is there a way to get all requires_grad=True variables and do variable or gradient clipping inside simulator of warp?Thank you!

zoezhou1999 avatar Aug 06 '23 15:08 zoezhou1999

Hmm.. that sounds useful, are you using the wp.Tape()? That keeps track of all the gradients used during the computation. You could add a post process to clip the gradients there I think?

mmacklin avatar Aug 17 '23 02:08 mmacklin

Hi Miles Thank you for the reply. I will look at it. Btw, when I played warp and pytorch, I found warp cannot support pytorch's retain_graph=True functionality, i.e., loss.backward(retain_graph=True). But not using retain_graph solves the issue.

zoezhou1999 avatar Aug 17 '23 02:08 zoezhou1999

Hmm.. that sounds useful, are you using the wp.Tape()? That keeps track of all the gradients used during the computation. You could add a post process to clip the gradients there I think?

When I try to change the value of gradients inside Tape function, it showed that 'operation would make the legacy stream depend on a capturing blocking stream'. Seems like I cannot do any modification of gradients' value.

Leon-LXA avatar Feb 05 '24 11:02 Leon-LXA