class_docstr: This lobe enables the integration of HuggingFace pretrained GPT model.
   Source paper whisper:
      https://life-extension.github.io/2020/05/27/GPT%E6%8A%80%E6%9C%AF%E5%88%9D%E6%8E%A2/language-models.pdf
  Transformer from HuggingFace needs to be installed:
      https://huggingface.co/transformers/installation.html
  
  The model can be finetuned. It will download automatically the model from
  HuggingFace or use a local path.
  
  Arguments
  ---------
  source : str
      HuggingFace hub name: e.g "gpt2"
  save_path : str
      Path (dir) of the downloaded model.
  freeze : bool (default: False)
      If True, the model is frozen. If False, the model will be trained
      alongside with the rest of the pipeline.
  Example
  -------
  >>> model_hub = "gpt2"
  >>> save_path = "savedir"
  >>> model = GPT(model_hub, save_path)
  >>> tokens = torch.tensor([[1, 1]])
  >>> tokens_type = torch.tensor([[1, 1]])
  >>> attention_mask = torch.tensor([[1, 1]])
  >>> outputs = model(tokens, tokens_type, attention_mask)
code: def __init__(
      self,
      source,
      save_path,
      freeze=False,
      max_new_tokens=200,
      min_length=1,
      top_k=45,
      top_p=0.9,
      num_beams=8,
      eos_token_id=50258,
      early_stopping=True,
  ) -> None:
      super().__init__(
          source=source,
          save_path=save_path,
          freeze=freeze,
          with_lm_head=True,
      )
      self.max_new_tokens = max_new_tokens
      self.min_length = min_length
      self.top_k = top_k
      self.top_p = top_p
      self.num_beams = num_beams
      self.early_stopping = early_stopping
      self.eos_token_id = eos_token_id
  
      self.load_tokenizer(source=source, pad_token=None, use_fast=False)
  
      if self.freeze:
          logger.warning("huggingface_GPT - GPT  is frozen.")
          self.model.train()  # we keep it to train to have dropout and LN computed adequaly
          for param in self.model.parameters():
              param.requires_grad = False
  
file_path: speechbrain/speechbrain/lobes/models/huggingface_transformers/gpt.py
imports: import logging
  from torch import Tensor
  import torch
  from speechbrain.lobes.models.huggingface_transformers.huggingface import HFTransformersInterface
label_desc: Use image node_id 1 to create a new GPT object from inherited base classes: HFTransformersInterface with example: obj = GPT(source, save_path, freeze, max_new_tokens, min_length, top_k, top_p, num_beams, eos_token_id, early_stopping)