class_docstr: Speech Representation Using Encoder Outputs from OpenAI's Whisper Model:
  
  URL: https://github.com/openai/whisper
class_docstr_tok: ["Speech","Representation","Using","Encoder","Outputs","from","OpenAI","'s","Whisper","Model",":","URL",":","https",":","\/\/github.com\/openai\/whisper"]
code: def __init__(
      self,
      whisper_model: str = "small",
      freeze_weights: bool = True,
      download_dir: str = None,
  ):
      try:
          import whisper
          from whisper.audio import HOP_LENGTH, N_FFT, N_MELS
      except Exception as e:
          print("Error: whisper is not properly installed.")
          print(
              "Please install whisper with: cd ${MAIN_ROOT}/tools && "
              "./installers/install_whisper.sh"
          )
          raise e
  
      assert check_argument_types()
      super().__init__()
  
      self.n_fft = N_FFT
      self.win_length = N_FFT
      self.hop_length = HOP_LENGTH
      self.n_mels = N_MELS
  
      self.mel_filters = whisper.audio.mel_filters
      self.pad_or_trim = whisper.pad_or_trim
  
      assert whisper_model in whisper.available_models()
      self.whisper = whisper.load_model(
          whisper_model, download_root=download_dir
      )
      self.whisper.eval()
  
      self.freeze_weights = freeze_weights
  
file_path: espnet/espnet2/asr/frontend/whisper.py
imports: import contextlib
  from typing import Tuple
  import torch
  import torch.nn.functional
  from typeguard import check_argument_types
  from espnet2.asr.frontend.abs_frontend import AbsFrontend
label_desc: Use image node_id 1 to create a new WhisperFrontend object from inherited base classes: AbsFrontend with example: obj = WhisperFrontend(whisper_model, freeze_weights, download_dir)