class_docstr: A base class for offloading optimizer states.
  
  Args:
      params: parameters
      defaults (dict): default dict
      nvme_offload_fraction (float, optional): Fraction of params to be offloaded to NVMe. Defaults to 0.0.
      offload_dir (Optional[str], optional): Directory to save NVMe offload files.
          If it's ``None``, a random temporary directory will be used. Defaults to None.
  
  Raises:
      ImportError: Raise if ``tensornvme`` is not installed.
class_docstr_tok: ["A","base","class","for","offloading","optimizer","states",".","Args",":","params",":","parameters","defaults","(","dict",")",":","default","dict","nvme_offload_fraction","(","float",",","optional",")",":","Fraction","of","params","to","be","offloaded","to","NVMe",".","Defaults","to","0.0.","offload_dir","(","Optional","[","str","]",",","optional",")",":","Directory","to","save","NVMe","offload","files",".","If","it","'s","``","None","``",",","a","random","temporary","directory","will","be","used",".","Defaults","to","None",".","Raises",":","ImportError",":","Raise","if","``","tensornvme","``","is","not","installed","."]
code: def _pre_step(self, *state_keys: str) -> None:
      if self.total_numel is None:
          self.total_numel = self._get_numel()
          self.can_offload_numel = math.floor(
              self.total_numel * self.nvme_offload_fraction
          )
      self._setup_prefetch_params()
      if self.offloader is None or len(self.prefetch_params) == 0:
          return
      state = self.state[self.prefetch_params[0]]
      for key in state_keys:
          self.offloader.async_read(state[key])
  
file_path: colossalai/colossalai/nn/optimizer/nvme_optimizer.py
imports: import math
  import os
  import tempfile
  from typing import Callable, Dict, List, Optional
  import torch
  from torch.nn.parameter import Parameter
label_desc: Use image node_id 5 for calling the NVMeOptimizer obj's underlying member method code with example usage: obj._pre_step() without return types