code: def unwrap_model_fn(model: torch.nn.Module) -> torch.nn.Module:
      """Helper function to unwrap the model.
  
      Args:
          model: An instance of torch.nn.Module.
  
      Returns:
          Unwrapped instance of torch.nn.Module.
      """
      unwrapped_model = model
      while True:
          if hasattr(unwrapped_model, "module"):
              # added by DataParallel and DistributedDataParallel
              unwrapped_model = unwrapped_model.module
          elif hasattr(unwrapped_model, "_fsdp_wrapped_module"):
              # added by FSDP
              unwrapped_model = unwrapped_model._fsdp_wrapped_module
          else:
              break
      return unwrapped_model
  
file_path: ml-cvnets/utils/common_utils.py
imports: import os
  import random
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import torch
  from packaging import version
  from torch import Tensor
  from common import MIN_TORCH_VERSION
  from utils import logger
  from utils.ddp_utils import is_master
label_desc: Use image node_id 1 for calling a global function with example usage: unwrap_model_fn(model) and returns: unwrapped_model