opacus icon indicating copy to clipboard operation
opacus copied to clipboard

Fix freezing modules in Ghost Clipping

Open EnayatUllah opened this issue 1 year ago • 3 comments

Summary: Freezing modules with ghost clipping throws an error as corresponding per-sample norms are (not) calculated. Fix: keep in memory the list of all parameters and checking if corresponding requires_grad is True when calculating norms.

Further, unfreezing modules (with and without ghost clipping) wasn't supported because the hooks aren't present for the corresponding modules. Fix: rewrite requires_grad_ to add the hook.

EnayatUllah avatar Feb 11 '25 20:02 EnayatUllah

This pull request was exported from Phabricator. Differential Revision: D68656459

facebook-github-bot avatar Feb 11 '25 20:02 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D68656459

facebook-github-bot avatar Feb 11 '25 20:02 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D68656459

facebook-github-bot avatar Feb 11 '25 21:02 facebook-github-bot