class_docstr: This lobe enables the integration of HuggingFace pretrained Whisper model.
  
  Source paper whisper:
      https://cdn.openai.com/papers/whisper.pdf
  Transformer from HuggingFace needs to be installed:
  https://huggingface.co/transformers/installation.html
  
  Some part of the code also cis adapted from the official OpenAI repository:
  https://github.com/openai/whisper
  
  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 "openai/whisper-tiny"
  save_path : str
      Path (dir) of the downloaded model.
  sampling_rate : int (default: 16000)
      Sampling rate of the audio signal.
  encoder_only : bool (default: False)
      If True, the forward function outputs the hidden states from the last transformer layer of the encoder.
      If False, one step of the decoder is performed and returned.
  freeze : bool (default: False)
      If True, the model is frozen.
  freeze_encoder : bool (default: False)
      If True, the encoder is frozen.
  output_attentions : bool (default: True)
      If True, the forward function outputs the attention weights.
  output_all_hiddens: bool (default: False)
      If True, the forward function outputs the hidden states from all transformer layers of the encoder.
      For example whisper-base has 6 transformer layers and the output is of shape (7, B, T, C),
      where the output of the CNN output is added to the beginning.
      If False, the forward function outputs the hidden states only from the last transformer layer of the encoder.
  
  Example
  -------
  >>> model_hub = "openai/whisper-tiny"
  >>> save_path = "savedir"
  >>> sampling_rate = 16000
  >>> model = Whisper(model_hub, save_path, sampling_rate)
  >>> tokens = torch.tensor([[1, 1]]) * model.model.config.decoder_start_token_id
  >>> inputs = torch.randn([1, 93680])
  >>> outputs = model(inputs, tokens)
class_docstr_tok: ["This","lobe","enables","the","integration","of","HuggingFace","pretrained","Whisper","model",".","Source","paper","whisper",":","https",":","\/\/cdn.openai.com\/papers\/whisper.pdf","Transformer","from","HuggingFace","needs","to","be","installed",":","https",":","\/\/huggingface.co\/transformers\/installation.html","Some","part","of","the","code","also","cis","adapted","from","the","official","OpenAI","repository",":","https",":","\/\/github.com\/openai\/whisper","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","``","openai\/whisper-tiny","''","save_path",":","str","Path","(","dir",")","of","the","downloaded","model",".","sampling_rate",":","int","(","default",":","16000",")","Sampling","rate","of","the","audio","signal",".","encoder_only",":","bool","(","default",":","False",")","If","True",",","the","forward","function","outputs","the","hidden","states","from","the","last","transformer","layer","of","the","encoder",".","If","False",",","one","step","of","the","decoder","is","performed","and","returned",".","freeze",":","bool","(","default",":","False",")","If","True",",","the","model","is","frozen",".","freeze_encoder",":","bool","(","default",":","False",")","If","True",",","the","encoder","is","frozen",".","output_attentions",":","bool","(","default",":","True",")","If","True",",","the","forward","function","outputs","the","attention","weights",".","output_all_hiddens",":","bool","(","default",":","False",")","If","True",",","the","forward","function","outputs","the","hidden","states","from","all","transformer","layers","of","the","encoder",".","For","example","whisper-base","has","6","transformer","layers","and","the","output","is","of","shape","(","7",",","B",",","T",",","C",")",",","where","the","output","of","the","CNN","output","is","added","to","the","beginning",".","If","False",",","the","forward","function","outputs","the","hidden","states","only","from","the","last","transformer","layer","of","the","encoder",".","Example","--","--","--","-",">",">",">","model_hub","=","``","openai\/whisper-tiny","''",">",">",">","save_path","=","``","savedir","''",">",">",">","sampling_rate","=","16000",">",">",">","model","=","Whisper","(","model_hub",",","save_path",",","sampling_rate",")",">",">",">","tokens","=","torch.tensor","(","[","[","1",",","1","]","]",")","*","model.model.config.decoder_start_token_id",">",">",">","inputs","=","torch.randn","(","[","1",",","93680","]",")",">",">",">","outputs","=","model","(","inputs",",","tokens",")"]
docstr: Perform one step of the whisper encoder with Mel FBANKs as Input.
  
  Arguments
  ---------
  wav : torch.Tensor (FBANKs)
      A batch of Mel FBANK from HF to transform to features.
docstr_tok: ["Perform","one","step","of","the","whisper","encoder","with","Mel","FBANKs","as","Input",".","Arguments","--","--","--","--","-","wav",":","torch.Tensor","(","FBANKs",")","A","batch","of","Mel","FBANK","from","HF","to","transform","to","features","."]
code: def forward_encoder(self, wav):
      """Perform one step of the whisper encoder with Mel FBANKs as Input.
  
      Arguments
      ---------
      wav : torch.Tensor (FBANKs)
          A batch of Mel FBANK from HF to transform to features.
      """
  
      if self.freeze_encoder:
          with torch.no_grad():
              return self._get_encoder_states(wav)
      else:
          return self._get_encoder_states(wav)
  
file_path: speechbrain/speechbrain/lobes/models/huggingface_transformers/whisper.py
imports: import torch
  import logging
  from torch import nn
  from speechbrain.lobes.models.huggingface_transformers.huggingface import HFTransformersInterface
label_desc: Use image node_id 4 for calling the Whisper obj's underlying member method code with example usage: obj.forward_encoder(wav) and returns: self, self