class_docstr: Exteded Trainer for FLash tasks.
  
  >>> Trainer()  # doctest: +ELLIPSIS
  <...trainer.Trainer object at ...>
class_docstr_tok: ["Exteded","Trainer","for","FLash","tasks",".",">",">",">","Trainer","(",")","#","doctest",":","+ELLIPSIS","<","...","trainer.Trainer","object","at","...",">"]
docstr: Runs the full optimization routine. Same as :meth:`pytorch_lightning.Trainer.fit`, but unfreezes layers of
  the backbone throughout training layers of the backbone throughout training.
  
  Args:
      model: Model to fit.
  
      train_dataloader: A PyTorch DataLoader with training samples. If the model has
          a predefined train_dataloader method this will be skipped.
  
      val_dataloaders: Either a single PyTorch Dataloader or a list of them, specifying validation samples.
          If the model has a predefined val_dataloaders method this will be skipped
  
      datamodule: A instance of :class:`LightningDataModule`.
  
      strategy: Should either be a string, or a Tuple, or a finetuning callback subclassing
          :class:`pytorch_lightning.callbacks.BaseFinetuning`.
  
          Default strategies can be enabled with these inputs:
  
          - ``"no_freeze"``
          - ``"freeze"``
          - ``("freeze_unfreeze", integer: unfreeze_epoch)``
          - ``("unfreeze_milestones", ((integer: unfreeze_epoch_num_layers, integer: unfreeze_epoch_all_layers),
            integer: num_layers))``
  
          where ``integer`` can be any integer.
          By default, ``no_freeze`` strategy will be used.
  
      train_bn: Whether to train Batch Norm layer
docstr_tok: ["Runs","the","full","optimization","routine",".","Same","as",":","meth",":","`","pytorch_lightning.Trainer.fit","`",",","but","unfreezes","layers","of","the","backbone","throughout","training","layers","of","the","backbone","throughout","training",".","Args",":","model",":","Model","to","fit",".","train_dataloader",":","A","PyTorch","DataLoader","with","training","samples",".","If","the","model","has","a","predefined","train_dataloader","method","this","will","be","skipped",".","val_dataloaders",":","Either","a","single","PyTorch","Dataloader","or","a","list","of","them",",","specifying","validation","samples",".","If","the","model","has","a","predefined","val_dataloaders","method","this","will","be","skipped","datamodule",":","A","instance","of",":","class",":","`","LightningDataModule","`",".","strategy",":","Should","either","be","a","string",",","or","a","Tuple",",","or","a","finetuning","callback","subclassing",":","class",":","`","pytorch_lightning.callbacks.BaseFinetuning","`",".","Default","strategies","can","be","enabled","with","these","inputs",":","-","``","``","no_freeze","''","``","-","``","``","freeze","''","``","-","``","(","``","freeze_unfreeze","''",",","integer",":","unfreeze_epoch",")","``","-","``","(","``","unfreeze_milestones","''",",","(","(","integer",":","unfreeze_epoch_num_layers",",","integer",":","unfreeze_epoch_all_layers",")",",","integer",":","num_layers",")",")","``","where","``","integer","``","can","be","any","integer",".","By","default",",","``","no_freeze","``","strategy","will","be","used",".","train_bn",":","Whether","to","train","Batch","Norm","layer"]
code: def finetune(
      self,
      model: LightningModule,
      train_dataloader: Optional[DataLoader] = None,
      val_dataloaders: Optional[
          Union[DataLoader, List[DataLoader]]
      ] = None,
      datamodule: Optional[LightningDataModule] = None,
      strategy: Union[
          str,
          BaseFinetuning,
          Tuple[str, int],
          Tuple[str, Tuple[int, int]],
      ] = "no_freeze",
      train_bn: bool = True,
  ):
      r"""Runs the full optimization routine. Same as :meth:`pytorch_lightning.Trainer.fit`, but unfreezes layers of
      the backbone throughout training layers of the backbone throughout training.
  
      Args:
          model: Model to fit.
  
          train_dataloader: A PyTorch DataLoader with training samples. If the model has
              a predefined train_dataloader method this will be skipped.
  
          val_dataloaders: Either a single PyTorch Dataloader or a list of them, specifying validation samples.
              If the model has a predefined val_dataloaders method this will be skipped
  
          datamodule: A instance of :class:`LightningDataModule`.
  
          strategy: Should either be a string, or a Tuple, or a finetuning callback subclassing
              :class:`pytorch_lightning.callbacks.BaseFinetuning`.
  
              Default strategies can be enabled with these inputs:
  
              - ``"no_freeze"``
              - ``"freeze"``
              - ``("freeze_unfreeze", integer: unfreeze_epoch)``
              - ``("unfreeze_milestones", ((integer: unfreeze_epoch_num_layers, integer: unfreeze_epoch_all_layers),
                integer: num_layers))``
  
              where ``integer`` can be any integer.
              By default, ``no_freeze`` strategy will be used.
  
          train_bn: Whether to train Batch Norm layer
  
      """
      self._resolve_callbacks(model, strategy, train_bn=train_bn)
      return super().fit(
          model, train_dataloader, val_dataloaders, datamodule
      )
  
imports: import inspect
  import warnings
  from argparse import ArgumentParser, Namespace
  from functools import wraps
  from typing import Callable, List, Optional, Tuple, Union
  import torch
  from pytorch_lightning import LightningDataModule, LightningModule
  from pytorch_lightning import Trainer
  from pytorch_lightning.accelerators.tpu import TPUAccelerator
  from pytorch_lightning.callbacks import BaseFinetuning
  from pytorch_lightning.utilities.argparse import add_argparse_args, get_init_arguments_and_types, parse_env_variables
  from torch.utils.data import DataLoader
  import flash
  from flash.core.data.io.output import Output
  from flash.core.data.io.output_transform import OutputTransform
  from flash.core.data.io.transform_predictions import TransformPredictions
  from flash.core.model import Task
  from flash.core.registry import FlashRegistry
label_desc: Use image node_id 3 for calling the Trainer obj's underlying member method code with example usage: obj.finetune(model, train_dataloader, val_dataloaders, datamodule, strategy, train_bn) and returns: super