Skip to content

Conversation

@craymichael
Copy link
Contributor

Summary:
Some attributions returned by gradient-based methods still have a grad_fn from autograd (e.g. LayerGradientXActivation). This diff ensures that the autograd graph is freed between attribute calls within LLMGradientAttribution to eliminate this as a potential source of VRAM accumulation.

Also wrapped model.generate with a no_grad context to avoid unecessary memory usage.

Differential Revision: D62671994

Summary:
Some attributions returned by gradient-based methods still have a `grad_fn` from autograd (e.g. `LayerGradientXActivation`). This diff ensures that the autograd graph is freed between attribute calls within `LLMGradientAttribution` to eliminate this as a potential source of VRAM accumulation.

Also wrapped `model.generate` with a `no_grad` context to avoid unecessary memory usage.

Differential Revision: D62671994
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in b7ca840.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants