code: def check_model_ranks(model: ExampleModel):
      basedir = os.path.join("./ddp_check/", "default", "version_0")
      file_template = "nemo_log_globalrank-{rank}_localrank-{rank}.txt"
  
      world_size = torch.cuda.device_count()
      for rank in range(world_size):
          filename = file_template.format(rank=rank)
          filepath = os.path.join(basedir, filename)
  
          with open(filepath, "r", encoding="utf-8") as f:
              texts = f.readlines()
              texts = [t.replace("\n", "") for t in texts]
  
          log_global_rank = get_rank_info(
              texts, rank_key="M.Global Rank"
          )
          log_world_size = get_rank_info(texts, rank_key="M.World Size")
  
          if log_global_rank != rank:
              print(
                  "Logged global rank is not equal to trainer.global_rank !"
              )
              exit(1)
  
          if log_world_size != world_size:
              print(
                  "Logged world size if not equal to trainer.world_size !"
              )
              exit(1)
  
imports: import os
  import shutil
  import torch
  from omegaconf import OmegaConf
  from pytorch_lightning import Trainer
  from pytorch_lightning.utilities import rank_zero_only
  from nemo.core import ModelPT
  from nemo.utils import logging
  from nemo.utils.exp_manager import ExpManagerConfig, exp_manager
label_desc: Use image node_id 4 for calling a global function with example usage: check_model_ranks(model) without return types