code: def __init__(self, config, tokenizer):
      super(PTG, self).__init__(config, tokenizer)
  
      prompt_source = torch.load(config["prompt_source_path"])
      source_task = config["source_task"]
      self.lam = config["ptg_lambda"]
      if source_task in source_task_set:
          source_task = source_task_set[source_task]
      self.task_embedding = [
          prompt_source[task] for task in source_task
      ]
      self.task_embedding = torch.stack(self.task_embedding).to(
          self.device
      )  # tn, pl, e
      self.embedding_size = self.model.config.hidden_size
  
      assert self.model.config.hidden_size == self.task_embedding.size(
          -1
      ), "PTG only supports BART-large!"
  
      self.bert_tokenizer = AutoTokenizer.from_pretrained(
          config["bert_model_path"]
      )
      self.bert_model = AutoModel.from_pretrained(
          config["bert_model_path"]
      )
  
      self.task_num = self.task_embedding.size(0)
      self.head_num = self.model.config.num_attention_heads
      self.head_dim = self.embedding_size // self.head_num
      self.scaling = self.head_dim**-0.5
      self.k_proj = nn.Linear(self.embedding_size, self.embedding_size)
      self.v_proj = nn.Linear(self.embedding_size, self.embedding_size)
      self.q_proj = nn.Linear(self.embedding_size, self.embedding_size)
      self.out_proj = nn.Linear(
          self.embedding_size, self.embedding_size
      )
      self.task_key = nn.Embedding(
          self.task_num + 1, self.embedding_size
      )  # tn+1, e
      self.model.requires_grad_(True)
      self.bert_model.requires_grad_(False)
  
file_path: TextBox/textbox/model/ptg.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from .pretrained_models import Pretrained_Models
  from transformers import AutoTokenizer, AutoModel
label_desc: Use image node_id 1 to create a new PTG object from inherited base classes: Pretrained_Models with example: obj = PTG(config, tokenizer)