class_docstr: A wrapper class around a (`transformers.PreTrainedModel`) to be compatible with the
  (`~transformers.PreTrained`) class in order to keep some attributes and methods of the
  (`~transformers.PreTrainedModel`) class.
  
  Attributes:
      pretrained_model: (`transformers.PreTrainedModel`)
          The model to be wrapped.
      parent_class: (`transformers.PreTrainedModel`)
          The parent class of the model to be wrapped.
      supported_args: (`list`)
          The list of arguments that are supported by the wrapper class.
class_docstr_tok: ["A","wrapper","class","around","a","(","`","transformers.PreTrainedModel","`",")","to","be","compatible","with","the","(","`","~transformers.PreTrained","`",")","class","in","order","to","keep","some","attributes","and","methods","of","the","(","`","~transformers.PreTrainedModel","`",")","class",".","Attributes",":","pretrained_model",":","(","`","transformers.PreTrainedModel","`",")","The","model","to","be","wrapped",".","parent_class",":","(","`","transformers.PreTrainedModel","`",")","The","parent","class","of","the","model","to","be","wrapped",".","supported_args",":","(","`","list","`",")","The","list","of","arguments","that","are","supported","by","the","wrapper","class","."]
code: def _get_checkpoint_from_hub(
      cls,
      pretrained_model,
      pretrained_model_name_or_path,
      index_filename,
      token=None,
      model_name="pytorch_model.bin",
      model_index_name="pytorch_model.bin.index.json",
  ):
      files_to_download = None
      filename = None
      is_resuming_training = True
      is_sharded = False
  
      try:
          filename = hf_hub_download(
              pretrained_model_name_or_path,
              model_name,
              token=token,
          )
      # sharded
      except (
          EntryNotFoundError,
          LocalEntryNotFoundError,
          HFValidationError,
          RepositoryNotFoundError,
      ):
          if os.path.exists(index_filename):
              index_file_name = index_filename
          else:
              try:
                  index_file_name = hf_hub_download(
                      pretrained_model_name_or_path,
                      model_index_name,
                      token=token,
                  )
              except (
                  EntryNotFoundError,
                  LocalEntryNotFoundError,
                  HFValidationError,
                  RepositoryNotFoundError,
              ):
                  # not continue training, do not have v_head weight
                  is_resuming_training = False
                  logging.warning(
                      f"A {type(pretrained_model)} model is loaded from '{pretrained_model_name_or_path}', "
                      f"and no v_head weight is found. This IS expected if you are not resuming PPO training."
                  )
          # load json
          if is_resuming_training:
              with open(index_file_name, "r") as f:
                  index = json.load(f)
              # check filename with `v_head` or any known extra module:
              files_to_download = set()
              for k, v in index["weight_map"].items():
                  if any(
                      [module in k for module in cls.supported_modules]
                  ):
                      files_to_download.add(v)
              is_sharded = True
  
      return (
          filename,
          files_to_download,
          is_sharded,
          is_resuming_training,
      )
  
imports: import json
  import logging
  import os
  from copy import deepcopy
  import torch
  import torch.nn
  from accelerate import PartialState
  from huggingface_hub import hf_hub_download
  from huggingface_hub.utils import EntryNotFoundError, HFValidationError, LocalEntryNotFoundError, RepositoryNotFoundError
  from safetensors.torch import load_file
  from transformers import PreTrainedModel
  from ..import_utils import is_npu_available, is_peft_available, is_transformers_greater_than, is_xpu_available
label_desc: Use image node_id 3 for calling the PreTrainedModelWrapper obj's underlying member method code with example usage: obj._get_checkpoint_from_hub(cls, pretrained_model, pretrained_model_name_or_path, index_filename, token, model_name, model_index_name) and returns: filename,  files_to_download,  is_sharded,  is_resuming_training