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 __init__(
      self,
      pretrained_model=None,
      score_module=None,
      supports_rm_adapter=False,
      rm_adapter_name=None,
      **kwargs,
  ):
      super().__init__()
      self.pretrained_model = pretrained_model
  
      self.config = pretrained_model.config
      self.prepare_inputs_for_generation = (
          pretrained_model.prepare_inputs_for_generation
      )
      self.is_loaded_in_8bit = getattr(
          pretrained_model, "is_loaded_in_8bit", False
      )
      self.is_loaded_in_4bit = getattr(
          pretrained_model, "is_loaded_in_4bit", False
      )
      self.is_sequential_parallel = False
  
      if hasattr(pretrained_model, "gradient_checkpointing_disable"):
          self.gradient_checkpointing_disable = (
              pretrained_model.gradient_checkpointing_disable
          )
  
      if hasattr(pretrained_model, "gradient_checkpointing_enable"):
          self.gradient_checkpointing_enable = (
              pretrained_model.gradient_checkpointing_enable
          )
  
      self.supports_rm_adapter = supports_rm_adapter
      self.rm_adapter_name = rm_adapter_name
      self.policy_adapter_name = "default"
      if score_module is not None:
          self.score = score_module
  
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 1 to create a new PreTrainedModelWrapper object from inherited base classes: nn with example: obj = PreTrainedModelWrapper(pretrained_model, score_module, supports_rm_adapter, rm_adapter_name)