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","."]
docstr: Get the current device. For GPU, we return the local process index using the `accelerate.PartialState`
  object to handle corner cases when running scripts in distributed environments.
  
  Returns:
      current_device (`Union[int, str]`):
          The current device.
docstr_tok: ["Get","the","current","device",".","For","GPU",",","we","return","the","local","process","index","using","the","`","accelerate.PartialState","`","object","to","handle","corner","cases","when","running","scripts","in","distributed","environments",".","Returns",":","current_device","(","`","Union","[","int",",","str","]","`",")",":","The","current","device","."]
code: def _get_current_device(cls):
      r"""
      Get the current device. For GPU, we return the local process index using the `accelerate.PartialState`
      object to handle corner cases when running scripts in distributed environments.
  
      Returns:
          current_device (`Union[int, str]`):
              The current device.
      """
      state = PartialState()
      if is_xpu_available():
          return f"xpu:{state.local_process_index}"
      elif is_npu_available():
          return f"npu:{state.local_process_index}"
      else:
          return (
              state.local_process_index
              if torch.cuda.is_available()
              else "cpu"
          )
  
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 4 for calling the PreTrainedModelWrapper obj's underlying member method code with example usage: obj._get_current_device(cls) and returns: str, state, str, state, unknown