Roberta Gradient checkpointing  to only layers, which requires grad
### Feature request

Current gradient checkpointing in Roberta, directly uses gradient checkpointing for all layers without checking if they require grad. In our use case we only train last 3 layers of Roberta and want to use gradient checkpointing only for the last 3 layers.

### Motivation

Adding this would further decrease the memory usage on GPU.

### Your contribution

https://github.com/huggingface/transformers/blob/6268694e27f1fc0192ba24e4bec181061b4a9bf8/src/transformers/models/roberta/modeling_roberta.py#L497

at this line we can add another condition, then it would look like this:

if self.gradient_checkpointing and self.training and layer_module.requires_grad

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.