estimateWhisperPeakRam

Estimates the peak RAM needed to run the Whisper model described by header with whisper.cpp (one state).

  • weights: WhisperModelHeader.tensorDataBytes;

  • KV cache (F16): self-attention n_text_layer * n_text_ctx * n_text_state * 2 plus cross-attention n_text_layer * n_audio_ctx * n_text_state * 2 elements;

  • compute: encoder activations n_audio_ctx * n_audio_state * 4 * 24 plus decoder logits n_vocab * n_text_ctx * 4 (heuristic);

  • overhead: 16 MiB.

Throws

if the estimate overflows a Long (implausible hyper-parameters).