class_docstr: Basic DQN Model.
  
  >>> DQNLightning(env="CartPole-v1")  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
  DQNLightning(
    (net): DQN(
      (net): Sequential(...)
    )
    (target_net): DQN(
      (net): Sequential(...)
    )
  )
docstr: Carries out a single step through the environment to update the replay buffer. Then calculates loss based on
  the minibatch received.
  
  Args:
      batch: current mini batch of replay data
      nb_batch: batch number
  
  Returns:
      Training loss and log metrics
docstr_tok: ["Carries","out","a","single","step","through","the","environment","to","update","the","replay","buffer",".","Then","calculates","loss","based","on","the","minibatch","received",".","Args",":","batch",":","current","mini","batch","of","replay","data","nb_batch",":","batch","number","Returns",":","Training","loss","and","log","metrics"]
code: def training_step(
      self, batch: Tuple[torch.Tensor, torch.Tensor], nb_batch
  ) -> OrderedDict:
      """Carries out a single step through the environment to update the replay buffer. Then calculates loss based on
      the minibatch received.
  
      Args:
          batch: current mini batch of replay data
          nb_batch: batch number
  
      Returns:
          Training loss and log metrics
  
      """
      device = self.get_device(batch)
      epsilon = max(
          self.eps_end,
          self.eps_start - (self.global_step + 1) / self.eps_last_frame,
      )
  
      # step through environment with agent
      reward, done = self.agent.play_step(self.net, epsilon, device)
      self.episode_reward += reward
  
      # calculates training loss
      loss = self.dqn_mse_loss(batch)
  
      if done:
          self.total_reward = self.episode_reward
          self.episode_reward = 0
  
      # Soft update of target network
      if self.global_step % self.sync_rate == 0:
          self.target_net.load_state_dict(self.net.state_dict())
  
      log = {
          "total_reward": torch.tensor(self.total_reward).to(device),
          "reward": torch.tensor(reward).to(device),
          "steps": torch.tensor(self.global_step).to(device),
      }
  
      return OrderedDict(
          {"loss": loss, "log": log, "progress_bar": log}
      )
  
imports: import argparse
  from collections import OrderedDict, deque, namedtuple
  from typing import Iterator, List, Tuple
  import gym
  import numpy
  import torch
  import torch.nn
  import torch.optim
  from lightning.pytorch import LightningModule, Trainer, cli_lightning_logo, seed_everything
  from torch.optim.optimizer import Optimizer
  from torch.utils.data import DataLoader
  from torch.utils.data.dataset import IterableDataset
label_desc: Use image node_id 5 for calling the DQNLightning obj's underlying member method code with example usage: obj.training_step(batch, nb_batch) and returns: OrderedDict