src/transformers/models/maskformer/modeling_maskformer_swin.py/MaskFormerSwinPreTrainedModel/_set_gradient_checkpointing
class MaskFormerSwinPreTrainedModel:    def _set_gradient_checkpointing(self, module, value=False):
        if isinstance(module, MaskFormerSwinEncoder):
            module.gradient_checkpointing = value