code: def training_step(self, batch):
      inputs, labels = self.data.mask_tokens(batch)
  
      inputs = inputs.to(self.device)
      labels = labels.to(self.device)
  
      self.model.train()
  
      if self.is_fp16:
          with autocast():
              outputs = self.model(inputs, masked_lm_labels=labels)
      else:
          outputs = self.model(inputs, masked_lm_labels=labels)
  
      loss = outputs[0]
  
      if self.n_gpu > 1:
          loss = loss.mean()
      if self.grad_accumulation_steps > 1:
          loss = loss / self.grad_accumulation_steps
  
      if self.is_fp16:
          self.scaler.scale(loss).backward()
      else:
          loss.backward()
  
      return loss
  
file_path: fast-bert/fast_bert/learner_lm.py
imports: import os
  import torch
  from packaging import version
  from pathlib import Path
  import numpy
  from fastprogress.fastprogress import master_bar, progress_bar
  from tensorboardX import SummaryWriter
  from .learner_util import Learner
  from .data_lm import BertLMDataBunch
  from transformers import WEIGHTS_NAME, BertConfig, BertForMaskedLM, RobertaConfig, RobertaForMaskedLM, DistilBertConfig, DistilBertForMaskedLM, CamembertConfig, CamembertForMaskedLM, ElectraConfig, ElectraForMaskedLM
  from torch.optim.lr_scheduler import _LRScheduler, Optimizer
label_desc: Use image node_id 4 for calling the BertLMLearner obj's underlying member method code with example usage: obj.training_step(batch) and returns: loss