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: Save the pretrained model to a directory. This method is a wrapper around
  `transformers.PreTrainedModel.save_pretrained`. Please refer to the documentation
  of `transformers.PreTrainedModel.save_pretrained` for more information.
  
  Args:
      *args (`list`, *optional*):
          Positional arguments passed along to the underlying model's
          `save_pretrained` method.
      **kwargs (`dict`, *optional*):
          Keyword arguments passed along to the underlying model's
          `save_pretrained` method.
docstr_tok: ["Save","the","pretrained","model","to","a","directory",".","This","method","is","a","wrapper","around","`","transformers.PreTrainedModel.save_pretrained","`",".","Please","refer","to","the","documentation","of","`","transformers.PreTrainedModel.save_pretrained","`","for","more","information",".","Args",":","*","args","(","`","list","`",",","*","optional","*",")",":","Positional","arguments","passed","along","to","the","underlying","model's","`","save_pretrained","`","method",".","*","*","kwargs","(","`","dict","`",",","*","optional","*",")",":","Keyword","arguments","passed","along","to","the","underlying","model's","`","save_pretrained","`","method","."]
code: def save_pretrained(self, *args, **kwargs):
      r"""
      Save the pretrained model to a directory. This method is a wrapper around
      `transformers.PreTrainedModel.save_pretrained`. Please refer to the documentation
      of `transformers.PreTrainedModel.save_pretrained` for more information.
  
      Args:
          *args (`list`, *optional*):
              Positional arguments passed along to the underlying model's
              `save_pretrained` method.
          **kwargs (`dict`, *optional*):
              Keyword arguments passed along to the underlying model's
              `save_pretrained` method.
      """
      state_dict = kwargs.get("state_dict")
      if state_dict is None:
          state_dict = self.state_dict()
          kwargs["state_dict"] = state_dict
  
      # if it is a peft model only save the `v_head` state_dict and
      # pop the `state_dict` from the kwargs to avoid slient bugs with `peft`
      if self.is_peft_model:
          save_path = args[0]
          save_path = os.path.join(save_path, "pytorch_model.bin")
          torch.save(state_dict, save_path)
          _ = kwargs.pop("state_dict", None)
  
      return self.pretrained_model.save_pretrained(*args, **kwargs)
  
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 8 for calling the PreTrainedModelWrapper obj's underlying member method code with example usage: obj.save_pretrained() and returns: self