docstr: Define model layers & loss.
docstr_tok: ["Define","model","layers","&","loss","."]
code: def __build_model(self):
      """Define model layers & loss."""
      # 1. Load pre-trained network:
      backbone = get_torchvision_model(self.backbone, weights="DEFAULT")
  
      _layers = list(backbone.children())[:-1]
      self.feature_extractor = nn.Sequential(*_layers)
  
      # 2. Classifier:
      _fc_layers = [
          nn.Linear(2048, 256),
          nn.ReLU(),
          nn.Linear(256, 32),
          nn.Linear(32, 1),
      ]
      self.fc = nn.Sequential(*_fc_layers)
  
      # 3. Loss:
      self.loss_func = F.binary_cross_entropy_with_logits
  
imports: import logging
  from pathlib import Path
  from typing import Union
  import torch
  import torch.nn.functional
  from lightning.pytorch import LightningDataModule, LightningModule, cli_lightning_logo
  from lightning.pytorch.callbacks.finetuning import BaseFinetuning
  from lightning.pytorch.cli import LightningCLI
  from lightning.pytorch.utilities import rank_zero_info
  from lightning.pytorch.utilities.model_helpers import get_torchvision_model
  from torch import nn, optim
  from torch.optim.lr_scheduler import MultiStepLR
  from torch.optim.optimizer import Optimizer
  from torch.utils.data import DataLoader
  from torchmetrics import Accuracy
  from torchvision import transforms
  from torchvision.datasets import ImageFolder
  from torchvision.datasets.utils import download_and_extract_archive
label_desc: Use image node_id 2 for calling the TransferLearningModel obj's underlying member method code with example usage: obj.__build_model() without return types