docstr: TransferLearningModel.
  
  Args:
      backbone: Name (as in ``torchvision.models``) of the feature extractor
      train_bn: Whether the BatchNorm layers should be trainable
      milestones: List of two epochs milestones
      lr: Initial learning rate
      lr_scheduler_gamma: Factor by which the learning rate is reduced at each milestone
code: def __init__(
      self,
      backbone: str = "resnet18",
      milestones: tuple = (5, 10),
      lr: float = 1e-3,
      lr_scheduler_gamma: float = 1e-1,
      num_workers: int = 6,
      **kwargs,
  ) -> None:
      """TransferLearningModel.
  
      Args:
          backbone: Name (as in ``torchvision.models``) of the feature extractor
          train_bn: Whether the BatchNorm layers should be trainable
          milestones: List of two epochs milestones
          lr: Initial learning rate
          lr_scheduler_gamma: Factor by which the learning rate is reduced at each milestone
      """
      super().__init__()
      self.backbone = backbone
      self.milestones = milestones
      self.lr = lr
      self.lr_scheduler_gamma = lr_scheduler_gamma
      self.num_workers = num_workers
  
      self.__build_model()
  
      self.train_acc = MulticlassAccuracy(num_classes=2)
      self.valid_acc = MulticlassAccuracy(num_classes=2)
      self.save_hyperparameters()
  
imports: import logging
  from pathlib import Path
  from typing import Union
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn, optim
  from torch.optim.lr_scheduler import MultiStepLR
  from torch.optim.optimizer import Optimizer
  from torch.utils.data import DataLoader, Subset
  from torchmetrics.classification import MulticlassAccuracy
  from torchvision import models, transforms
  from torchvision.datasets import ImageFolder
  from torchvision.datasets.utils import download_and_extract_archive
  from pytorch_lightning import LightningDataModule, LightningModule
  from pytorch_lightning.callbacks.finetuning import BaseFinetuning
  from pytorch_lightning.utilities.rank_zero import rank_zero_info
label_desc: Use image node_id 1 to create a new TransferLearningModel object from inherited base classes: LightningModule with example: obj = TransferLearningModel(backbone, milestones, lr, lr_scheduler_gamma, num_workers)