code: def __init__(self, dims: ModelDimensions):
      super().__init__()
      self.dims = dims
      self.encoder = AudioEncoder(
          self.dims.n_mels,
          self.dims.n_audio_ctx,
          self.dims.n_audio_state,
          self.dims.n_audio_head,
          self.dims.n_audio_layer,
      )
      self.decoder = TextDecoder(
          self.dims.n_vocab,
          self.dims.n_text_ctx,
          self.dims.n_text_state,
          self.dims.n_text_head,
          self.dims.n_text_layer,
      )
      # use the last half among the decoder layers for time alignment by default;
      # to use a specific set of heads, see `set_alignment_heads()` below.
      all_heads = torch.zeros(
          self.dims.n_text_layer,
          self.dims.n_text_head,
          dtype=torch.bool,
      )
      all_heads[self.dims.n_text_layer // 2 :] = True
      self.register_buffer(
          "alignment_heads", all_heads.to_sparse(), persistent=False
      )
  
imports: import base64
  import gzip
  from dataclasses import dataclass
  from typing import Dict, Iterable, Optional
  import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor, nn
  from .decoding import decode
  from .decoding import detect_language
  from .transcribe import transcribe
label_desc: Use image node_id 1 to create a new Whisper object from inherited base classes: nn with example: obj = Whisper(dims)