N Neurarch Architectures Checks Docs Open the app

Architectures / Audio

🎙️ Whisper Small

Whisper speech encoder-decoder — conv1d audio stem + transformer encoder/decoder (384D)

Layers
17
Parameters
46.99M
Input
1 × 80 × 3000
Output
1 × 448 × 51865
Verifier
2 advisories

Every number on this page is computed from the graph by the same functions the app runs, not written by hand.

Open Whisper Small on the canvas Free, no account needed

When to pick it

Pick for ASR or as a pretrained audio encoder — drop the decoder + add a head for audio classification (UrbanSound, ESC-50).

Structure

17 layers. Output shapes are propagated from the input shape, batch dimension excluded.

LayerTypeParametersOutput shape
1mel_featuresInputshape=[1, 80, 3000]1 × 80 × 3000
2conv1Audio ConvoutChannels=384, kernelSize=3, stride=11 × 384 × 3000
3gelu_1GELU1 × 384 × 3000
4conv2Audio ConvoutChannels=384, kernelSize=3, stride=21 × 384 × 1500
5gelu_2GELU1 × 384 × 1500
6enc_pos_embPositional EncodingembedDim=384, maxLen=15001 × 384 × 1500
7enc_block_1Transformer BlockembedDim=384, numHeads=6, ffDim=15361 × 384 × 1500
8enc_block_2Transformer BlockembedDim=384, numHeads=6, ffDim=15361 × 384 × 1500
9enc_normLayerNormnormalizedShape=3841 × 384 × 1500
10decoder_tokensInputshape=[1, 448]1 × 448
11token_embedEmbedding1 × 448 × 384
12dec_pos_embPositional EncodingembedDim=384, maxLen=4481 × 448 × 384
13dec_block_1Transformer BlockembedDim=384, numHeads=6, ffDim=15361 × 448 × 384
14dec_block_2Transformer BlockembedDim=384, numHeads=6, ffDim=15361 × 448 × 384
15dec_normLayerNormnormalizedShape=3841 × 448 × 384
16lm_headLinearoutFeatures=518651 × 448 × 51865
17token_logitsOutput1 × 448 × 51865

What the verifier says

The same 41 structural checks that run on every edit in the app, on this graph.

warntransformerBlock 'enc_block_1': embedDim=384 but upstream last dim is 1500; attention expects them equal (project the input or fix embedDim) (enc_block_1)
attention-in-mismatch
warntransformerBlock 'enc_block_2': embedDim=384 but upstream last dim is 1500; attention expects them equal (project the input or fix embedDim) (enc_block_2)
attention-in-mismatch

The PyTorch it exports

Generated from the graph above. First 46 lines; the app exports the whole file, plus the training loop, the data contract and a deploy bundle.

# Architecture designed with Neurarch: https://neurarch.com
# PyTorch: compatible with Python 3.8+ and torch>=1.12
# Colab: pip install torch torchvision  (usually pre-installed)
# Audio: pip install torchaudio

import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
import torchaudio

class WhisperSmall(nn.Module):
    def __init__(self):
        super().__init__()

        self.audioConv_1 = nn.Conv1d(1, 384, kernel_size=3, stride=1, padding=1)
        self.gelu_1 = nn.GELU()
        self.audioConv_2 = nn.Conv1d(1, 384, kernel_size=3, stride=2, padding=1)
        self.gelu_2 = nn.GELU()
        self.transformerBlock_1 = nn.TransformerEncoderLayer(d_model=384, nhead=6, dim_feedforward=1536, batch_first=True)
        self.transformerBlock_2 = nn.TransformerEncoderLayer(d_model=384, nhead=6, dim_feedforward=1536, batch_first=True)
        self.layerNorm_1 = nn.LayerNorm(1500)
        self.embedding_1 = nn.Embedding(51865, 384)
        self.transformerBlock_3 = nn.TransformerDecoderLayer(d_model=384, nhead=6, dim_feedforward=1536, batch_first=True)
        self.transformerBlock_4 = nn.TransformerDecoderLayer(d_model=384, nhead=6, dim_feedforward=1536, batch_first=True)
        self.layerNorm_2 = nn.LayerNorm(384)
        self.linear_1 = nn.Linear(384, 51865)

    def forward(self, src, tgt=None):
        # mel_features shape: [1,80,3000]
        # decoder_tokens shape: [1,448]
        audio_conv_Conv_1 = self.audioConv_1(src)
        gelu_gelu_1 = self.gelu_1(audio_conv_Conv_1)
        audio_conv_Conv_2 = self.audioConv_2(gelu_gelu_1)
        gelu_gelu_2 = self.gelu_2(audio_conv_Conv_2)
        # positionalEncoding: add positional encoding externally (e.g. sinusoidal or learned PE)
        transformer_block__enc_1 = self.transformerBlock_1(gelu_gelu_2)
        transformer_block__enc_2 = self.transformerBlock_2(transformer_block__enc_1)
        layer_norm_rm_enc = self.layerNorm_1(transformer_block__enc_2)
        embedding_ng_dec = self.embedding_1(tgt)
        # positionalEncoding: add positional encoding externally (e.g. sinusoidal or learned PE)
        transformer_block__dec_1 = self.transformerBlock_3(embedding_ng_dec, layer_norm_rm_enc)
        transformer_block__dec_2 = self.transformerBlock_4(transformer_block__dec_1, layer_norm_rm_enc)
        layer_norm_rm_dec = self.layerNorm_2(transformer_block__dec_2)
        linear_ar_out = self.linear_1(layer_norm_rm_dec)
        # Output

For agents

This architecture is machine-readable end to end. An agent can list the set, fetch this graph, edit it, and have the edit verified before any GPU time is spent.