code: def __init__(
      self,
      prompt_model,
      max_length=20,
      max_len_a=0.0,
      num_beams=1,
      do_sample=False,
      bos_token_id=None,
      eos_token_id=None,
      repetition_penalty=1,
      length_penalty=1.0,
      pad_token_id=0,
      restricter=None,
  ):
      super(PromptGeneratorModel, self).__init__()
      self.prompt_model = prompt_model
      self.decoder = prompt_model.prompt_decoder
  
      self.generate_func = partial(
          greedy_generate,
          decoder=self.decoder,
          max_length=max_length,
          max_len_a=max_len_a,
          num_beams=num_beams,
          bos_token_id=bos_token_id,
          eos_token_id=eos_token_id,
          repetition_penalty=repetition_penalty,
          length_penalty=length_penalty,
          pad_token_id=pad_token_id,
          restricter=restricter,
      )
      self.do_sample = do_sample
      self.max_length = max_length
      self.num_beams = num_beams
      self.bos_token_id = bos_token_id
      self.eos_token_id = eos_token_id
      self.repetition_penalty = repetition_penalty
      self.length_penalty = length_penalty
      self.pad_token_id = pad_token_id
      self.restricter = restricter
      self.max_len_a = max_len_a
  
imports: import torch
  from torch import nn
  from torch.nn import functional
  from transformers.models.bart.configuration_bart import BartConfig
  from .modeling_bart import BartModel
  from ..utils.util import avg_token_embeddings, seq_to_mask, get_model_device
  from functools import partial
  from typing import Union
label_desc: Use image node_id 1 to create a new PromptGeneratorModel object from inherited base classes: nn with example: obj = PromptGeneratorModel(prompt_model, max_length, max_len_a, num_beams, do_sample, bos_token_id, eos_token_id, repetition_penalty, length_penalty, pad_token_id, restricter)