code: def load_model_checkpoint(model, rank, cfg):
      """load local checkpoint to rank0 cpu
      must be called * before * passing to FSDP"""
  
      if rank != 0:
          return
  
      # where is the checkpoint at...
      full_state_dict_model_path = (
          Path.cwd()
          / cfg.checkpoint_folder
          / cfg.checkpoint_model_filename
      )
      # is it present...
      if not full_state_dict_model_path.is_file():
          print(
              f"model checkpoint {full_state_dict_model_path} not present. Returning..."
          )
          return
  
      model_checkpoint = torch.load(full_state_dict_model_path)
      # integrate into loaded model
      model.load_state_dict(model_checkpoint)
  
      print(f"model checkpoint loaded to rank0 cpu")
  
file_path: llama-recipes/src/llama_recipes/model_checkpointing/checkpoint_handler.py
imports: from pathlib import Path
  from datetime import datetime
  import torch
  import time
  from torch.distributed.fsdp import FullyShardedDataParallel, StateDictType, FullStateDictConfig, LocalStateDictConfig
  from torch.distributed._shard.checkpoint import FileSystemReader, FileSystemWriter, save_state_dict, load_state_dict
  from torch.distributed.checkpoint.default_planner import DefaultSavePlanner, DefaultLoadPlanner
  from torch.distributed.fsdp.fully_sharded_data_parallel import StateDictType
  import torch.distributed._shard.checkpoint
  import torch.distributed
label_desc: Use image node_id 5 for calling a global function with example usage: load_model_checkpoint(model, rank, cfg) without return types