code: def training_step(self, batch, batch_idx):
      x, y = batch
      y_hat = self.backbone(x)
      if self.hard_mining:
          loss = torch.abs(y_hat - y)  # (B,K)
          loss = torch.mean(loss, dim=1)  # (B,)
          B = len(loss)
          S = int(B * 0.5)
          loss, _ = torch.sort(loss, descending=True)
          loss = loss[:S]
          loss = torch.mean(loss) * 5.0
      else:
          loss = self.loss(y_hat, y) * 5.0
      self.log("train_loss", loss, on_epoch=True)
      return loss
  
imports: from argparse import ArgumentParser
  import os
  import os.path
  import torch
  import torch.nn
  from torch.nn import functional
  from torch.utils.data import DataLoader
  import pytorch_lightning
  from pytorch_lightning.callbacks import ModelCheckpoint
  from pytorch_lightning.callbacks import LearningRateMonitor
  from pytorch_lightning.loggers import TensorBoardLogger
  import timm
  from datasets.dataset_synthetics import FaceDataset, DataLoaderX
label_desc: Use image node_id 3 for calling the FaceSynthetics obj's underlying member method code with example usage: obj.training_step(batch, batch_idx) and returns: loss