class_docstr: A seq2seq model with a value head in addition to the language model head.
  This class inherits from `~trl.PreTrainedModelWrapper` and wraps a
  `transformers.PreTrainedModel` class. The wrapper class supports classic functions
  such as `from_pretrained` and `push_to_hub` and also provides some additional
  functionalities such as `generate`.
  
  Args:
      pretrained_model (`transformers.PreTrainedModel`):
          The model to wrap. It should be a causal language model such as GPT2.
          or any model mapped inside the `AutoModelForSeq2SeqLM` class.
      kwargs:
          Additional keyword arguments passed along to the `ValueHead` class.
class_docstr_tok: ["A","seq2seq","model","with","a","value","head","in","addition","to","the","language","model","head",".","This","class","inherits","from","`","~trl.PreTrainedModelWrapper","`","and","wraps","a","`","transformers.PreTrainedModel","`","class",".","The","wrapper","class","supports","classic","functions","such","as","`","from_pretrained","`","and","`","push_to_hub","`","and","also","provides","some","additional","functionalities","such","as","`","generate","`",".","Args",":","pretrained_model","(","`","transformers.PreTrainedModel","`",")",":","The","model","to","wrap",".","It","should","be","a","causal","language","model","such","as","GPT2",".","or","any","model","mapped","inside","the","`","AutoModelForSeq2SeqLM","`","class",".","kwargs",":","Additional","keyword","arguments","passed","along","to","the","`","ValueHead","`","class","."]
code: def __init__(self, pretrained_model, **kwargs):
      super().__init__(pretrained_model, **kwargs)
      v_head_kwargs, _, _ = self._split_kwargs(kwargs)
      self.is_encoder_decoder = True
  
      if not self._has_lm_head():
          raise ValueError(
              "The model does not have a language model head, please use a model that has one."
          )
  
      self.v_head = ValueHead(
          self.pretrained_model.config, **v_head_kwargs
      )
  
      self._init_weights(**v_head_kwargs)
  
imports: import torch
  import torch.nn
  from transformers import AutoModelForCausalLM, AutoModelForSeq2SeqLM
  from .modeling_base import PreTrainedModelWrapper
label_desc: Use image node_id 1 to create a new AutoModelForSeq2SeqLMWithValueHead object from inherited base classes: PreTrainedModelWrapper with example: obj = AutoModelForSeq2SeqLMWithValueHead(pretrained_model)