class_docstr: FlashBaseFinetuning can be used to create a custom Flash Finetuning Callback.
class_docstr_tok: ["FlashBaseFinetuning","can","be","used","to","create","a","custom","Flash","Finetuning","Callback","."]
code: def _freeze_unfreeze_function(
      self,
      pl_module: Union[Module, Iterable[Union[Module, Iterable]]],
      epoch: int,
      optimizer: Optimizer,
      opt_idx: int,
      strategy_metadata: int,
  ):
      unfreeze_epoch: int = strategy_metadata
      if epoch != unfreeze_epoch:
          return
  
      modules = self._get_modules_to_freeze(pl_module=pl_module)
      if modules is not None:
          self.unfreeze_and_extend_param_group(
              modules=modules,
              optimizer=optimizer,
              train_bn=self.train_bn,
          )
  
imports: import os
  from functools import partial
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  from pytorch_lightning import LightningModule
  from pytorch_lightning.callbacks import BaseFinetuning
  from torch.nn import Module
  from torch.optim import Optimizer
  from flash.core.registry import FlashRegistry
label_desc: Use image node_id 5 for calling the FlashBaseFinetuning obj's underlying member method code with example usage: obj._freeze_unfreeze_function(pl_module, epoch, optimizer, opt_idx, strategy_metadata) without return types