class_docstr: Saves and loads training checkpoints on a file system.
class_docstr_tok: ["Saves","and","loads","training","checkpoints","on","a","file","system","."]
code: def load_last_consolidated_model(
      self, out: Module, device: Optional[Device] = None
  ) -> int:
      if self.gang.rank == 0:
          last_step_nr = self.get_last_step_number(with_model=True)
          if last_step_nr is None:
              raise CheckpointNotFoundError(
                  "No checkpoint can be found."
              )
      else:
          last_step_nr = 0
  
      self.load_consolidated_model(last_step_nr, out, device)
  
      return last_step_nr
  
imports: from abc import ABC, abstractmethod
  from os import scandir
  from pathlib import Path
  from pickle import PickleError
  from shutil import rmtree
  from typing import Any, Dict, Iterator, List, Optional, Tuple, final
  import torch
  from torch.distributed.fsdp import FullyShardedDataParallel
  from torch.distributed.fsdp.api import FullStateDictConfig, StateDictType
  from torch.nn import Module
  from fairseq2.gang import Gang
  from fairseq2.models.utils.checkpoint import load_checkpoint
  from fairseq2.nn.utils.module import infer_device, reset_non_persistent_buffers, to_empty
  from fairseq2.typing import CPU, META, Device, finaloverride
label_desc: Use image node_id 9 for calling the FileCheckpointManager obj's underlying member method code with example usage: obj.load_last_consolidated_model(out, device) and returns: last_step_nr