diff --git a/bark.svg b/bark.svg index 990900e598475f4cd93d67c70b46a1a545631bd5..9e1a6b7ae9863a8ab91ced9e9f35a46154790a12 100644 --- a/bark.svg +++ b/bark.svg @@ -1,4 +1,4 @@ - + - + bark -dense · 32× Attention - -BarkModel · base model -32 × BarkBlockBarkBlock× 32 -Self-Attention · BarkSelfAttention -MLP · BarkMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [? × ?] → [1, 6, ?] -LayerNormpre-attention [1, 6, ?] -attn_dropout: Dropoutattn_dropout Dropout -resid_dropout: Dropoutresid_dropout Dropout -att_proj: Linear [768→2304]att_proj [768→2304] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, ?] -in_proj: Linear [768→3072]in_proj [768→3072] -out_proj: Linear [3072→768]out_proj [3072→768] -dropout: Dropoutdropout Dropout -gelu: GELUgelu GELU -residual add+ -Final LayerNorm[1, 6, ?] -LM HeadLinear [?→?] -Softmax -logits[1, 6, ?] +BarkModel · staged data flow (structure) +codec_model · EncodecModel +decoder · EncodecDecoder +encoder · EncodecEncoder +layers · ModuleList [16] +layers · ModuleList [16] +semantic · SemanticModel +coarse_acoustics · CoarseModel +fine_acoustics · FineModel +[2:14] · 4× (ELU, EncodecConvTranspose1d, EncodecResnetBlock) +[0:12] · 4× (EncodecConv1d, EncodecResnetBlock, ELU) +layers · 12× BarkBlock +layers · 12× BarkBlock +layers · 12× BarkBlock +1 · EncodecResnetBlock +4 · EncodecResnetBlock +block · ModuleList [4] +block · ModuleList [4] +[0:4] · 2× (ELU, EncodecConv1d) +[0:4] · 2× (ELU, EncodecConv1d) +quantizer · EncodecResidualVectorQuantizer +3 · EncodecConvTranspose1d +attn · BarkSelfAttention +mlp · BarkMLP +attn · BarkSelfAttention +mlp · BarkMLP +attn · BarkSelfAttention +mlp · BarkMLP +layers · 32× EncodecVectorQuantization +12 · EncodecConv1d +13 · EncodecLSTM +15 · EncodecConv1d +0 · EncodecConv1d +1 · EncodecLSTM +15 · EncodecConv1d +0 · EncodecConv1d +shortcut · EncodecConv1d +conv · ParametrizedConvTranspose1d +shortcut · EncodecConv1d +1 · EncodecConv1d +1 · EncodecConv1d + + + + +inputsinput_ids / pixel_values / input_values +input_embeds_layer: Embedding [10048×768]input_embeds_layer Embedding [10048×768] +position_embeds_layer: Embedding [1024×768]position_embeds_layer Embedding [1024×768] +drop: Dropoutdrop Dropout +layernorm_1: LayerNorm 768layernorm_1 LayerNorm 768 +layernorm_2: LayerNorm 768layernorm_2 LayerNorm 768 +attn_dropout: Dropoutattn_dropout Dropout +resid_dropout: Dropoutresid_dropout Dropout +att_proj: Linear [768→2304]att_proj [768→2304] +out_proj: Linear [768→768]out_proj [768→768] +in_proj: Linear [768→3072]in_proj [768→3072] +out_proj: Linear [3072→768]out_proj [3072→768] +dropout: Dropoutdropout Dropout +gelu: GELUgelu GELU +layernorm_final: LayerNorm 768layernorm_final LayerNorm 768 +lm_head: Linear [768→10048]lm_head [768→10048] +input_embeds_layer: Embedding [10048×768]input_embeds_layer Embedding [10048×768] +position_embeds_layer: Embedding [1024×768]position_embeds_layer Embedding [1024×768] +drop: Dropoutdrop Dropout +layernorm_1: LayerNorm 768layernorm_1 LayerNorm 768 +layernorm_2: LayerNorm 768layernorm_2 LayerNorm 768 +attn_dropout: Dropoutattn_dropout Dropout +resid_dropout: Dropoutresid_dropout Dropout +att_proj: Linear [768→2304]att_proj [768→2304] +out_proj: Linear [768→768]out_proj [768→768] +in_proj: Linear [768→3072]in_proj [768→3072] +out_proj: Linear [3072→768]out_proj [3072→768] +dropout: Dropoutdropout Dropout +gelu: GELUgelu GELU +layernorm_final: LayerNorm 768layernorm_final LayerNorm 768 +lm_head: Linear [768→10048]lm_head [768→10048] +input_embeds_layers: 8× Embeddinginput_embeds_layers 8× Embedding +position_embeds_layer: Embedding [1024×768]position_embeds_layer Embedding [1024×768] +drop: Dropoutdrop Dropout +layernorm_1: LayerNorm 768layernorm_1 LayerNorm 768 +layernorm_2: LayerNorm 768layernorm_2 LayerNorm 768 +attn_dropout: Dropoutattn_dropout Dropout +resid_dropout: Dropoutresid_dropout Dropout +att_proj: Linear [768→2304]att_proj [768→2304] +out_proj: Linear [768→768]out_proj [768→768] +in_proj: Linear [768→3072]in_proj [768→3072] +out_proj: Linear [3072→768]out_proj [3072→768] +dropout: Dropoutdropout Dropout +gelu: GELUgelu GELU +layernorm_final: LayerNorm 768layernorm_final LayerNorm 768 +lm_heads: 7× Linearlm_heads 7× Linear +conv: ParametrizedConv1d 1→32 k7conv ParametrizedConv1d 1→32 k7 +0: ELU0 ELU +conv: ParametrizedConv1d 32→16 k3conv ParametrizedConv1d 32→16 k3 +conv: ParametrizedConv1d 32→32 k1conv ParametrizedConv1d 32→32 k1 +2: ELU2 ELU +conv: ParametrizedConv1d 256→512 k16conv ParametrizedConv1d 256→512 k16 +lstm: LSTMlstm LSTM +14: ELU14 ELU +conv: ParametrizedConv1d 512→128 k7conv ParametrizedConv1d 512→128 k7 +conv: ParametrizedConv1d 128→512 k7conv ParametrizedConv1d 128→512 k7 +lstm: LSTMlstm LSTM +2: ELU2 ELU +parametrizations: ModuleDictparametrizations ModuleDict +0: ELU0 ELU +conv: ParametrizedConv1d 256→128 k3conv ParametrizedConv1d 256→128 k3 +conv: ParametrizedConv1d 256→256 k1conv ParametrizedConv1d 256→256 k1 +14: ELU14 ELU +conv: ParametrizedConv1d 32→1 k7conv ParametrizedConv1d 32→1 k7 +codebook: EncodecEuclideanCodebookcodebook EncodecEuclideanCodebook model id suno/bark @@ -172,16 +248,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/bert.svg b/bert.svg index 3c1d15e4036c6d32aa56140738c91b37f89b0cdc..f0bd22aac4cc3676f42f24db24fc7bffe39a63c0 100644 --- a/bert.svg +++ b/bert.svg @@ -1,4 +1,4 @@ - + - + bert -dense · 12× MHA - -BertModel · base model -12 × BertLayerBertLayer× 12 -BertLMHeadModel · task head -Self-Attention · BertAttention -output · BertSelfOutput -self · BertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -BertLMHeadModelLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +BertModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× BertLayer +attention · BertAttention +embeddings · Embeddings → [1×8×768] +output · BertOutput +self · BertSelfAttention +output · BertSelfOutput +pooler · Pooler → [1×768] +intermediate · BertIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id google-bert/bert-base-uncased @@ -170,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/blt.diff.svg b/blt.diff.svg index d0b9a94adf8b492474e5132dfa5d3497f2b749f7..d19f1936e56b402589d9bb46ae9b84c5ee70a24f 100644 --- a/blt.diff.svg +++ b/blt.diff.svg @@ -1,4 +1,4 @@ - + - + blt diff vs mllama (+llama) · 12 overridden · 27 added · 0 deleted · 6 new · 2 inherited-as-is - -BltModel · base model -25 × BltTransformerLayerBltTransformerLayer× 25 -BltForCausalLM · task head -Self-Attention · BltSelfAttention -MLP · MllamaMLP ↩ inherited - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [260 × ?] → [1, 6, ?] -BltRMSNormpre-attention [1, 6, ?] -q_proj: Linear [2048→2048]q_proj [2048→2048] -k_proj: Linear [2048→2048]k_proj [2048→2048] -v_proj: Linear [2048→2048]v_proj [2048→2048] -o_proj: Linear [2048→2048]o_proj [2048→2048] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -BltRMSNormpre-FFN [1, 6, ?] -gate_proj: Linear [2048→5632]gate_proj [2048→5632] -up_proj: Linear [2048→5632]up_proj [2048→5632] -down_proj: Linear [5632→2048]down_proj [5632→2048] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, ?] -BltForCausalLMLM HeadLinear [?→260] -Softmax -logits[1, 6, 260] +local_encoder · LocalEncoder +local_decoder · LocalDecoder +patcher · Patcher +global_transformer · GlobalTransformer +layers · ModuleList +0 · BltTransformerLayer +layers · 25× BltTransformerLayer +layers · 9× BltTransformerLayer +layers · 14× BltTransformerLayer +cross_attn_layers · ModuleList +cross_attn_layers · 9× BltCrossAttention +0 · BltCrossAttention +self_attn · BltSelfAttention +mlp · MllamaMLP ↩ inherited +self_attn · BltSelfAttention +mlp · MllamaMLP ↩ inherited +self_attn · BltSelfAttention +mlp · MllamaMLP ↩ inherited +self_attn · BltSelfAttention +mlp · MllamaMLP ↩ inherited + + + + + +inputsinput_ids / pixel_values / input_values +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +gate_proj: Linear [1024→2730]gate_proj [1024→2730] +up_proj: Linear [1024→2730]up_proj [1024→2730] +down_proj: Linear [2730→1024]down_proj [2730→1024] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 1024input_layernorm RMSNorm 1024 +post_attention_layernorm: BltRMSNorm 1024post_attention_layernorm RMSNorm 1024 +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +patch_embedding_projection: Linear [1024→2048]patch_embedding_projection [1024→2048] +embed_tokens: Embedding [260×1024]embed_tokens Embedding [260×1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +q_norm: BltRMSNorm 1024q_norm RMSNorm 1024 +k_norm: BltRMSNorm 1024k_norm RMSNorm 1024 +q_proj: Linear [2048→2048]q_proj [2048→2048] +k_proj: Linear [2048→2048]k_proj [2048→2048] +v_proj: Linear [2048→2048]v_proj [2048→2048] +o_proj: Linear [2048→2048]o_proj [2048→2048] +gate_proj: Linear [2048→5632]gate_proj [2048→5632] +up_proj: Linear [2048→5632]up_proj [2048→5632] +down_proj: Linear [5632→2048]down_proj [5632→2048] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 2048input_layernorm RMSNorm 2048 +post_attention_layernorm: BltRMSNorm 2048post_attention_layernorm RMSNorm 2048 +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +token_embedding_projection: Identitytoken_embedding_projection Identity +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +gate_proj: Linear [1024→2816]gate_proj [1024→2816] +up_proj: Linear [1024→2816]up_proj [1024→2816] +down_proj: Linear [2816→1024]down_proj [2816→1024] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 1024input_layernorm RMSNorm 1024 +post_attention_layernorm: BltRMSNorm 1024post_attention_layernorm RMSNorm 1024 +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +patch_embedding_projection: Linear [2048→2048]patch_embedding_projection [2048→2048] +norm: BltRMSNorm 1024norm RMSNorm 1024 +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +q_norm: BltRMSNorm 1024q_norm RMSNorm 1024 +k_norm: BltRMSNorm 1024k_norm RMSNorm 1024 +encoder_hash_tok_embedding · Embedding +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +q_proj: Linear [768→768]q_proj [768→768] +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +o_proj: Linear [768→768]o_proj [768→768] +gate_proj: Linear [768→2048]gate_proj [768→2048] +up_proj: Linear [768→2048]up_proj [768→2048] +down_proj: Linear [2048→768]down_proj [2048→768] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 768input_layernorm RMSNorm 768 +post_attention_layernorm: BltRMSNorm 768post_attention_layernorm RMSNorm 768 +embed_tokens: Embedding [260×768]embed_tokens Embedding [260×768] +norm: BltRMSNorm 768norm RMSNorm 768 +lm_head: Linear [768→260]lm_head [768→260] model id itazap/blt-1b-hf diff --git a/blt.svg b/blt.svg index 1cf1136ef7bcbb1ca999a3f992c346408ca2598b..55d0b76255cb8ac2f20ebea550c2f6ea77aa5c99 100644 --- a/blt.svg +++ b/blt.svg @@ -1,4 +1,4 @@ - + - + blt -dense · 25× Attention - -BltModel · base model -25 × BltTransformerLayerBltTransformerLayer× 25 -BltForCausalLM · task head -Self-Attention · BltSelfAttention -MLP · BltMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [260 × ?] → [1, 6, ?] -BltRMSNormpre-attention [1, 6, ?] -q_proj: Linear [2048→2048]q_proj [2048→2048] -k_proj: Linear [2048→2048]k_proj [2048→2048] -v_proj: Linear [2048→2048]v_proj [2048→2048] -o_proj: Linear [2048→2048]o_proj [2048→2048] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -BltRMSNormpre-FFN [1, 6, ?] -gate_proj: Linear [2048→5632]gate_proj [2048→5632] -up_proj: Linear [2048→5632]up_proj [2048→5632] -down_proj: Linear [5632→2048]down_proj [5632→2048] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, ?] -BltForCausalLMLM HeadLinear [?→260] -Softmax -logits[1, 6, 260] +BltModel · staged data flow (structure) +local_encoder · LocalEncoder +local_decoder · LocalDecoder +patcher · Patcher +global_transformer · GlobalTransformer +layers · ModuleList +0 · BltTransformerLayer +layers · 25× BltTransformerLayer +layers · 9× BltTransformerLayer +layers · 14× BltTransformerLayer +cross_attn_layers · ModuleList +cross_attn_layers · 9× BltCrossAttention +0 · BltCrossAttention +self_attn · BltSelfAttention +mlp · BltMLP +self_attn · BltSelfAttention +mlp · BltMLP +self_attn · BltSelfAttention +mlp · BltMLP +self_attn · BltSelfAttention +mlp · BltMLP + + + + + +inputsinput_ids / pixel_values / input_values +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +gate_proj: Linear [1024→2730]gate_proj [1024→2730] +up_proj: Linear [1024→2730]up_proj [1024→2730] +down_proj: Linear [2730→1024]down_proj [2730→1024] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 1024input_layernorm RMSNorm 1024 +post_attention_layernorm: BltRMSNorm 1024post_attention_layernorm RMSNorm 1024 +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +patch_embedding_projection: Linear [1024→2048]patch_embedding_projection [1024→2048] +embed_tokens: Embedding [260×1024]embed_tokens Embedding [260×1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +q_norm: BltRMSNorm 1024q_norm RMSNorm 1024 +k_norm: BltRMSNorm 1024k_norm RMSNorm 1024 +q_proj: Linear [2048→2048]q_proj [2048→2048] +k_proj: Linear [2048→2048]k_proj [2048→2048] +v_proj: Linear [2048→2048]v_proj [2048→2048] +o_proj: Linear [2048→2048]o_proj [2048→2048] +gate_proj: Linear [2048→5632]gate_proj [2048→5632] +up_proj: Linear [2048→5632]up_proj [2048→5632] +down_proj: Linear [5632→2048]down_proj [5632→2048] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 2048input_layernorm RMSNorm 2048 +post_attention_layernorm: BltRMSNorm 2048post_attention_layernorm RMSNorm 2048 +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +token_embedding_projection: Identitytoken_embedding_projection Identity +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +gate_proj: Linear [1024→2816]gate_proj [1024→2816] +up_proj: Linear [1024→2816]up_proj [1024→2816] +down_proj: Linear [2816→1024]down_proj [2816→1024] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 1024input_layernorm RMSNorm 1024 +post_attention_layernorm: BltRMSNorm 1024post_attention_layernorm RMSNorm 1024 +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +patch_embedding_projection: Linear [2048→2048]patch_embedding_projection [2048→2048] +norm: BltRMSNorm 1024norm RMSNorm 1024 +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +q_norm: BltRMSNorm 1024q_norm RMSNorm 1024 +k_norm: BltRMSNorm 1024k_norm RMSNorm 1024 +encoder_hash_tok_embedding · Embedding +rotary_emb: BltRotaryEmbeddingrotary_emb RotaryEmbedding +q_proj: Linear [768→768]q_proj [768→768] +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +o_proj: Linear [768→768]o_proj [768→768] +gate_proj: Linear [768→2048]gate_proj [768→2048] +up_proj: Linear [768→2048]up_proj [768→2048] +down_proj: Linear [2048→768]down_proj [2048→768] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: BltRMSNorm 768input_layernorm RMSNorm 768 +post_attention_layernorm: BltRMSNorm 768post_attention_layernorm RMSNorm 768 +embed_tokens: Embedding [260×768]embed_tokens Embedding [260×768] +norm: BltRMSNorm 768norm RMSNorm 768 +lm_head: Linear [768→260]lm_head [768→260] model id itazap/blt-1b-hf @@ -175,16 +230,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings False legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/bros.svg b/bros.svg index 82f72459f570b68bf1f6d4666abe59e1a7ab2236..4fd2ab41530e61782c3af274fb1823ace1570090 100644 --- a/bros.svg +++ b/bros.svg @@ -1,4 +1,4 @@ - + - + bros -dense · 12× MHA - -BrosModel · base model -12 × BrosLayerBrosLayer× 12 -BrosForTokenClassification · task head -Self-Attention · BrosAttention -output · BrosSelfOutput -self · BrosSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -BrosForTokenClassificationLM HeadLinear [768→30522] -Softmax -logits[1, 6, 30522] +BrosModel · staged data flow (structure) +encoder · Encoder +layer · 12× BrosLayer +attention · BrosAttention +bbox_embeddings · BboxEmbeddings +embeddings · TextEmbeddings +output · BrosOutput +self · BrosSelfAttention +output · BrosSelfOutput +pooler · Pooler +bbox_sinusoid_emb · BrosPositionalEmbedding2D +intermediate · BrosIntermediate + + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +x_pos_emb: BrosPositionalEmbedding1Dx_pos_emb PositionalEmbedding1D +y_pos_emb: BrosPositionalEmbedding1Dy_pos_emb PositionalEmbedding1D +bbox_projection: Linear [192→64]bbox_projection [192→64] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id jinho8345/bros-base-uncased @@ -170,16 +177,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/camembert.diff.svg b/camembert.diff.svg index 339b98df69f3f0cf175add7ca382a51352f459e8..eb0a5ee86d6460aabafe6a79f77c473d3e0bb934 100644 --- a/camembert.diff.svg +++ b/camembert.diff.svg @@ -1,4 +1,4 @@ - + - + camembert diff vs roberta · 15 overridden · 0 added · 0 deleted · 0 new · 1 inherited-as-is - -CamembertModel · base model -12 × CamembertLayerCamembertLayer× 12 -CamembertForCausalLM · task head -Self-Attention · RobertaAttention ↩ inherited -output · RobertaSelfOutput ↩ inherited -self · RobertaSelfAttention ↩ inherited - -input_idstokenize("Hey, how are you?") → [1, 7] -token 0: '␣Hey'␣He…0 -token 1: ',',1 -token 2: '␣h'␣h2 -token 3: 'ow'ow3 -token 4: '␣are'␣are4 -token 5: '␣you'␣you5 -token 6: '?'?6 -Token Embeddingweight [30522 × 768] → [1, 7, 768] -Normpre-attention [1, 7, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 7, 768] -CamembertForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 7, 30522] +encoder · Encoder → [1×8×768] +layer · 12× RobertaLayer ↩ inherited +attention · RobertaAttention ↩ inherited +embeddings · Embeddings → [1×8×768] +output · RobertaOutput ↩ inherited +self · RobertaSelfAttention ↩ inherited +output · RobertaSelfOutput ↩ inherited +pooler · Pooler → [1×768] +intermediate · RobertaIntermediate ↩ inherited + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id almanach/camembert-base diff --git a/camembert.svg b/camembert.svg index d63f8a74428701c76b32dfb3a8324e65f3121d85..598eac8c99417013415cca8575fe89a189ca57df 100644 --- a/camembert.svg +++ b/camembert.svg @@ -1,4 +1,4 @@ - + - + camembert -dense · 12× MHA - -CamembertModel · base model -12 × CamembertLayerCamembertLayer× 12 -CamembertForCausalLM · task head -Self-Attention · CamembertAttention -output · CamembertSelfOutput -self · CamembertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 7] -token 0: '␣Hey'␣He…0 -token 1: ',',1 -token 2: '␣h'␣h2 -token 3: 'ow'ow3 -token 4: '␣are'␣are4 -token 5: '␣you'␣you5 -token 6: '?'?6 -Token Embeddingweight [30522 × 768] → [1, 7, 768] -Normpre-attention [1, 7, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 7, 768] -CamembertForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 7, 30522] +CamembertModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× CamembertLayer +attention · CamembertAttention +embeddings · Embeddings → [1×8×768] +output · CamembertOutput +self · CamembertSelfAttention +output · CamembertSelfOutput +pooler · Pooler → [1×768] +intermediate · CamembertIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id almanach/camembert-base @@ -171,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/canine.svg b/canine.svg index 41545ce5165d8e0aadb5c9ccb1bd6f943de2457e..77b604abc4481a8cb6c23c6d92032f456b70b528 100644 --- a/canine.svg +++ b/canine.svg @@ -1,4 +1,4 @@ - + - + canine -dense · 12× MHA - -CanineModel · base model -12 × CanineLayerCanineLayer× 12 -CanineForSequenceClassification · task head -Self-Attention · CanineAttention -output · CanineSelfOutput -self · CanineSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 10] -token 0: 'H'H0 -token 1: 'e'e1 -token 2: 'y'y2 -token 3: ',',3 -token 4: ' ' 4 -token 5: 'h'h5 -token 6: 'o'o6 -token 7: 'w'w7 -token 8: ' ' 8 -token 9: 'a'a9 -Token Embeddingweight [? × 768] → [1, 10, 768] -Normpre-attention [1, 10, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 10, 768] -CanineForSequenceClassificationLM HeadLinear [768→?] -Softmax -logits[1, 10, ?] +CanineModel · staged data flow (structure) +encoder · Encoder +layer · 12× CanineLayer +char_embeddings · Embeddings +initial_char_encoder · Encoder +final_char_encoder · Encoder +layer · ModuleList +layer · ModuleList +0 · CanineLayer +0 · CanineLayer +attention · CanineAttention +projection · ConvProjection +output · CanineOutput +output · CanineOutput +self · CanineSelfAttention +output · CanineSelfOutput +output · CanineOutput +chars_to_molecules · CharactersToMolecules +pooler · Pooler +intermediate · CanineIntermediate +attention · CanineAttention +intermediate · CanineIntermediate +attention · CanineAttention +intermediate · CanineIntermediate + + + + + + + +inputsinput_ids / pixel_values / input_values +HashBucketCodepointEmbedder_0: Embedding [16384×96]HashBucketCodepointEmbedder_0 Embedding [16384×96] +HashBucketCodepointEmbedder_1: Embedding [16384×96]HashBucketCodepointEmbedder_1 Embedding [16384×96] +HashBucketCodepointEmbedder_2: Embedding [16384×96]HashBucketCodepointEmbedder_2 Embedding [16384×96] +HashBucketCodepointEmbedder_3: Embedding [16384×96]HashBucketCodepointEmbedder_3 Embedding [16384×96] +HashBucketCodepointEmbedder_4: Embedding [16384×96]HashBucketCodepointEmbedder_4 Embedding [16384×96] +HashBucketCodepointEmbedder_5: Embedding [16384×96]HashBucketCodepointEmbedder_5 Embedding [16384×96] +HashBucketCodepointEmbedder_6: Embedding [16384×96]HashBucketCodepointEmbedder_6 Embedding [16384×96] +HashBucketCodepointEmbedder_7: Embedding [16384×96]HashBucketCodepointEmbedder_7 Embedding [16384×96] +char_position_embeddings: Embedding [16384×768]char_position_embeddings Embedding [16384×768] +token_type_embeddings: Embedding [16×768]token_type_embeddings Embedding [16×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +self: CanineSelfAttentionself SelfAttention +output: CanineSelfOutputoutput SelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +conv: Conv1d 768→768 k4conv Conv1d 768→768 k4 +activation: GELUActivationactivation GELU +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +conv: Conv1d 1536→768 k4conv Conv1d 1536→768 k4 +activation: GELUActivationactivation GELU +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +self: CanineSelfAttentionself SelfAttention +output: CanineSelfOutputoutput SelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id google/canine-s @@ -174,16 +217,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/clvp.svg b/clvp.svg index 76bc4f4487993ea331b3b6c14284d864dd94df94..9dc2a783163c07f30c3c33618ceaf3ccd5c8d5d0 100644 --- a/clvp.svg +++ b/clvp.svg @@ -1,4 +1,4 @@ - + - + clvp -dense · 20× MHA - -ClvpModelForConditionalGeneration · base model -20 × ClvpEncoderLayerClvpEncoderLayer× 20 -Self-Attention · ClvpSelfAttention -MLP · ClvpEncoderMLP -fc1 · ClvpGatedLinearUnit - - - -input_idstokenize("Hey, how are you?") → [1, 10] -token 0: 'he'he0 -token 1: 'y'y1 -token 2: ',',2 -token 3: '[SPACE]'[…3 -token 4: 'h'h4 -token 5: 'ow'ow5 -token 6: '[SPACE]'[…6 -token 7: 'are'a…7 -token 8: '[SPACE]'[…8 -token 9: 'you'y…9 -Token Embeddingweight [256 × 768] → [1, 10, 768] -ClvpRMSNormpre-attention [1, 10, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -ClvpRMSNormpre-FFN [1, 10, 768] -activation_fn: GELUActivationactivation_fn GELU -proj: Linear [768→3072]proj [768→3072] -fc2: Linear [1536→768]fc2 [1536→768] -dropout_layer: Dropoutdropout_layer Dropout -residual add+ -Final RMSNorm[1, 10, 768] -LM HeadLinear [768→256] -Softmax -logits[1, 10, 256] +ClvpModelForConditionalGeneration · staged data flow (structure) +text_encoder_model · Encoder +speech_encoder_model · Encoder +speech_decoder_model · ForCausalLM +model · ClvpModel +decoder · ClvpDecoder +layers · 20× ClvpEncoderLayer +layers · 20× ClvpEncoderLayer +conditioning_encoder · ConditioningEncoder +layers · 30× ClvpDecoderLayer +mlp · ClvpEncoderMLP +mlp · ClvpEncoderMLP +mel_attn_blocks · 6× ClvpSelfAttention +sequence_summary · ClvpSequenceSummary +sequence_summary · ClvpSequenceSummary +self_attn · ClvpSelfAttention +self_attn · ClvpSelfAttention +fc1 · ClvpGatedLinearUnit +fc1 · ClvpGatedLinearUnit + + + + +inputsinput_ids / pixel_values / input_values +text_token_embedding: Embedding [256×1024]text_token_embedding Embedding [256×1024] +text_position_embedding: Embedding [404×1024]text_position_embedding Embedding [404×1024] +mel_conv: Conv1d 80→1024 k1mel_conv Conv1d 80→1024 k1 +group_norms: 6× GroupNormgroup_norms 6× GroupNorm +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +input_embeds_layer: Embedding [8194×1024]input_embeds_layer Embedding [8194×1024] +position_embeds_layer: Embedding [608×1024]position_embeds_layer Embedding [608×1024] +drop: Dropoutdrop Dropout +input_layernorm: LayerNorm 1024input_layernorm LayerNorm 1024 +attn: ClvpSelfAttentionattn SelfAttention +post_attention_layernorm: LayerNorm 1024post_attention_layernorm LayerNorm 1024 +mlp: ClvpDecoderMLPmlp DecoderMLP +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +final_norm: LayerNorm 1024final_norm LayerNorm 1024 +lm_head: Linear [1024→8194]lm_head [1024→8194] +token_embedding: Embedding [256×768]token_embedding Embedding [256×768] +rotary_pos_emb: ClvpRotaryPositionalEmbeddingrotary_pos_emb RotaryPositionalEmbedding +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +activation_fn: GELUActivationactivation_fn GELU +proj: Linear [768→3072]proj [768→3072] +fc2: Linear [1536→768]fc2 [1536→768] +dropout_layer: Dropoutdropout_layer Dropout +input_rmsnorm: ClvpRMSNorm 768input_rmsnorm RMSNorm 768 +post_attention_rmsnorm: ClvpRMSNorm 768post_attention_rmsnorm RMSNorm 768 +summary: Identitysummary Identity +activation: Identityactivation Identity +first_dropout: Identityfirst_dropout Identity +last_dropout: Identitylast_dropout Identity +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 +projection: Linear [768→768]projection [768→768] +token_embedding: Embedding [256×768]token_embedding Embedding [256×768] +rotary_pos_emb: ClvpRotaryPositionalEmbeddingrotary_pos_emb RotaryPositionalEmbedding +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +activation_fn: GELUActivationactivation_fn GELU +proj: Linear [768→3072]proj [768→3072] +fc2: Linear [1536→768]fc2 [1536→768] +dropout_layer: Dropoutdropout_layer Dropout +input_rmsnorm: ClvpRMSNorm 768input_rmsnorm RMSNorm 768 +post_attention_rmsnorm: ClvpRMSNorm 768post_attention_rmsnorm RMSNorm 768 +summary: Identitysummary Identity +activation: Identityactivation Identity +first_dropout: Identityfirst_dropout Identity +last_dropout: Identitylast_dropout Identity +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 +projection: Linear [768→768]projection [768→768] model id susnato/clvp_dev @@ -179,16 +216,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/conditional_detr.diff.svg b/conditional_detr.diff.svg index 8fe187c5c32a6bb5656332cd45e09e82a0ec89a8..5c3659484d821a2cc55fc67042d406884233a04d 100644 --- a/conditional_detr.diff.svg +++ b/conditional_detr.diff.svg @@ -1,4 +1,4 @@ - + - + conditional_detr diff vs detr · 7 overridden · 14 added · 0 deleted · 5 new · 11 inherited-as-is - -ConditionalDetrModel · base model -6 × ConditionalDetrEncoderLayerConditionalDetrEncoderLayer× 6 -Self-Attention · DetrSelfAttention ↩ inherited -MLP · DetrMLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→2048]fc1 [256→2048] -fc2: Linear [2048→256]fc2 [2048→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +backbone · ConvEncoder +model · FeatureListNet +decoder · Decoder +layers · 6× ConditionalDetrDecoderLayer +encoder · Encoder +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +layers · 6× DetrEncoderLayer ↩ inherited +encoder_attn · ConditionalDetrDecoderCrossAttention +self_attn · DetrSelfAttention ↩ inherited +self_attn · ConditionalDetrDecoderSelfAttention +query_scale · DetrMLPPredictionHead ↩ inherited +ref_point_head · DetrMLPPredictionHead ↩ inherited +mlp · DetrMLP ↩ inherited +mlp · DetrMLP ↩ inherited +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: ConditionalDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 64bn2 FrozenBatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 256bn3 FrozenBatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 2561 FrozenBatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 128bn1 FrozenBatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 128bn2 FrozenBatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 512bn3 FrozenBatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 5121 FrozenBatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 256bn1 FrozenBatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 256bn2 FrozenBatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 1024bn3 FrozenBatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 10241 FrozenBatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 512bn1 FrozenBatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 512bn2 FrozenBatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 2048bn3 FrozenBatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 20481 FrozenBatchNorm2d 2048 +position_embedding · SinePositionEmbedding +query_position_embeddings · Embedding +input_projection · Conv2d +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +q_content_proj: Linear [256→256]q_content_proj [256→256] +q_pos_proj: Linear [256→256]q_pos_proj [256→256] +k_content_proj: Linear [256→256]k_content_proj [256→256] +k_pos_proj: Linear [256→256]k_pos_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +q_content_proj: Linear [256→256]q_content_proj [256→256] +q_pos_proj: Linear [256→256]q_pos_proj [256→256] +k_content_proj: Linear [256→256]k_content_proj [256→256] +k_pos_proj: Linear [256→256]k_pos_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_pos_sine_proj: Linear [256→256]q_pos_sine_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +layers: 2× Linearlayers 2× Linear model id microsoft/conditional-detr-res diff --git a/conditional_detr.svg b/conditional_detr.svg index f5741cd2cc42d1992566b5eeb5d433bab141872f..1bb1b6c80a339ec98e8a51fd021e42228d795e7b 100644 --- a/conditional_detr.svg +++ b/conditional_detr.svg @@ -1,4 +1,4 @@ - + - + conditional_detr -dense · 6× MHA - -ConditionalDetrModel · base model -6 × ConditionalDetrEncoderLayerConditionalDetrEncoderLayer× 6 -Self-Attention · ConditionalDetrSelfAttention -MLP · ConditionalDetrMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→2048]fc1 [256→2048] -fc2: Linear [2048→256]fc2 [2048→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +ConditionalDetrModel · staged data flow (structure) +backbone · ConvEncoder +model · FeatureListNet +decoder · Decoder +layers · 6× ConditionalDetrDecoderLayer +encoder · Encoder +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +layers · 6× ConditionalDetrEncoderLayer +encoder_attn · ConditionalDetrDecoderCrossAttention +self_attn · ConditionalDetrSelfAttention +self_attn · ConditionalDetrDecoderSelfAttention +query_scale · ConditionalDetrMLPPredictionHead +ref_point_head · ConditionalDetrMLPPredictionHead +mlp · ConditionalDetrMLP +mlp · ConditionalDetrMLP +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: ConditionalDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 64bn2 FrozenBatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 256bn3 FrozenBatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 2561 FrozenBatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 128bn1 FrozenBatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 128bn2 FrozenBatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 512bn3 FrozenBatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 5121 FrozenBatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 256bn1 FrozenBatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 256bn2 FrozenBatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 1024bn3 FrozenBatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 10241 FrozenBatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: ConditionalDetrFrozenBatchNorm2d 512bn1 FrozenBatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: ConditionalDetrFrozenBatchNorm2d 512bn2 FrozenBatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: ConditionalDetrFrozenBatchNorm2d 2048bn3 FrozenBatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: ConditionalDetrFrozenBatchNorm2d 20481 FrozenBatchNorm2d 2048 +position_embedding · SinePositionEmbedding +query_position_embeddings · Embedding +input_projection · Conv2d +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +q_content_proj: Linear [256→256]q_content_proj [256→256] +q_pos_proj: Linear [256→256]q_pos_proj [256→256] +k_content_proj: Linear [256→256]k_content_proj [256→256] +k_pos_proj: Linear [256→256]k_pos_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +q_content_proj: Linear [256→256]q_content_proj [256→256] +q_pos_proj: Linear [256→256]q_pos_proj [256→256] +k_content_proj: Linear [256→256]k_content_proj [256→256] +k_pos_proj: Linear [256→256]k_pos_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_pos_sine_proj: Linear [256→256]q_pos_sine_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +layers: 2× Linearlayers 2× Linear model id microsoft/conditional-detr-re… @@ -171,16 +257,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/csm.diff.svg b/csm.diff.svg index 75b7718dc456388f9300d0f9459f0b7b9c242535..c4e5eed9aca8d01f7622305d2a6b4e108ac6b8f3 100644 --- a/csm.diff.svg +++ b/csm.diff.svg @@ -1,4 +1,4 @@ - + - + csm diff vs llama · 9 overridden · 38 added · 0 deleted · 5 new · 5 inherited-as-is - -CsmForConditionalGeneration · base model -16 × CsmDecoderLayerCsmDecoderLayer× 16 -Self-Attention · LlamaAttention ↩ inherited -MLP · LlamaMLP ↩ inherited - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [2051 × 2048] → [1, 6, 2048] -CsmRMSNormpre-attention [1, 6, 2048] -q_proj: Linear [2048→2048]q_proj [2048→2048] -k_proj: Linear [2048→512]k_proj [2048→512] -v_proj: Linear [2048→512]v_proj [2048→512] -o_proj: Linear [2048→2048]o_proj [2048→2048] -scaled dot-product attention32 heads · head_dim 64 · GQA 32:8 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -CsmRMSNormpre-FFN [1, 6, 2048] -gate_proj: Linear [2048→8192]gate_proj [2048→8192] -up_proj: Linear [2048→8192]up_proj [2048→8192] -down_proj: Linear [8192→2048]down_proj [8192→2048] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 2048] -LM HeadLinear [2048→2051] -Softmax -logits[1, 6, 2051] +backbone_model · BackboneModel → [1×8×2048] +layers · 16× LlamaDecoderLayer ↩ inherited +self_attn · LlamaAttention ↩ inherited +mlp · LlamaMLP ↩ inherited +embed_tokens · CsmBackboneModelEmbeddings + + + + +input_ids [1, 8] +embed_text_tokens · Embedding → [1×8×2048] +embed_audio_tokens: Embedding [65632×2048]embed_audio_tokens Embedding [65632×2048] +q_proj: Linear [2048→2048]q_proj [2048→2048] +k_proj: Linear [2048→512]k_proj [2048→512] +v_proj: Linear [2048→512]v_proj [2048→512] +o_proj: Linear [2048→2048]o_proj [2048→2048] +gate_proj: Linear [2048→8192]gate_proj [2048→8192] +up_proj: Linear [2048→8192]up_proj [2048→8192] +down_proj: Linear [8192→2048]down_proj [8192→2048] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: CsmRMSNorm 2048input_layernorm RMSNorm 2048 +post_attention_layernorm: CsmRMSNorm 2048post_attention_layernorm RMSNorm 2048 +norm: CsmRMSNorm 2048norm RMSNorm 2048 +rotary_emb: CsmRotaryEmbeddingrotary_emb RotaryEmbedding +lm_head · Linear → [1×8×2051] +output [1×8×2051] model id sesame/csm-1b diff --git a/csm.svg b/csm.svg index 1da060a46af7885634dc8d618db20b8aa4086839..9aec18e2ae4462fd83bf008e71df95633fc1ff4c 100644 --- a/csm.svg +++ b/csm.svg @@ -1,4 +1,4 @@ - + - + csm -dense · 16× GQA - -CsmForConditionalGeneration · base model -16 × CsmDecoderLayerCsmDecoderLayer× 16 -Self-Attention · CsmAttention -MLP · CsmMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [2051 × 2048] → [1, 6, 2048] -CsmRMSNormpre-attention [1, 6, 2048] -q_proj: Linear [2048→2048]q_proj [2048→2048] -k_proj: Linear [2048→512]k_proj [2048→512] -v_proj: Linear [2048→512]v_proj [2048→512] -o_proj: Linear [2048→2048]o_proj [2048→2048] -scaled dot-product attention32 heads · head_dim 64 · GQA 32:8 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -CsmRMSNormpre-FFN [1, 6, 2048] -gate_proj: Linear [2048→8192]gate_proj [2048→8192] -up_proj: Linear [2048→8192]up_proj [2048→8192] -down_proj: Linear [8192→2048]down_proj [8192→2048] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 2048] -LM HeadLinear [2048→2051] -Softmax -logits[1, 6, 2051] +CsmForConditionalGeneration · forward data flow (shapes from a dummy input pass) +backbone_model · BackboneModel → [1×8×2048] +layers · 16× CsmDecoderLayer +self_attn · CsmAttention +mlp · CsmMLP +embed_tokens · CsmBackboneModelEmbeddings + + + + +input_ids [1, 8] +embed_text_tokens · Embedding → [1×8×2048] +embed_audio_tokens: Embedding [65632×2048]embed_audio_tokens Embedding [65632×2048] +q_proj: Linear [2048→2048]q_proj [2048→2048] +k_proj: Linear [2048→512]k_proj [2048→512] +v_proj: Linear [2048→512]v_proj [2048→512] +o_proj: Linear [2048→2048]o_proj [2048→2048] +gate_proj: Linear [2048→8192]gate_proj [2048→8192] +up_proj: Linear [2048→8192]up_proj [2048→8192] +down_proj: Linear [8192→2048]down_proj [8192→2048] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: CsmRMSNorm 2048input_layernorm RMSNorm 2048 +post_attention_layernorm: CsmRMSNorm 2048post_attention_layernorm RMSNorm 2048 +norm: CsmRMSNorm 2048norm RMSNorm 2048 +rotary_emb: CsmRotaryEmbeddingrotary_emb RotaryEmbedding +lm_head · Linear → [1×8×2051] +output [1×8×2051] model id sesame/csm-1b @@ -174,16 +165,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings False legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/d_fine.diff.svg b/d_fine.diff.svg index cd1c0f995a475804f5428d424c5a6ac7dfd1b3be..1f2511a847c5454a71849f0b9e58adb105acd2b6 100644 --- a/d_fine.diff.svg +++ b/d_fine.diff.svg @@ -1,4 +1,4 @@ - + - + d_fine diff vs rt_detr · 13 overridden · 88 added · 0 deleted · 9 new · 4 inherited-as-is - -DFineModel · base model -6 × DFineEncoderLayerDFineEncoderLayer× 6 -layers (idx) -Self-Attention · RTDetrSelfAttention ↩ inherited -MLP · DFineMLP -layers · ModuleList - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -0: Linear [256→1024]0 [256→1024] -1: Linear [1024→256]1 [1024→256] -act: GELUActivationact GELU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 +encoder · HybridEncoder +backbone · ConvEncoder +decoder · Decoder +model · HGNetV2Backbone +embedder · HGNetV2Embeddings +fpn_blocks · 2× DFineRepNCSPELAN4 +pan_blocks · 2× DFineRepNCSPELAN4 +layers · 6× DFineDecoderLayer +aifi · ModuleList +csp_rep1 · DFineCSPRepLayer +csp_rep2 · DFineCSPRepLayer +csp_rep1 · DFineCSPRepLayer +csp_rep2 · DFineCSPRepLayer +0 · RTDetrAIFILayer ↩ inherited +lqe_layers · 6× DFineLQE +encoder · HGNetV2Encoder +self_attn · RTDetrSelfAttention ↩ inherited +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +downsample_convs · 2× DFineSCDown +query_pos_head · DFineMLPPredictionHead +pre_bbox_head · DFineMLP +encoder_attn · DFineMultiscaleDeformableAttention +mlp · DFineMLP +gateway · DFineGate +reg_conf · DFineMLP +stages · 4× HGNetV2Stage +layers · ModuleList +bottlenecks · 3× DFineRepVggBlock +bottlenecks · 3× DFineRepVggBlock +bottlenecks · 3× DFineRepVggBlock +bottlenecks · 3× DFineRepVggBlock + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: DFineFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: DFineFrozenBatchNorm2d 16normalization FrozenBatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: DFineFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: DFineFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: DFineFrozenBatchNorm2d 48normalization FrozenBatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: DFineSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: DFineEncoderLayer0 EncoderLayer +lateral_convs: 2× DFineConvNormLayerlateral_convs 2× DFineConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv3: DFineConvNormLayerconv3 ConvNormLayer +conv4: DFineConvNormLayerconv4 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv3: DFineConvNormLayerconv3 ConvNormLayer +conv4: DFineConvNormLayerconv4 ConvNormLayer +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +layers: 2× Linearlayers 2× Linear +act: ReLUact ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +gate: Linear [512→512]gate [512→512] +norm: LayerNorm 256norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +integral: DFineIntegralintegral Integral +layers: 2× Linearlayers 2× Linear +act: ReLUact ReLU +decoder_input_proj · 3× Identity model id ustc-community/dfine-xlarge-co diff --git a/d_fine.svg b/d_fine.svg index 435f36716f2e89cdd6ebd078f1af2866e449f0aa..a33d69be20d977052d5b18f401db6a9cad7a7dfc 100644 --- a/d_fine.svg +++ b/d_fine.svg @@ -1,4 +1,4 @@ - + - + d_fine -dense · 2× MHA - -DFineModel · base model -6 × DFineEncoderLayerDFineEncoderLayer× 6 -layers (idx) -Self-Attention · DFineSelfAttention -MLP · DFineMLP -layers · ModuleList - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -0: Linear [256→1024]0 [256→1024] -1: Linear [1024→256]1 [1024→256] -act: GELUActivationact GELU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 +DFineModel · staged data flow (structure) +encoder · HybridEncoder +backbone · ConvEncoder +decoder · Decoder +model · HGNetV2Backbone +embedder · HGNetV2Embeddings +fpn_blocks · 2× DFineRepNCSPELAN4 +pan_blocks · 2× DFineRepNCSPELAN4 +layers · 6× DFineDecoderLayer +aifi · ModuleList +csp_rep1 · DFineCSPRepLayer +csp_rep2 · DFineCSPRepLayer +csp_rep1 · DFineCSPRepLayer +csp_rep2 · DFineCSPRepLayer +0 · DFineAIFILayer +lqe_layers · 6× DFineLQE +encoder · HGNetV2Encoder +self_attn · DFineSelfAttention +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +downsample_convs · 2× DFineSCDown +query_pos_head · DFineMLPPredictionHead +pre_bbox_head · DFineMLP +encoder_attn · DFineMultiscaleDeformableAttention +mlp · DFineMLP +gateway · DFineGate +reg_conf · DFineMLP +stages · 4× HGNetV2Stage +layers · ModuleList +bottlenecks · 3× DFineRepVggBlock +bottlenecks · 3× DFineRepVggBlock +bottlenecks · 3× DFineRepVggBlock +bottlenecks · 3× DFineRepVggBlock + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: DFineFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: DFineFrozenBatchNorm2d 16normalization FrozenBatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: DFineFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: DFineFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: DFineFrozenBatchNorm2d 48normalization FrozenBatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: DFineSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: DFineEncoderLayer0 EncoderLayer +lateral_convs: 2× DFineConvNormLayerlateral_convs 2× DFineConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv3: DFineConvNormLayerconv3 ConvNormLayer +conv4: DFineConvNormLayerconv4 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +conv1: DFineConvNormLayerconv1 ConvNormLayer +conv2: DFineConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +conv3: DFineConvNormLayerconv3 ConvNormLayer +conv4: DFineConvNormLayerconv4 ConvNormLayer +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +layers: 2× Linearlayers 2× Linear +act: ReLUact ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +gate: Linear [512→512]gate [512→512] +norm: LayerNorm 256norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +integral: DFineIntegralintegral Integral +layers: 2× Linearlayers 2× Linear +act: ReLUact ReLU +decoder_input_proj · 3× Identity model id ustc-community/dfine-xlarge-c… @@ -175,20 +273,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -basic - -bottleneck - -linear / proj - -MLP / feed-forward - -RoPE + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution normalization - -residual / skip + +activation + +pooling + +head \ No newline at end of file diff --git a/dab_detr.svg b/dab_detr.svg index 23efb09a75bc1061cc62861a601240119b6b8c31..6c866d39a71a362812ea1d83aa095c2ab79e2451 100644 --- a/dab_detr.svg +++ b/dab_detr.svg @@ -1,4 +1,4 @@ - + - + dab_detr -dense · 6× MHA - -DabDetrModel · base model -6 × DabDetrEncoderLayerDabDetrEncoderLayer× 6 -Self-Attention · DetrAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -out_proj: Linear [256→256]out_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] +DabDetrModel · staged data flow (structure) +decoder · Decoder +layers · 6× DabDetrDecoderLayer +encoder · Encoder +backbone · ConvModel +cross_attn · DabDetrDecoderLayerCrossAttention +conv_encoder · DabDetrConvEncoder +layers · 6× DabDetrEncoderLayer +self_attn · DabDetrDecoderLayerSelfAttention +model · TimmBackbone +_backbone · FeatureListNet +self_attn · DetrAttention +mlp · DabDetrDecoderLayerFFN +query_scale · DabDetrMLP +query_scale · DabDetrMLP +ref_point_head · DabDetrMLP +ref_anchor_head · DabDetrMLP +self_attn · DabDetrAttention +cross_attn · DabDetrAttention + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: DabDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +layer1: Sequential [3]layer1 Sequential [3] +layer2: Sequential [4]layer2 Sequential [4] +layer3: Sequential [6]layer3 Sequential [6] +layer4: Sequential [3]layer4 Sequential [3] +position_embedding: DabDetrSinePositionEmbeddingposition_embedding SinePositionEmbedding +query_refpoint_embeddings · Embedding +input_projection · Conv2d +layers: 2× Linearlayers 2× Linear +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +out_proj: Linear [256→256]out_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +activation_fn: PReLU 1activation_fn PReLU 1 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +self_attn_query_content_proj: Linear [256→256]self_attn_query_content_proj [256→256] +self_attn_query_pos_proj: Linear [256→256]self_attn_query_pos_proj [256→256] +self_attn_key_content_proj: Linear [256→256]self_attn_key_content_proj [256→256] +self_attn_key_pos_proj: Linear [256→256]self_attn_key_pos_proj [256→256] +self_attn_value_proj: Linear [256→256]self_attn_value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +cross_attn_query_content_proj: Linear [256→256]cross_attn_query_content_proj [256→256] +cross_attn_query_pos_proj: Linear [256→256]cross_attn_query_pos_proj [256→256] +cross_attn_key_content_proj: Linear [256→256]cross_attn_key_content_proj [256→256] +cross_attn_key_pos_proj: Linear [256→256]cross_attn_key_pos_proj [256→256] +cross_attn_value_proj: Linear [256→256]cross_attn_value_proj [256→256] +cross_attn_query_pos_sine_proj: Linear [256→256]cross_attn_query_pos_sine_proj [256→256] +cross_attn_layer_norm: LayerNorm 256cross_attn_layer_norm LayerNorm 256 +output_proj: Linear [256→256]output_proj [256→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: PReLU 1activation_fn PReLU 1 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +layers: 2× Linearlayers 2× Linear +layers: 2× Linearlayers 2× Linear model id IDEA-Research/dab-detr-resnet… @@ -164,16 +207,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/data2vec.diff.svg b/data2vec.diff.svg index 4b5f551cba5ff1de58c15de9ecdf9c6aa37070cc..72c1deb3db9b5b563a23a9032019943cc29e2d30 100644 --- a/data2vec.diff.svg +++ b/data2vec.diff.svg @@ -1,4 +1,4 @@ - + - + data2vec diff vs wav2vec2 · 15 overridden · 6 added · 5 deleted · 3 new · 7 inherited-as-is - -Data2VecTextModel · base model -12 × Data2VecTextLayerData2VecTextLayer× 12 -Data2VecTextForCausalLM · task head -Self-Attention · Wav2Vec2Attention ↩ inherited -output · Wav2Vec2SelfOutput ↩ inherited -self · Wav2Vec2SelfAttention ↩ inherited - -input_idstokenize("Hey, how are you?") → [1, 10] -token 0: 'H'H0 -token 1: '<unk>'<…1 -token 2: '<unk>'<…2 -token 3: '<unk>'<…3 -token 4: '|'|4 -token 5: '<unk>'<…5 -token 6: '<unk>'<…6 -token 7: '<unk>'<…7 -token 8: '|'|8 -token 9: '<unk>'<…9 -Token Embeddingweight [30522 × 768] → [1, 10, 768] -Normpre-attention [1, 10, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 10, 768] -Data2VecTextForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 10, 30522] +encoder · Encoder → [1×8×768] +layer · 12× Wav2Vec2Layer ↩ inherited +attention · Wav2Vec2Attention ↩ inherited +embeddings · Embeddings → [1×8×768] +output · Wav2Vec2Output ↩ inherited +self · Wav2Vec2SelfAttention ↩ inherited +output · Wav2Vec2SelfOutput ↩ inherited +pooler · Pooler → [1×768] +intermediate · Wav2Vec2Intermediate ↩ inherited + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id facebook/data2vec-audio-base-9 diff --git a/data2vec.svg b/data2vec.svg index 58884d34a2304fcfb37620f1b580550a4700c309..842149b8741e07725e9c87190c004b20974e62cc 100644 --- a/data2vec.svg +++ b/data2vec.svg @@ -1,4 +1,4 @@ - + - + data2vec -dense · 12× MHA - -Data2VecTextModel · base model -12 × Data2VecTextLayerData2VecTextLayer× 12 -Data2VecTextForCausalLM · task head -Self-Attention · Data2VecTextAttention -output · Data2VecTextSelfOutput -self · Data2VecTextSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 10] -token 0: 'H'H0 -token 1: '<unk>'<…1 -token 2: '<unk>'<…2 -token 3: '<unk>'<…3 -token 4: '|'|4 -token 5: '<unk>'<…5 -token 6: '<unk>'<…6 -token 7: '<unk>'<…7 -token 8: '|'|8 -token 9: '<unk>'<…9 -Token Embeddingweight [30522 × 768] → [1, 10, 768] -Normpre-attention [1, 10, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 10, 768] -Data2VecTextForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 10, 30522] +Data2VecTextModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× Data2VecTextLayer +attention · Data2VecTextAttention +embeddings · Embeddings → [1×8×768] +output · Data2VecTextOutput +self · Data2VecTextSelfAttention +output · Data2VecTextSelfOutput +pooler · Pooler → [1×768] +intermediate · Data2VecTextIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id facebook/data2vec-audio-base-… @@ -174,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/deformable_detr.diff.svg b/deformable_detr.diff.svg index 027c9d569a360d42ba8d2896bd00a0c09cc37da6..0b9947f9fcd81d91b68d3ea125dfc5a52e32fbdf 100644 --- a/deformable_detr.diff.svg +++ b/deformable_detr.diff.svg @@ -1,4 +1,4 @@ - + - + deformable_detr diff vs detr · 8 overridden · 56 added · 0 deleted · 9 new · 4 inherited-as-is - -DeformableDetrModel · base model -6 × DeformableDetrEncoderLayerDeformableDetrEncoderLayer× 6 -Self-Attention · DeformableDetrMultiscaleDeformable… -MLP · DetrMLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention -sampling_offsets: Linear [256→256]sampling_offsets [256→256] -attention_weights: Linear [256→128]attention_weights [256→128] -value_proj: Linear [256→256]value_proj [256→256] -output_proj: Linear [256→256]output_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] +backbone · ConvEncoder +model · FeatureListNet +decoder · Decoder +layers · 6× DeformableDetrDecoderLayer +encoder · Encoder +layers · 6× DeformableDetrEncoderLayer +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +self_attn · DeformableDetrMultiscaleDeformableAttention +encoder_attn · DeformableDetrMultiscaleDeformableAttention +self_attn · DetrSelfAttention ↩ inherited +input_proj · 4× Sequential +mlp · DetrMLP ↩ inherited +mlp · DetrMLP ↩ inherited +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + + + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: DeformableDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 64bn2 FrozenBatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 256bn3 FrozenBatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: DeformableDetrFrozenBatchNorm2d 2561 FrozenBatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 128bn1 FrozenBatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 128bn2 FrozenBatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 512bn3 FrozenBatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: DeformableDetrFrozenBatchNorm2d 5121 FrozenBatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 256bn1 FrozenBatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 256bn2 FrozenBatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 1024bn3 FrozenBatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: DeformableDetrFrozenBatchNorm2d 10241 FrozenBatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 512bn1 FrozenBatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 512bn2 FrozenBatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 2048bn3 FrozenBatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: DeformableDetrFrozenBatchNorm2d 20481 FrozenBatchNorm2d 2048 +position_embedding · SinePositionEmbedding +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +query_position_embeddings · Embedding +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +reference_points · Linear model id SenseTime/deformable-detr diff --git a/deformable_detr.svg b/deformable_detr.svg index 292efb741247b181f7a36cd0a767204fcf50e4aa..15615812f9100fc6f3fd96fca63c2b391dc659da 100644 --- a/deformable_detr.svg +++ b/deformable_detr.svg @@ -1,4 +1,4 @@ - + - + deformable_detr -dense · 6× MHA - -DeformableDetrModel · base model -6 × DeformableDetrEncoderLayerDeformableDetrEncoderLayer× 6 -Self-Attention · DeformableDetrMultiscaleDeformable… -MLP · DeformableDetrMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention -sampling_offsets: Linear [256→256]sampling_offsets [256→256] -attention_weights: Linear [256→128]attention_weights [256→128] -value_proj: Linear [256→256]value_proj [256→256] -output_proj: Linear [256→256]output_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] +DeformableDetrModel · staged data flow (structure) +backbone · ConvEncoder +model · FeatureListNet +decoder · Decoder +layers · 6× DeformableDetrDecoderLayer +encoder · Encoder +layers · 6× DeformableDetrEncoderLayer +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +self_attn · DeformableDetrMultiscaleDeformableAttention +encoder_attn · DeformableDetrMultiscaleDeformableAttention +self_attn · DeformableDetrSelfAttention +input_proj · 4× Sequential +mlp · DeformableDetrMLP +mlp · DeformableDetrMLP +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + + + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: DeformableDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 64bn2 FrozenBatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 256bn3 FrozenBatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: DeformableDetrFrozenBatchNorm2d 2561 FrozenBatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 128bn1 FrozenBatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 128bn2 FrozenBatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 512bn3 FrozenBatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: DeformableDetrFrozenBatchNorm2d 5121 FrozenBatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 256bn1 FrozenBatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 256bn2 FrozenBatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 1024bn3 FrozenBatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: DeformableDetrFrozenBatchNorm2d 10241 FrozenBatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: DeformableDetrFrozenBatchNorm2d 512bn1 FrozenBatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: DeformableDetrFrozenBatchNorm2d 512bn2 FrozenBatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: DeformableDetrFrozenBatchNorm2d 2048bn3 FrozenBatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: DeformableDetrFrozenBatchNorm2d 20481 FrozenBatchNorm2d 2048 +position_embedding · SinePositionEmbedding +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +query_position_embeddings · Embedding +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +reference_points · Linear model id SenseTime/deformable-detr @@ -172,16 +253,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/deimv2.diff.svg b/deimv2.diff.svg index 973e285772de28e8bc76cf81b150618415199106..d2e2ca3e35029d38e8b806bdeac3f86866d47af2 100644 --- a/deimv2.diff.svg +++ b/deimv2.diff.svg @@ -1,4 +1,4 @@ - + - + deimv2 diff vs d_fine (+llama) · 14 overridden · 29 added · 0 deleted · 8 new · 12 inherited-as-is - -Deimv2Model · base model -6 × Deimv2EncoderLayerDeimv2EncoderLayer× 6 -layers (idx) -Self-Attention · DFineSelfAttention ↩ inherited -MLP · DFineMLP ↩ inherited -layers · ModuleList - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -0: Linear [256→1024]0 [256→1024] -1: Linear [1024→256]1 [1024→256] -act: GELUActivationact GELU -residual add+ -Final RMSNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 +encoder · HybridEncoder +conv_encoder · ConvEncoder +decoder · Decoder +model · HGNetV2Backbone +embedder · HGNetV2Embeddings +fpn_blocks · 2× Deimv2RepNCSPELAN5 +pan_blocks · 2× Deimv2RepNCSPELAN5 +layers · 6× Deimv2DecoderLayer +aifi · ModuleList +csp_rep1 · Deimv2CSPRepLayer +csp_rep2 · Deimv2CSPRepLayer +csp_rep1 · Deimv2CSPRepLayer +csp_rep2 · Deimv2CSPRepLayer +0 · DFineAIFILayer ↩ inherited +lqe_layers · 6× DFineLQE ↩ inherited +encoder · HGNetV2Encoder +self_attn · DFineSelfAttention ↩ inherited +mlp · Deimv2SwiGLUFFN +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +enc_output · Sequential [2] +enc_bbox_head · MLP +downsample_convs · 2× DFineSCDown ↩ inherited +query_pos_head · DFineMLP ↩ inherited +pre_bbox_head · DFineMLP ↩ inherited +encoder_attn · DFineMultiscaleDeformableAttention ↩ inherited +gateway · Deimv2Gate +reg_conf · DFineMLP ↩ inherited +stages · 4× HGNetV2Stage +layers · ModuleList +bottlenecks · 3× DFineRepVggBlock ↩ inherited +bottlenecks · 3× DFineRepVggBlock ↩ inherited +bottlenecks · 3× DFineRepVggBlock ↩ inherited +bottlenecks · 3× DFineRepVggBlock ↩ inherited + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: Deimv2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: Deimv2FrozenBatchNorm2d 16normalization FrozenBatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: Deimv2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: Deimv2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: Deimv2FrozenBatchNorm2d 48normalization FrozenBatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +encoder_input_proj: 3× Deimv2ConvNormLayerencoder_input_proj 3× Deimv2ConvNormLayer +position_embedding: Deimv2SinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Deimv2EncoderLayer0 EncoderLayer +lateral_convs: 2× Deimv2ConvNormLayerlateral_convs 2× Deimv2ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +decoder_input_proj · 3× Identity +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: Deimv2RMSNorm 256self_attn_layer_norm RMSNorm 256 +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +gate_proj: Linear [256→512]gate_proj [256→512] +up_proj: Linear [256→512]up_proj [256→512] +down_proj: Linear [512→256]down_proj [512→256] +act_fn: SiLUact_fn SiLU +final_layer_norm: Deimv2RMSNorm 256final_layer_norm RMSNorm 256 +gate: Linear [512→512]gate [512→512] +norm: Deimv2RMSNorm 256norm RMSNorm 256 +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +integral: Deimv2Integralintegral Integral +layers: 2× Linearlayers 2× Linear +act: ReLUact ReLU model id Intellindust/DEIMv2_HGNetv2_N_ diff --git a/deimv2.svg b/deimv2.svg index 92a07b47d95e304fdfc92e09e264850cee587fa0..5cabe85f92c3cb7c8c28bac67d0eaa0f2bae1795 100644 --- a/deimv2.svg +++ b/deimv2.svg @@ -1,4 +1,4 @@ - + - + deimv2 -dense · 2× MHA - -Deimv2Model · base model -6 × Deimv2EncoderLayerDeimv2EncoderLayer× 6 -layers (idx) -Self-Attention · Deimv2SelfAttention -MLP · Deimv2MLP -layers · ModuleList - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -0: Linear [256→1024]0 [256→1024] -1: Linear [1024→256]1 [1024→256] -act: GELUActivationact GELU -residual add+ -Final RMSNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 +Deimv2Model · staged data flow (structure) +encoder · HybridEncoder +conv_encoder · ConvEncoder +decoder · Decoder +model · HGNetV2Backbone +embedder · HGNetV2Embeddings +fpn_blocks · 2× Deimv2RepNCSPELAN5 +pan_blocks · 2× Deimv2RepNCSPELAN5 +layers · 6× Deimv2DecoderLayer +aifi · ModuleList +csp_rep1 · Deimv2CSPRepLayer +csp_rep2 · Deimv2CSPRepLayer +csp_rep1 · Deimv2CSPRepLayer +csp_rep2 · Deimv2CSPRepLayer +0 · Deimv2AIFILayer +lqe_layers · 6× Deimv2LQE +encoder · HGNetV2Encoder +self_attn · Deimv2SelfAttention +mlp · Deimv2SwiGLUFFN +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +enc_output · Sequential [2] +enc_bbox_head · MLP +downsample_convs · 2× Deimv2SCDown +query_pos_head · Deimv2MLP +pre_bbox_head · Deimv2MLP +encoder_attn · Deimv2MultiscaleDeformableAttention +gateway · Deimv2Gate +reg_conf · Deimv2MLP +stages · 4× HGNetV2Stage +layers · ModuleList +bottlenecks · 3× Deimv2RepVggBlock +bottlenecks · 3× Deimv2RepVggBlock +bottlenecks · 3× Deimv2RepVggBlock +bottlenecks · 3× Deimv2RepVggBlock + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: Deimv2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: Deimv2FrozenBatchNorm2d 16normalization FrozenBatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: Deimv2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: Deimv2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: Deimv2FrozenBatchNorm2d 48normalization FrozenBatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +encoder_input_proj: 3× Deimv2ConvNormLayerencoder_input_proj 3× Deimv2ConvNormLayer +position_embedding: Deimv2SinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Deimv2EncoderLayer0 EncoderLayer +lateral_convs: 2× Deimv2ConvNormLayerlateral_convs 2× Deimv2ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv1: Deimv2ConvNormLayerconv1 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +conv2: Deimv2ConvNormLayerconv2 ConvNormLayer +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +decoder_input_proj · 3× Identity +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: Deimv2RMSNorm 256self_attn_layer_norm RMSNorm 256 +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +gate_proj: Linear [256→512]gate_proj [256→512] +up_proj: Linear [256→512]up_proj [256→512] +down_proj: Linear [512→256]down_proj [512→256] +act_fn: SiLUact_fn SiLU +final_layer_norm: Deimv2RMSNorm 256final_layer_norm RMSNorm 256 +gate: Linear [512→512]gate [512→512] +norm: Deimv2RMSNorm 256norm RMSNorm 256 +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +layers: 3× Linearlayers 3× Linear +act: ReLUact ReLU +integral: Deimv2Integralintegral Integral +layers: 2× Linearlayers 2× Linear +act: ReLUact ReLU model id Intellindust/DEIMv2_HGNetv2_N… @@ -175,20 +266,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -basic - -bottleneck - -linear / proj - -MLP / feed-forward - -RoPE + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution normalization - -residual / skip + +activation + +pooling + +head \ No newline at end of file diff --git a/deit.diff.svg b/deit.diff.svg index e3039b21acfa63d63f26ca06a18f3502c96d94c8..4881eaf0338a5590aff58baee603076fa33588ba 100644 --- a/deit.diff.svg +++ b/deit.diff.svg @@ -1,4 +1,4 @@ - + - + deit diff vs vit · 6 overridden · 7 added · 0 deleted · 2 new · 2 inherited-as-is - -DeiTModel · base model -12 × DeiTLayerDeiTLayer× 12 -DeiTForImageClassification · task head -Self-Attention · ViTAttention ↩ inherited -MLP · ViTMLP ↩ inherited - - -input imagepixel_values [1, 3, H, W] -Patch Embeddingconv patches → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -q_proj: Linear [768→768]q_proj [768→768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -o_proj: Linear [768→768]o_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [768→3072]fc1 [768→3072] -fc2: Linear [3072→768]fc2 [3072→768] -residual add+ -Final LayerNorm[1, 6, 768] -DeiTForImageClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -DeiTForImageClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +embeddings · Embeddings → [1×198×768] +pooler · Pooler → [1×768] +patch_embeddings · DeiTPatchEmbeddings + + + + +pixel_values [1, 3, 224, 224] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +layernorm · LayerNorm → [1×198×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×198×768] model id facebook/deit-base-distilled-p diff --git a/deit.svg b/deit.svg index 06d5b8e01a6ffcf1e9fa08e6c69a6ff7673021b3..104e68f9f1a5e8a2f2d0c74f59ea4c3bed7c70b7 100644 --- a/deit.svg +++ b/deit.svg @@ -1,4 +1,4 @@ - + - + deit -dense · 12× MHA - -DeiTModel · base model -12 × DeiTLayerDeiTLayer× 12 -DeiTForImageClassification · task head -Self-Attention · DeiTAttention -MLP · DeiTMLP - - -input imagepixel_values [1, 3, H, W] -Patch Embeddingconv patches → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -q_proj: Linear [768→768]q_proj [768→768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -o_proj: Linear [768→768]o_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [768→3072]fc1 [768→3072] -fc2: Linear [3072→768]fc2 [3072→768] -residual add+ -Final LayerNorm[1, 6, 768] -DeiTForImageClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -DeiTForImageClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +DeiTModel · forward data flow (shapes from a dummy input pass) +embeddings · Embeddings → [1×198×768] +pooler · Pooler → [1×768] +patch_embeddings · DeiTPatchEmbeddings + + + + +pixel_values [1, 3, 224, 224] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +layernorm · LayerNorm → [1×198×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×198×768] model id facebook/deit-base-distilled-… @@ -167,16 +153,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/depth_anything.svg b/depth_anything.svg index d4e22e44b3304468fbf29a04f413ac1f9b3dd7b5..69baa0ba8e79e725a8a5b41681d3349d6a630f19 100644 --- a/depth_anything.svg +++ b/depth_anything.svg @@ -1,4 +1,4 @@ - + - + depth_anything -dense · 12× Attention - -DepthAnythingForDepthEstimation · base model -12 × Dinov2LayerDinov2Layer× 12 -Self-Attention · Dinov2Attention -MLP · Dinov2MLP -attention · Dinov2SelfAttention -output · Dinov2SelfOutput - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × ?] → [1, 6, ?] -LayerNormpre-attention [1, 6, ?] -query: Linear [384→384]query [384→384] -key: Linear [384→384]key [384→384] -value: Linear [384→384]value [384→384] -dense: Linear [384→384]dense [384→384] -dropout: Dropoutdropout Dropout -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, ?] -fc1: Linear [384→1536]fc1 [384→1536] -activation: GELUActivationactivation GELU -fc2: Linear [1536→384]fc2 [1536→384] -residual add+ -Final LayerNorm[1, 6, ?] -LM HeadLinear [?→?] -Softmax -logits[1, 6, ?] +DepthAnythingForDepthEstimation · forward data flow (shapes from a dummy input pass) +backbone · Dinov2Backbone +neck · Neck → [1×64×4×4] +encoder · Dinov2Encoder +fusion_stage · DepthAnythingFeatureFusionStage +layer · 12× Dinov2Layer +layers · 4× DepthAnythingFeatureFusionLayer +embeddings · Dinov2Embeddings +reassemble_stage · DepthAnythingReassembleStage +head · DepthEstimationHead → [1×56×56] +residual_layer1 · DepthAnythingPreActResidualLayer +residual_layer2 · DepthAnythingPreActResidualLayer +patch_embeddings · Dinov2PatchEmbeddings +layers · 4× DepthAnythingReassembleLayer +attention · Dinov2Attention +mlp · Dinov2MLP + + + +pixel_values [1, 3, 64, 64] +projection: Conv2d 3→384 k14×14projection Conv2d 3→384 k14×14 +dropout: Dropoutdropout Dropout +norm1: LayerNorm 384norm1 LayerNorm 384 +attention: Dinov2SelfAttentionattention Dinov2SelfAttention +output: Dinov2SelfOutputoutput Dinov2SelfOutput +layer_scale1: Dinov2LayerScalelayer_scale1 Dinov2LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 384norm2 LayerNorm 384 +fc1: Linear [384→1536]fc1 [384→1536] +activation: GELUActivationactivation GELU +fc2: Linear [1536→384]fc2 [1536→384] +layer_scale2: Dinov2LayerScalelayer_scale2 Dinov2LayerScale +layernorm: LayerNorm 384layernorm LayerNorm 384 +projection: Conv2d 384→48 k1×1projection Conv2d 384→48 k1×1 +resize: ConvTranspose2dresize ConvTranspose2d +convs: 4× Conv2dconvs 4× Conv2d +projection: Conv2d 64→64 k1×1projection Conv2d 64→64 k1×1 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 64→64 k3×3convolution1 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 64→64 k3×3convolution1 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +conv1: Conv2d 64→32 k3×3conv1 Conv2d 64→32 k3×3 +conv2: Conv2d 32→32 k3×3conv2 Conv2d 32→32 k3×3 +activation1: ReLUactivation1 ReLU +conv3: Conv2d 32→1 k1×1conv3 Conv2d 32→1 k1×1 +activation2: ReLUactivation2 ReLU model id LiheYoung/depth-anything-smal… @@ -174,16 +188,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/detr.svg b/detr.svg index ed4c9ea84a5551624513c1c08ec9f1222062c646..d0dab398e05f7220c2f5cb4660af8ac1500c8851 100644 --- a/detr.svg +++ b/detr.svg @@ -1,4 +1,4 @@ - + - + detr -dense · 6× MHA - -DetrModel · base model -6 × DetrEncoderLayerDetrEncoderLayer× 6 -Self-Attention · DetrSelfAttention -MLP · DetrMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→2048]fc1 [256→2048] -fc2: Linear [2048→256]fc2 [2048→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +DetrModel · staged data flow (structure) +backbone · ConvEncoder +model · FeatureListNet +decoder · Decoder +layers · 6× DetrDecoderLayer +encoder · Encoder +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +layers · 6× DetrEncoderLayer +self_attn · DetrSelfAttention +self_attn · DetrSelfAttention +encoder_attn · DetrCrossAttention +mlp · DetrMLP +mlp · DetrMLP +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: DetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: DetrFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: DetrFrozenBatchNorm2d 64bn2 FrozenBatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: DetrFrozenBatchNorm2d 256bn3 FrozenBatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: DetrFrozenBatchNorm2d 2561 FrozenBatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: DetrFrozenBatchNorm2d 128bn1 FrozenBatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: DetrFrozenBatchNorm2d 128bn2 FrozenBatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: DetrFrozenBatchNorm2d 512bn3 FrozenBatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: DetrFrozenBatchNorm2d 5121 FrozenBatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: DetrFrozenBatchNorm2d 256bn1 FrozenBatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: DetrFrozenBatchNorm2d 256bn2 FrozenBatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: DetrFrozenBatchNorm2d 1024bn3 FrozenBatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: DetrFrozenBatchNorm2d 10241 FrozenBatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: DetrFrozenBatchNorm2d 512bn1 FrozenBatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: DetrFrozenBatchNorm2d 512bn2 FrozenBatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: DetrFrozenBatchNorm2d 2048bn3 FrozenBatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: DetrFrozenBatchNorm2d 20481 FrozenBatchNorm2d 2048 +position_embedding · SinePositionEmbedding +query_position_embeddings · Embedding +input_projection · Conv2d +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 model id facebook/detr-resnet-50 @@ -171,16 +248,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/dpt.diff.svg b/dpt.diff.svg index 2118e244b9a8d5153ebdb4f9f01b45f4ddd1022f..359f1f070ff7fa3e5599789de547f37cc8e530ad 100644 --- a/dpt.diff.svg +++ b/dpt.diff.svg @@ -1,4 +1,4 @@ - + - + dpt diff vs None · 0 overridden · 23 added · 0 deleted · 2 new · 0 inherited-as-is - -DPTModel · base model -12 × DPTViTLayerDPTViTLayer× 12 -Self-Attention · DPTViTAttention -attention · DPTSelfAttention -output · DPTViTSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→?] -Softmax -logits[1, 6, ?] +encoder · ViTEncoder → [1×577×768] +layer · 12× DPTViTLayer +attention · DPTViTAttention +embeddings · ViTEmbeddings +pooler · ViTPooler → [1×768] +patch_embeddings · DPTViTPatchEmbeddings +intermediate · DPTViTIntermediate +output · DPTViTOutput +attention · DPTSelfAttention +output · DPTViTSelfOutput + + + + + +pixel_values [1, 3, 384, 384] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dense: Linear [768→768]dense [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +layernorm · LayerNorm → [1×577×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×577×768] model id Intel/dpt-large diff --git a/dpt.svg b/dpt.svg index 20b633d589786b4fb7ce6a67e50b6164425b40d3..e4d2a9fa86b588dcf4af6ef89606ea4465f4e89e 100644 --- a/dpt.svg +++ b/dpt.svg @@ -1,4 +1,4 @@ - + - + dpt -dense · 12× MHA - -DPTModel · base model -12 × DPTViTLayerDPTViTLayer× 12 -Self-Attention · DPTViTAttention -attention · DPTSelfAttention -output · DPTViTSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→?] -Softmax -logits[1, 6, ?] +DPTModel · forward data flow (shapes from a dummy input pass) +encoder · ViTEncoder → [1×577×768] +layer · 12× DPTViTLayer +attention · DPTViTAttention +embeddings · ViTEmbeddings +pooler · ViTPooler → [1×768] +patch_embeddings · DPTViTPatchEmbeddings +intermediate · DPTViTIntermediate +output · DPTViTOutput +attention · DPTSelfAttention +output · DPTViTSelfOutput + + + + + +pixel_values [1, 3, 384, 384] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dense: Linear [768→768]dense [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +layernorm · LayerNorm → [1×577×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×577×768] model id Intel/dpt-large @@ -167,16 +172,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/encodec.svg b/encodec.svg index 5f61ceb7c5965d0c5e291047f8bac3181d2adcda..351f87155d03dfec477c7b0b14424e47d0307e68 100644 --- a/encodec.svg +++ b/encodec.svg @@ -1,4 +1,4 @@ - + - + encodec -EncodecModel · forward data flow (shapes from a dummy input pass) -decoder · Decoder → [1×1×8000] -layers · ModuleList [16] -encoder · Encoder → [1×128×25] -layers · ModuleList [16] -[2:14] · 4× (ELU, EncodecConvTranspose1d, EncodecResnetBlock) -[0:12] · 4× (EncodecConv1d, EncodecResnetBlock, ELU) -1 · EncodecResnetBlock -4 · EncodecResnetBlock -block · ModuleList [4] -block · ModuleList [4] -3 · EncodecConvTranspose1d -[0:4] · 2× (ELU, EncodecConv1d) -[0:4] · 2× (ELU, EncodecConv1d) -conv · ParametrizedConvTranspose1d -12 · EncodecConv1d -13 · EncodecLSTM -15 · EncodecConv1d -0 · EncodecConv1d -1 · EncodecLSTM -15 · EncodecConv1d -0 · EncodecConv1d -shortcut · EncodecConv1d -shortcut · EncodecConv1d -parametrizations · ModuleDict -1 · EncodecConv1d -1 · EncodecConv1d - - - -input_values [1, 1, 8000] -conv: ParametrizedConv1d 1→32 k7conv ParametrizedConv1d 1→32 k7 -0: ELU0 ELU -conv: ParametrizedConv1d 32→16 k3conv ParametrizedConv1d 32→16 k3 -conv: ParametrizedConv1d 32→32 k1conv ParametrizedConv1d 32→32 k1 -2: ELU2 ELU -conv: ParametrizedConv1d 256→512 k16conv ParametrizedConv1d 256→512 k16 -lstm: LSTMlstm LSTM -14: ELU14 ELU -conv: ParametrizedConv1d 512→128 k7conv ParametrizedConv1d 512→128 k7 -conv: ParametrizedConv1d 128→512 k7conv ParametrizedConv1d 128→512 k7 -lstm: LSTMlstm LSTM -2: ELU2 ELU -weight: ParametrizationListweight ParametrizationList -0: ELU0 ELU -conv: ParametrizedConv1d 256→128 k3conv ParametrizedConv1d 256→128 k3 -conv: ParametrizedConv1d 256→256 k1conv ParametrizedConv1d 256→256 k1 -14: ELU14 ELU -conv: ParametrizedConv1d 32→1 k7conv ParametrizedConv1d 32→1 k7 -output [1×1×8000] +EncodecModel · staged data flow (structure) +decoder · Decoder +layers · ModuleList [16] +encoder · Encoder +layers · ModuleList [16] +[2:14] · 4× (ELU, EncodecConvTranspose1d, EncodecResnetBlock) +[0:12] · 4× (EncodecConv1d, EncodecResnetBlock, ELU) +1 · EncodecResnetBlock +4 · EncodecResnetBlock +block · ModuleList [4] +block · ModuleList [4] +3 · EncodecConvTranspose1d +[0:4] · 2× (ELU, EncodecConv1d) +[0:4] · 2× (ELU, EncodecConv1d) +quantizer · ResidualVectorQuantizer +conv · ParametrizedConvTranspose1d +layers · 32× EncodecVectorQuantization +12 · EncodecConv1d +13 · EncodecLSTM +15 · EncodecConv1d +0 · EncodecConv1d +1 · EncodecLSTM +15 · EncodecConv1d +0 · EncodecConv1d +shortcut · EncodecConv1d +shortcut · EncodecConv1d +parametrizations · ModuleDict +1 · EncodecConv1d +1 · EncodecConv1d + + + +inputsinput_ids / pixel_values / input_values +conv: ParametrizedConv1d 1→32 k7conv ParametrizedConv1d 1→32 k7 +0: ELU0 ELU +conv: ParametrizedConv1d 32→16 k3conv ParametrizedConv1d 32→16 k3 +conv: ParametrizedConv1d 32→32 k1conv ParametrizedConv1d 32→32 k1 +2: ELU2 ELU +conv: ParametrizedConv1d 256→512 k16conv ParametrizedConv1d 256→512 k16 +lstm: LSTMlstm LSTM +14: ELU14 ELU +conv: ParametrizedConv1d 512→128 k7conv ParametrizedConv1d 512→128 k7 +conv: ParametrizedConv1d 128→512 k7conv ParametrizedConv1d 128→512 k7 +lstm: LSTMlstm LSTM +2: ELU2 ELU +weight: ParametrizationListweight ParametrizationList +0: ELU0 ELU +conv: ParametrizedConv1d 256→128 k3conv ParametrizedConv1d 256→128 k3 +conv: ParametrizedConv1d 256→256 k1conv ParametrizedConv1d 256→256 k1 +14: ELU14 ELU +conv: ParametrizedConv1d 32→1 k7conv ParametrizedConv1d 32→1 k7 +codebook: EncodecEuclideanCodebookcodebook EuclideanCodebook model id facebook/encodec_24khz diff --git a/eomt.diff.svg b/eomt.diff.svg index 4cef238a9cda6b78e2d3ffb83423fe076a436e44..d6fdcb0bf119170a727ed3afb5222f520c3a70f3 100644 --- a/eomt.diff.svg +++ b/eomt.diff.svg @@ -1,4 +1,4 @@ - + - + eomt diff vs dinov2 (+mask2former,siglip) · 5 overridden · 61 added · 2 deleted · 7 new · 4 inherited-as-is - -EomtForUniversalSegmentation · base model -24 × EomtLayerEomtLayer× 24 -Self-Attention · Dinov2Attention ↩ inherited -MLP · Dinov2MLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -out_proj: Linear [1024→1024]out_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -fc1: Linear [1024→4096]fc1 [1024→4096] -activation: GELUActivationactivation GELU -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +layers · 24× EomtLayer +embeddings · Embeddings +upscale_block · ScaleBlock +mask_head · MaskHead +attention · Dinov2Attention ↩ inherited +block · 2× EomtScaleLayer +criterion · Loss +patch_embeddings · EomtPatchEmbeddings +mlp · Dinov2MLP ↩ inherited + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→1024 k16×16projection Conv2d 3→1024 k16×16 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [1600×1024]position_embeddings Embedding [1600×1024] +layernorm · LayerNorm +query · Embedding +norm1: LayerNorm 1024norm1 LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +layer_scale1: EomtLayerScalelayer_scale1 LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 1024norm2 LayerNorm 1024 +fc1: Linear [1024→4096]fc1 [1024→4096] +activation: GELUActivationactivation GELU +fc2: Linear [4096→1024]fc2 [4096→1024] +layer_scale2: EomtLayerScalelayer_scale2 LayerScale +conv1: ConvTranspose2dconv1 ConvTranspose2d +activation: GELUActivationactivation GELU +conv2: Conv2d 1024→1024 k3×3 g1024conv2 Conv2d 1024→1024 k3×3 g1024 +layernorm2d: EomtLayerNorm2d 1024layernorm2d LayerNorm2d 1024 +fc1: Linear [1024→1024]fc1 [1024→1024] +fc2: Linear [1024→1024]fc2 [1024→1024] +fc3: Linear [1024→1024]fc3 [1024→1024] +activation: GELUActivationactivation GELU +class_predictor · Linear +matcher: EomtHungarianMatchermatcher HungarianMatcher model id tue-mps/coco_panoptic_eomt_lar diff --git a/eomt.svg b/eomt.svg index eb9914227ca76766e8ce00b88b4e765400d9c092..39886c9971daabd1b2aa19e64e2b4f696213b075 100644 --- a/eomt.svg +++ b/eomt.svg @@ -1,4 +1,4 @@ - + - + eomt -dense · 24× MHA - -EomtForUniversalSegmentation · base model -24 × EomtLayerEomtLayer× 24 -Self-Attention · EomtAttention -MLP · EomtMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -out_proj: Linear [1024→1024]out_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -fc1: Linear [1024→4096]fc1 [1024→4096] -activation: GELUActivationactivation GELU -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +EomtForUniversalSegmentation · staged data flow (structure) +layers · 24× EomtLayer +embeddings · Embeddings +upscale_block · ScaleBlock +mask_head · MaskHead +attention · EomtAttention +block · 2× EomtScaleLayer +criterion · Loss +patch_embeddings · EomtPatchEmbeddings +mlp · EomtMLP + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→1024 k16×16projection Conv2d 3→1024 k16×16 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [1600×1024]position_embeddings Embedding [1600×1024] +layernorm · LayerNorm +query · Embedding +norm1: LayerNorm 1024norm1 LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +layer_scale1: EomtLayerScalelayer_scale1 LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 1024norm2 LayerNorm 1024 +fc1: Linear [1024→4096]fc1 [1024→4096] +activation: GELUActivationactivation GELU +fc2: Linear [4096→1024]fc2 [4096→1024] +layer_scale2: EomtLayerScalelayer_scale2 LayerScale +conv1: ConvTranspose2dconv1 ConvTranspose2d +activation: GELUActivationactivation GELU +conv2: Conv2d 1024→1024 k3×3 g1024conv2 Conv2d 1024→1024 k3×3 g1024 +layernorm2d: EomtLayerNorm2d 1024layernorm2d LayerNorm2d 1024 +fc1: Linear [1024→1024]fc1 [1024→1024] +fc2: Linear [1024→1024]fc2 [1024→1024] +fc3: Linear [1024→1024]fc3 [1024→1024] +activation: GELUActivationactivation GELU +class_predictor · Linear +matcher: EomtHungarianMatchermatcher HungarianMatcher model id tue-mps/coco_panoptic_eomt_la… @@ -171,16 +184,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/eomt_dinov3.diff.svg b/eomt_dinov3.diff.svg index e9db2ab45b36c62605065fc89c596f6b98153103..e637464b9acf70e5ec8a822e39adbec50a7dec11 100644 --- a/eomt_dinov3.diff.svg +++ b/eomt_dinov3.diff.svg @@ -1,4 +1,4 @@ - + - + eomt_dinov3 diff vs dinov3_vit (+eomt) · 9 overridden · 41 added · 0 deleted · 1 new · 5 inherited-as-is - -EomtDinov3ForUniversalSegmentation · base model -24 × EomtDinov3LayerEomtDinov3Layer× 24 -Self-Attention · DINOv3ViTAttention ↩ inherited -MLP · DINOv3ViTMLP ↩ inherited - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -o_proj: Linear [1024→1024]o_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 1024] -up_proj: Linear [1024→4096]up_proj [1024→4096] -down_proj: Linear [4096→1024]down_proj [4096→1024] -act_fn: GELUActivationact_fn GELU -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +layers · 24× DINOv3ViTLayer ↩ inherited +upscale_block · ScaleBlock +mask_head · MaskHead +attention · DINOv3ViTAttention ↩ inherited +block · 2× DINOv3ViTScaleLayer ↩ inherited +embeddings · Embeddings +criterion · Loss +mlp · DINOv3ViTMLP ↩ inherited + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +patch_embeddings: Conv2d 3→1024 k16×16patch_embeddings Conv2d 3→1024 k16×16 +layernorm · LayerNorm +query · Embedding +norm1: LayerNorm 1024norm1 LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +layer_scale1: EomtDinov3LayerScalelayer_scale1 LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 1024norm2 LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +down_proj: Linear [4096→1024]down_proj [4096→1024] +act_fn: GELUActivationact_fn GELU +layer_scale2: EomtDinov3LayerScalelayer_scale2 LayerScale +conv1: ConvTranspose2dconv1 ConvTranspose2d +activation: GELUActivationactivation GELU +conv2: Conv2d 1024→1024 k3×3 g1024conv2 Conv2d 1024→1024 k3×3 g1024 +layernorm2d: EomtDinov3LayerNorm2d 1024layernorm2d LayerNorm2d 1024 +fc1: Linear [1024→1024]fc1 [1024→1024] +fc2: Linear [1024→1024]fc2 [1024→1024] +fc3: Linear [1024→1024]fc3 [1024→1024] +activation: GELUActivationactivation GELU +class_predictor · Linear +matcher: EomtDinov3HungarianMatchermatcher HungarianMatcher +dropout · Dropout +rope_embeddings · RotaryEmbedding model id tue-mps/coco_panoptic_eomt_lar diff --git a/eomt_dinov3.svg b/eomt_dinov3.svg index 3d6849f589c93f4a7bbebbbe3b8a6cad8a23773e..7b78834a2ee073e3b08065421f62c5e2c878df4c 100644 --- a/eomt_dinov3.svg +++ b/eomt_dinov3.svg @@ -1,4 +1,4 @@ - + - + eomt_dinov3 -dense · 24× MHA - -EomtDinov3ForUniversalSegmentation · base model -24 × EomtDinov3LayerEomtDinov3Layer× 24 -Self-Attention · EomtDinov3Attention -MLP · EomtDinov3MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -o_proj: Linear [1024→1024]o_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 1024] -up_proj: Linear [1024→4096]up_proj [1024→4096] -down_proj: Linear [4096→1024]down_proj [4096→1024] -act_fn: GELUActivationact_fn GELU -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +EomtDinov3ForUniversalSegmentation · staged data flow (structure) +layers · 24× EomtDinov3Layer +upscale_block · ScaleBlock +mask_head · MaskHead +attention · EomtDinov3Attention +block · 2× EomtDinov3ScaleLayer +embeddings · Embeddings +criterion · Loss +mlp · EomtDinov3MLP + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +patch_embeddings: Conv2d 3→1024 k16×16patch_embeddings Conv2d 3→1024 k16×16 +layernorm · LayerNorm +query · Embedding +norm1: LayerNorm 1024norm1 LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +layer_scale1: EomtDinov3LayerScalelayer_scale1 LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 1024norm2 LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +down_proj: Linear [4096→1024]down_proj [4096→1024] +act_fn: GELUActivationact_fn GELU +layer_scale2: EomtDinov3LayerScalelayer_scale2 LayerScale +conv1: ConvTranspose2dconv1 ConvTranspose2d +activation: GELUActivationactivation GELU +conv2: Conv2d 1024→1024 k3×3 g1024conv2 Conv2d 1024→1024 k3×3 g1024 +layernorm2d: EomtDinov3LayerNorm2d 1024layernorm2d LayerNorm2d 1024 +fc1: Linear [1024→1024]fc1 [1024→1024] +fc2: Linear [1024→1024]fc2 [1024→1024] +fc3: Linear [1024→1024]fc3 [1024→1024] +activation: GELUActivationactivation GELU +class_predictor · Linear +matcher: EomtDinov3HungarianMatchermatcher HungarianMatcher +dropout · Dropout +rope_embeddings · RotaryEmbedding model id tue-mps/coco_panoptic_eomt_la… @@ -173,16 +185,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/ernie.diff.svg b/ernie.diff.svg index b36e0e80f3e2821b8a56f0dceac79ea114f36928..c5d21007e0731c0360c986a40adfd7542d307e1a 100644 --- a/ernie.diff.svg +++ b/ernie.diff.svg @@ -1,4 +1,4 @@ - + - + ernie diff vs bert · 15 overridden · 9 added · 0 deleted · 1 new · 7 inherited-as-is - -ErnieModel · base model -12 × ErnieLayerErnieLayer× 12 -ErnieForCausalLM · task head -Self-Attention · BertAttention ↩ inherited -output · BertSelfOutput ↩ inherited -self · BertSelfAttention ↩ inherited - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -ErnieForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +encoder · Encoder → [1×8×768] +layer · 12× BertLayer ↩ inherited +attention · BertAttention ↩ inherited +embeddings · Embeddings → [1×8×768] +output · BertOutput ↩ inherited +self · BertSelfAttention ↩ inherited +output · BertSelfOutput ↩ inherited +pooler · Pooler → [1×768] +intermediate · BertIntermediate ↩ inherited + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id nghuyong/ernie-3.0-base-zh diff --git a/ernie.svg b/ernie.svg index 6fc1c2ef924a22d8afb6cbbfa0ec87fed0db0433..9101d5ec147d2502e61c1e3994fa4ae0d1860351 100644 --- a/ernie.svg +++ b/ernie.svg @@ -1,4 +1,4 @@ - + - + ernie -dense · 12× MHA - -ErnieModel · base model -12 × ErnieLayerErnieLayer× 12 -ErnieForCausalLM · task head -Self-Attention · ErnieAttention -output · ErnieSelfOutput -self · ErnieSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -ErnieForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +ErnieModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× ErnieLayer +attention · ErnieAttention +embeddings · Embeddings → [1×8×768] +output · ErnieOutput +self · ErnieSelfAttention +output · ErnieSelfOutput +pooler · Pooler → [1×768] +intermediate · ErnieIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id nghuyong/ernie-3.0-base-zh @@ -170,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/esm.svg b/esm.svg index 27345762542e654a62088aebecea5af0c2f86215..4a1d0e4427812c31c87d8bee28463a8072da5469 100644 --- a/esm.svg +++ b/esm.svg @@ -1,4 +1,4 @@ - + - + esm -dense · 12× MHA - -EsmModel · base model -12 × EsmLayerEsmLayer× 12 -EsmForMaskedLM · task head -Self-Attention · EsmAttention -self · EsmSelfAttention -output · EsmSelfOutput - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [33 × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -RoPE θ=10,000rotary positions → Q, K -residual add+ -Final LayerNorm[1, 6, 768] -EsmForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -EsmForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +EsmModel · staged data flow (structure) +encoder · Encoder +layer · 12× EsmLayer +attention · EsmAttention +embeddings · Embeddings +pooler · Pooler +contact_head · ContactPredictionHead +intermediate · EsmIntermediate +output · EsmOutput +self · EsmSelfAttention +output · EsmSelfOutput + + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [33×768]word_embeddings Embedding [33×768] +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [1026×768]position_embeddings Embedding [1026×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dense: Linear [768→768]dense [768→768] +dropout: Dropoutdropout Dropout +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dense: Linear [768→3072]dense [768→3072] +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +emb_layer_norm_after: LayerNorm 768emb_layer_norm_after LayerNorm 768 +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +regression: Linear [144→1]regression [144→1] +activation: Sigmoidactivation Sigmoid model id facebook/esm-1b @@ -172,16 +172,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/fastspeech2_conformer.svg b/fastspeech2_conformer.svg index 399a371b69a649d64ee7df758707ebf5bda39cfa..aa76bfbce7ae882875fc94aeeec713b04a47e1c3 100644 --- a/fastspeech2_conformer.svg +++ b/fastspeech2_conformer.svg @@ -1,4 +1,4 @@ - + - + fastspeech2_conformer -dense · 4× MHA - -FastSpeech2ConformerModel · base model -4 × FastSpeech2ConformerEncoderLayerFastSpeech2ConformerEncoderLayer× 4 -Self-Attention · FastSpeech2ConformerAttention -MLP · FastSpeech2ConformerMultiLayeredConv1d - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [78 × 384] → [1, 6, 384] -LayerNormpre-attention [1, 6, 384] -linear_q: Linear [384→384]linear_q [384→384] -linear_k: Linear [384→384]linear_k [384→384] -linear_v: Linear [384→384]linear_v [384→384] -linear_out: Linear [384→384]linear_out [384→384] -dropout: Dropoutdropout Dropout -linear_pos: Linear [384→384]linear_pos [384→384] -scaled dot-product attention2 heads · head_dim 192 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 384] -conv1: Conv1d 1536×384×3conv1 Conv1d 1536×384×3 -conv2: Conv1d 384×1536×3conv2 Conv1d 384×1536×3 -dropout: Dropoutdropout Dropout -residual add+ -Final LayerNorm[1, 6, 384] -LM HeadLinear [384→78] -Softmax -logits[1, 6, 78] +FastSpeech2ConformerModel · staged data flow (structure) +encoder · Encoder +decoder · Encoder +conformer_layers · 4× FastSpeech2ConformerEncoderLayer +conformer_layers · 4× FastSpeech2ConformerEncoderLayer +conv_module · FastSpeech2ConformerConvolutionModule +conv_module · FastSpeech2ConformerConvolutionModule +duration_predictor · DurationPredictor +pitch_predictor · VariancePredictor +energy_predictor · VariancePredictor +speech_decoder_postnet · SpeechDecoderPostnet +conv_layers · 2× FastSpeech2ConformerPredictorLayer +conv_layers · 5× FastSpeech2ConformerPredictorLayer +conv_layers · 2× FastSpeech2ConformerPredictorLayer +self_attn · FastSpeech2ConformerAttention +feed_forward · FastSpeech2ConformerMultiLayeredConv1d +feed_forward_macaron · FastSpeech2ConformerMultiLayeredConv1d +self_attn · FastSpeech2ConformerAttention +feed_forward · FastSpeech2ConformerMultiLayeredConv1d +feed_forward_macaron · FastSpeech2ConformerMultiLayeredConv1d +pitch_embed · VarianceEmbedding +energy_embed · VarianceEmbedding +criterion · Loss +pos_enc · FastSpeech2ConformerRelPositionalEncoding +pos_enc · FastSpeech2ConformerRelPositionalEncoding + + + + + + + + + +inputsinput_ids / pixel_values / input_values +embed: Embedding [78×384]embed Embedding [78×384] +dropout: Dropoutdropout Dropout +linear_q: Linear [384→384]linear_q [384→384] +linear_k: Linear [384→384]linear_k [384→384] +linear_v: Linear [384→384]linear_v [384→384] +linear_out: Linear [384→384]linear_out [384→384] +dropout: Dropoutdropout Dropout +linear_pos: Linear [384→384]linear_pos [384→384] +conv1: Conv1d 384→1536 k3conv1 Conv1d 384→1536 k3 +conv2: Conv1d 1536→384 k3conv2 Conv1d 1536→384 k3 +dropout: Dropoutdropout Dropout +conv1: Conv1d 384→1536 k3conv1 Conv1d 384→1536 k3 +conv2: Conv1d 1536→384 k3conv2 Conv1d 1536→384 k3 +dropout: Dropoutdropout Dropout +ff_macaron_layer_norm: LayerNorm 384ff_macaron_layer_norm LayerNorm 384 +activation: SiLUActivationactivation SiLU +pointwise_conv1: Conv1d 384→768 k1pointwise_conv1 Conv1d 384→768 k1 +depthwise_conv: Conv1d 384→384 k7 g384depthwise_conv Conv1d 384→384 k7 g384 +norm: BatchNorm1d 384norm BatchNorm1d 384 +pointwise_conv2: Conv1d 384→384 k1pointwise_conv2 Conv1d 384→384 k1 +conv_layer_norm: LayerNorm 384conv_layer_norm LayerNorm 384 +final_layer_norm: LayerNorm 384final_layer_norm LayerNorm 384 +ff_layer_norm: LayerNorm 384ff_layer_norm LayerNorm 384 +self_attn_layer_norm: LayerNorm 384self_attn_layer_norm LayerNorm 384 +dropout: Dropoutdropout Dropout +conv: Conv1d 384→256 k3conv Conv1d 384→256 k3 +activation: ReLUactivation ReLU +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +dropout: Dropoutdropout Dropout +linear: Linear [256→1]linear [256→1] +conv: Conv1d 384→256 k5conv Conv1d 384→256 k5 +activation: ReLUactivation ReLU +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +dropout: Dropoutdropout Dropout +linear: Linear [256→1]linear [256→1] +conv: Conv1d 1→384 k1conv Conv1d 1→384 k1 +dropout: Dropoutdropout Dropout +conv: Conv1d 384→256 k3conv Conv1d 384→256 k3 +activation: ReLUactivation ReLU +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +dropout: Dropoutdropout Dropout +linear: Linear [256→1]linear [256→1] +conv: Conv1d 1→384 k1conv Conv1d 1→384 k1 +dropout: Dropoutdropout Dropout +dropout: Dropoutdropout Dropout +linear_q: Linear [384→384]linear_q [384→384] +linear_k: Linear [384→384]linear_k [384→384] +linear_v: Linear [384→384]linear_v [384→384] +linear_out: Linear [384→384]linear_out [384→384] +dropout: Dropoutdropout Dropout +linear_pos: Linear [384→384]linear_pos [384→384] +conv1: Conv1d 384→1536 k3conv1 Conv1d 384→1536 k3 +conv2: Conv1d 1536→384 k3conv2 Conv1d 1536→384 k3 +dropout: Dropoutdropout Dropout +conv1: Conv1d 384→1536 k3conv1 Conv1d 384→1536 k3 +conv2: Conv1d 1536→384 k3conv2 Conv1d 1536→384 k3 +dropout: Dropoutdropout Dropout +ff_macaron_layer_norm: LayerNorm 384ff_macaron_layer_norm LayerNorm 384 +activation: SiLUActivationactivation SiLU +pointwise_conv1: Conv1d 384→768 k1pointwise_conv1 Conv1d 384→768 k1 +depthwise_conv: Conv1d 384→384 k31 g384depthwise_conv Conv1d 384→384 k31 g384 +norm: BatchNorm1d 384norm BatchNorm1d 384 +pointwise_conv2: Conv1d 384→384 k1pointwise_conv2 Conv1d 384→384 k1 +conv_layer_norm: LayerNorm 384conv_layer_norm LayerNorm 384 +final_layer_norm: LayerNorm 384final_layer_norm LayerNorm 384 +ff_layer_norm: LayerNorm 384ff_layer_norm LayerNorm 384 +self_attn_layer_norm: LayerNorm 384self_attn_layer_norm LayerNorm 384 +dropout: Dropoutdropout Dropout +feat_out: Linear [384→80]feat_out [384→80] +layers: 5× FastSpeech2ConformerBatchNormConvLayerlayers 5× FastSpeech2ConformerBatchNormConvLayer +l1_criterion: L1Lossl1_criterion L1Loss +mse_criterion: MSELossmse_criterion MSELoss +duration_criterion: MSELossduration_criterion MSELoss model id espnet/fastspeech2_conformer @@ -173,16 +246,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/flaubert.svg b/flaubert.svg index bbbf83782d84917eabcdd1f0dc4e4a0b5d4bbb26..af33decc376fae7ac528e43d783d58031ea68702 100644 --- a/flaubert.svg +++ b/flaubert.svg @@ -1,4 +1,4 @@ - + - + flaubert -dense · 12× MHA - -FlaubertModel · base model -12 × ModuleListModuleList× 12 -FlaubertWithLMHeadModel · task head -Self-Attention · MultiHeadAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey</w>'hey<…0 -token 1: ',</w>',</w>1 -token 2: 'how</w>'how<…2 -token 3: 'are</w>'are<…3 -token 4: 'you</w>'you<…4 -token 5: '?</w>'?</w>5 -Token Embeddingweight [30145 × 2048] → [1, 6, 2048] -Normpre-attention [1, 6, 2048] -q_lin: Linear [2048→2048]q_lin [2048→2048] -k_lin: Linear [2048→2048]k_lin [2048→2048] -v_lin: Linear [2048→2048]v_lin [2048→2048] -out_lin: Linear [2048→2048]out_lin [2048→2048] -scaled dot-product attention16 heads · head_dim 128 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 2048] -FlaubertWithLMHeadModelPool (CLS / mean)[1, 6, 2048] → [1, 2048] -FlaubertWithLMHeadModelClassifier headLinear [2048→2] -Softmax -class logits[1, 2] (2 classes) +FlaubertModel · staged data flow (structure) +attentions · 12× MultiHeadAttention +ffns · 12× TransformerFFN + + + + + + + +inputsinput_ids / pixel_values / input_values +position_embeddings · Embedding +embeddings · Embedding +layer_norm_emb · LayerNorm +q_lin: Linear [2048→2048]q_lin [2048→2048] +k_lin: Linear [2048→2048]k_lin [2048→2048] +v_lin: Linear [2048→2048]v_lin [2048→2048] +out_lin: Linear [2048→2048]out_lin [2048→2048] +layer_norm1 · 12× LayerNorm +lin1: Linear [2048→8192]lin1 [2048→8192] +lin2: Linear [8192→2048]lin2 [8192→2048] +act: GELUActivationact GELU +layer_norm2 · 12× LayerNorm model id flaubert/flaubert_base_uncased @@ -166,16 +161,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/flava.svg b/flava.svg index 278f5b3e9e083738457142f05c27f28d91a5ddff..f5e5abfbd50844fcf0a0ae88dd9e3b1954bce79e 100644 --- a/flava.svg +++ b/flava.svg @@ -1,4 +1,4 @@ - + - + flava -dense · 12× MHA - -FlavaModel · base model -12 × FlavaLayerFlavaLayer× 12 -FlavaForPreTraining · task head -Self-Attention · FlavaAttention -attention · FlavaSelfAttention -output · FlavaSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -FlavaForPreTrainingLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +FlavaModel · forward data flow (shapes from a dummy input pass) +text_model · TextModel → [1×8×768] +encoder · FlavaEncoder +layer · 12× FlavaLayer +embeddings · FlavaTextEmbeddings +pooler · FlavaPooler +attention · FlavaAttention +intermediate · FlavaIntermediate +output · FlavaOutput + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +attention: FlavaSelfAttentionattention SelfAttention +output: FlavaSelfOutputoutput SelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +layernorm: LayerNorm 768layernorm LayerNorm 768 +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +text_to_mm_projection · Linear → [1×8×768] model id facebook/flava-full @@ -169,16 +167,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/granite_speech.svg b/granite_speech.svg index fddc2660eb871429b4d4b3b839481217a0f3235a..038b5cae2f212002d9b09d25321d6c01cec0b05c 100644 --- a/granite_speech.svg +++ b/granite_speech.svg @@ -1,4 +1,4 @@ - + - + granite_speech -dense · 32× MHA - -GraniteSpeechModel · base model -32 × GraniteDecoderLayerGraniteDecoderLayer× 32 -GraniteSpeechForConditionalGeneration · task head -Self-Attention · GraniteAttention -MLP · GraniteMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [32000 × 4096] → [1, 6, 4096] -GraniteRMSNormpre-attention [1, 6, 4096] -q_proj: Linear [4096→4096]q_proj [4096→4096] -k_proj: Linear [4096→4096]k_proj [4096→4096] -v_proj: Linear [4096→4096]v_proj [4096→4096] -o_proj: Linear [4096→4096]o_proj [4096→4096] -scaled dot-product attention32 heads · head_dim 128 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -GraniteRMSNormpre-FFN [1, 6, 4096] -gate_proj: Linear [4096→11008]gate_proj [4096→11008] -up_proj: Linear [4096→11008]up_proj [4096→11008] -down_proj: Linear [11008→4096]down_proj [11008→4096] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 4096] -GraniteSpeechForConditionalGenerationLM HeadLinear [4096→32000] · tied -Softmax -logits[1, 6, 32000] +GraniteSpeechModel · staged data flow (structure) +encoder · CTCEncoder +layers · 10× GraniteSpeechConformerBlock +language_model · GraniteModel +projector · EncoderProjector +layers · 32× GraniteDecoderLayer +qformer · Blip2QFormerModel +conv · GraniteSpeechConformerConvModule +encoder · Blip2QFormerEncoder +layer · 12× Blip2QFormerLayer +ff1 · GraniteSpeechConformerFeedForward +attn · GraniteSpeechConformerAttention +ff2 · GraniteSpeechConformerFeedForward +self_attn · GraniteAttention +mlp · GraniteMLP +depth_conv · GraniteSpeechConformerDepthWiseConv1d + + + +inputsinput_ids / pixel_values / input_values +input_linear: Linear [160→1024]input_linear [160→1024] +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +silu: SiLUsilu SiLU +dropout: Dropoutdropout Dropout +down_proj: Linear [4096→1024]down_proj [4096→1024] +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +to_q: Linear [1024→1024]to_q [1024→1024] +to_kv: Linear [1024→2048]to_kv [1024→2048] +to_out: Linear [1024→1024]to_out [1024→1024] +rel_pos_emb: Embedding [1025×128]rel_pos_emb Embedding [1025×128] +dropout: Dropoutdropout Dropout +norm: LayerNorm 1024norm LayerNorm 1024 +up_conv: Conv1d 1024→4096 k1up_conv Conv1d 1024→4096 k1 +glu: GLUglu GLU +conv: Conv1d 2048→2048 k15 g2048conv Conv1d 2048→2048 k15 g2048 +silu: SiLUsilu SiLU +batch_norm: BatchNorm1d 2048batch_norm BatchNorm1d 2048 +down_conv: Conv1d 2048→1024 k1down_conv Conv1d 2048→1024 k1 +dropout: Dropoutdropout Dropout +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +silu: SiLUsilu SiLU +dropout: Dropoutdropout Dropout +down_proj: Linear [4096→1024]down_proj [4096→1024] +post_norm: LayerNorm 1024post_norm LayerNorm 1024 +out: Linear [1024→42]out [1024→42] +out_mid: Linear [42→1024]out_mid [42→1024] +layernorm: LayerNorm 768layernorm LayerNorm 768 +dropout: Dropoutdropout Dropout +attention: Blip2QFormerAttentionattention Blip2QFormerAttention +crossattention: Blip2QFormerAttentioncrossattention Blip2QFormerAttention +intermediate_query: Blip2QFormerIntermediateintermediate_query Blip2QFormerIntermediate +output_query: Blip2QFormerOutputoutput_query Blip2QFormerOutput +linear: Linear [768→4096]linear [768→4096] +embed_tokens: Embedding [32000×4096]embed_tokens Embedding [32000×4096] +q_proj: Linear [4096→4096]q_proj [4096→4096] +k_proj: Linear [4096→4096]k_proj [4096→4096] +v_proj: Linear [4096→4096]v_proj [4096→4096] +o_proj: Linear [4096→4096]o_proj [4096→4096] +gate_proj: Linear [4096→11008]gate_proj [4096→11008] +up_proj: Linear [4096→11008]up_proj [4096→11008] +down_proj: Linear [11008→4096]down_proj [11008→4096] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: GraniteRMSNorm 4096input_layernorm GraniteRMSNorm 4096 +post_attention_layernorm: GraniteRMSNorm 4096post_attention_layernorm GraniteRMSNorm 4096 +norm: GraniteRMSNorm 4096norm GraniteRMSNorm 4096 +rotary_emb: GraniteRotaryEmbeddingrotary_emb GraniteRotaryEmbedding model id ibm-granite/granite-speech-3.… @@ -175,16 +206,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/granite_speech_plus.diff.svg b/granite_speech_plus.diff.svg index 0efdb3600f1c7f13d36488de8d3ec363c9c04961..f25c71a8fdefb096c9c76d7fe764437890d65bfb 100644 --- a/granite_speech_plus.diff.svg +++ b/granite_speech_plus.diff.svg @@ -1,4 +1,4 @@ - + - + granite_speech_plus diff vs granite_speech · 1 overridden · 2 added · 0 deleted · 2 new · 3 inherited-as-is - -GraniteSpeechPlusModel · base model -32 × GraniteDecoderLayerGraniteDecoderLayer× 32 -GraniteSpeechPlusForConditionalGeneration · task head -Self-Attention · GraniteAttention -MLP · GraniteMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [32000 × 4096] → [1, 6, 4096] -GraniteRMSNormpre-attention [1, 6, 4096] -q_proj: Linear [4096→4096]q_proj [4096→4096] -k_proj: Linear [4096→4096]k_proj [4096→4096] -v_proj: Linear [4096→4096]v_proj [4096→4096] -o_proj: Linear [4096→4096]o_proj [4096→4096] -scaled dot-product attention32 heads · head_dim 128 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -GraniteRMSNormpre-FFN [1, 6, 4096] -gate_proj: Linear [4096→11008]gate_proj [4096→11008] -up_proj: Linear [4096→11008]up_proj [4096→11008] -down_proj: Linear [11008→4096]down_proj [11008→4096] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 4096] -GraniteSpeechPlusForConditionalGenerationLM HeadLinear [4096→32000] · tied -Softmax -logits[1, 6, 32000] +encoder · CTCEncoder +layers · 10× GraniteSpeechConformerBlock ↩ inherited +language_model · GraniteModel +projector · EncoderProjector +layers · 32× GraniteDecoderLayer +qformer · Blip2QFormerModel +conv · GraniteSpeechConformerConvModule ↩ inherited +encoder · Blip2QFormerEncoder +layer · 12× Blip2QFormerLayer +ff1 · GraniteSpeechConformerFeedForward ↩ inherited +attn · GraniteSpeechConformerAttention ↩ inherited +ff2 · GraniteSpeechConformerFeedForward ↩ inherited +self_attn · GraniteAttention +mlp · GraniteMLP +depth_conv · GraniteSpeechConformerDepthWiseConv1d ↩ inherited + + + +inputsinput_ids / pixel_values / input_values +input_linear: Linear [160→1024]input_linear [160→1024] +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +silu: SiLUsilu SiLU +dropout: Dropoutdropout Dropout +down_proj: Linear [4096→1024]down_proj [4096→1024] +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +to_q: Linear [1024→1024]to_q [1024→1024] +to_kv: Linear [1024→2048]to_kv [1024→2048] +to_out: Linear [1024→1024]to_out [1024→1024] +rel_pos_emb: Embedding [1025×128]rel_pos_emb Embedding [1025×128] +dropout: Dropoutdropout Dropout +norm: LayerNorm 1024norm LayerNorm 1024 +up_conv: Conv1d 1024→4096 k1up_conv Conv1d 1024→4096 k1 +glu: GLUglu GLU +conv: Conv1d 2048→2048 k15 g2048conv Conv1d 2048→2048 k15 g2048 +silu: SiLUsilu SiLU +batch_norm: BatchNorm1d 2048batch_norm BatchNorm1d 2048 +down_conv: Conv1d 2048→1024 k1down_conv Conv1d 2048→1024 k1 +dropout: Dropoutdropout Dropout +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +silu: SiLUsilu SiLU +dropout: Dropoutdropout Dropout +down_proj: Linear [4096→1024]down_proj [4096→1024] +post_norm: LayerNorm 1024post_norm LayerNorm 1024 +out: Linear [1024→42]out [1024→42] +out_mid: Linear [42→1024]out_mid [42→1024] +layernorm: LayerNorm 768layernorm LayerNorm 768 +dropout: Dropoutdropout Dropout +attention: Blip2QFormerAttentionattention Blip2QFormerAttention +crossattention: Blip2QFormerAttentioncrossattention Blip2QFormerAttention +intermediate_query: Blip2QFormerIntermediateintermediate_query Blip2QFormerIntermediate +output_query: Blip2QFormerOutputoutput_query Blip2QFormerOutput +linear: Linear [768→4096]linear [768→4096] +embed_tokens: Embedding [32000×4096]embed_tokens Embedding [32000×4096] +q_proj: Linear [4096→4096]q_proj [4096→4096] +k_proj: Linear [4096→4096]k_proj [4096→4096] +v_proj: Linear [4096→4096]v_proj [4096→4096] +o_proj: Linear [4096→4096]o_proj [4096→4096] +gate_proj: Linear [4096→11008]gate_proj [4096→11008] +up_proj: Linear [4096→11008]up_proj [4096→11008] +down_proj: Linear [11008→4096]down_proj [11008→4096] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: GraniteRMSNorm 4096input_layernorm GraniteRMSNorm 4096 +post_attention_layernorm: GraniteRMSNorm 4096post_attention_layernorm GraniteRMSNorm 4096 +norm: GraniteRMSNorm 4096norm GraniteRMSNorm 4096 +rotary_emb: GraniteRotaryEmbeddingrotary_emb GraniteRotaryEmbedding model id ibm-granite/granite-speech-4.1 diff --git a/granite_speech_plus.svg b/granite_speech_plus.svg index bdeac86d6d94694d1043e673582dd105fdc0c753..7ee2f3feef77b9814f4cefc95f7ee1c9a8021783 100644 --- a/granite_speech_plus.svg +++ b/granite_speech_plus.svg @@ -1,4 +1,4 @@ - + - + granite_speech_plus -dense · 32× MHA - -GraniteSpeechPlusModel · base model -32 × GraniteDecoderLayerGraniteDecoderLayer× 32 -GraniteSpeechPlusForConditionalGeneration · task head -Self-Attention · GraniteAttention -MLP · GraniteMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [32000 × 4096] → [1, 6, 4096] -GraniteRMSNormpre-attention [1, 6, 4096] -q_proj: Linear [4096→4096]q_proj [4096→4096] -k_proj: Linear [4096→4096]k_proj [4096→4096] -v_proj: Linear [4096→4096]v_proj [4096→4096] -o_proj: Linear [4096→4096]o_proj [4096→4096] -scaled dot-product attention32 heads · head_dim 128 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -GraniteRMSNormpre-FFN [1, 6, 4096] -gate_proj: Linear [4096→11008]gate_proj [4096→11008] -up_proj: Linear [4096→11008]up_proj [4096→11008] -down_proj: Linear [11008→4096]down_proj [11008→4096] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 4096] -GraniteSpeechPlusForConditionalGenerationLM HeadLinear [4096→32000] · tied -Softmax -logits[1, 6, 32000] +GraniteSpeechPlusModel · staged data flow (structure) +encoder · CTCEncoder +layers · 10× GraniteSpeechPlusConformerBlock +language_model · GraniteModel +projector · EncoderProjector +layers · 32× GraniteDecoderLayer +qformer · Blip2QFormerModel +conv · GraniteSpeechPlusConformerConvModule +encoder · Blip2QFormerEncoder +layer · 12× Blip2QFormerLayer +ff1 · GraniteSpeechPlusConformerFeedForward +attn · GraniteSpeechPlusConformerAttention +ff2 · GraniteSpeechPlusConformerFeedForward +self_attn · GraniteAttention +mlp · GraniteMLP +depth_conv · GraniteSpeechPlusConformerDepthWiseConv1d + + + +inputsinput_ids / pixel_values / input_values +input_linear: Linear [160→1024]input_linear [160→1024] +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +silu: SiLUsilu SiLU +dropout: Dropoutdropout Dropout +down_proj: Linear [4096→1024]down_proj [4096→1024] +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +to_q: Linear [1024→1024]to_q [1024→1024] +to_kv: Linear [1024→2048]to_kv [1024→2048] +to_out: Linear [1024→1024]to_out [1024→1024] +rel_pos_emb: Embedding [1025×128]rel_pos_emb Embedding [1025×128] +dropout: Dropoutdropout Dropout +norm: LayerNorm 1024norm LayerNorm 1024 +up_conv: Conv1d 1024→4096 k1up_conv Conv1d 1024→4096 k1 +glu: GLUglu GLU +conv: Conv1d 2048→2048 k15 g2048conv Conv1d 2048→2048 k15 g2048 +silu: SiLUsilu SiLU +batch_norm: BatchNorm1d 2048batch_norm BatchNorm1d 2048 +down_conv: Conv1d 2048→1024 k1down_conv Conv1d 2048→1024 k1 +dropout: Dropoutdropout Dropout +pre_norm: LayerNorm 1024pre_norm LayerNorm 1024 +up_proj: Linear [1024→4096]up_proj [1024→4096] +silu: SiLUsilu SiLU +dropout: Dropoutdropout Dropout +down_proj: Linear [4096→1024]down_proj [4096→1024] +post_norm: LayerNorm 1024post_norm LayerNorm 1024 +out: Linear [1024→42]out [1024→42] +out_mid: Linear [42→1024]out_mid [42→1024] +layernorm: LayerNorm 768layernorm LayerNorm 768 +dropout: Dropoutdropout Dropout +attention: Blip2QFormerAttentionattention Blip2QFormerAttention +crossattention: Blip2QFormerAttentioncrossattention Blip2QFormerAttention +intermediate_query: Blip2QFormerIntermediateintermediate_query Blip2QFormerIntermediate +output_query: Blip2QFormerOutputoutput_query Blip2QFormerOutput +linear: Linear [768→4096]linear [768→4096] +embed_tokens: Embedding [32000×4096]embed_tokens Embedding [32000×4096] +q_proj: Linear [4096→4096]q_proj [4096→4096] +k_proj: Linear [4096→4096]k_proj [4096→4096] +v_proj: Linear [4096→4096]v_proj [4096→4096] +o_proj: Linear [4096→4096]o_proj [4096→4096] +gate_proj: Linear [4096→11008]gate_proj [4096→11008] +up_proj: Linear [4096→11008]up_proj [4096→11008] +down_proj: Linear [11008→4096]down_proj [11008→4096] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: GraniteRMSNorm 4096input_layernorm GraniteRMSNorm 4096 +post_attention_layernorm: GraniteRMSNorm 4096post_attention_layernorm GraniteRMSNorm 4096 +norm: GraniteRMSNorm 4096norm GraniteRMSNorm 4096 +rotary_emb: GraniteRotaryEmbeddingrotary_emb GraniteRotaryEmbedding model id ibm-granite/granite-speech-4.… @@ -175,16 +206,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/grounding_dino.diff.svg b/grounding_dino.diff.svg index b70edb023a13035c8317cb0da9a3fabf97fd0aa2..17766724f8c785f4b312f79edb0dc19f59e5e129 100644 --- a/grounding_dino.diff.svg +++ b/grounding_dino.diff.svg @@ -1,4 +1,4 @@ - + - + grounding_dino diff vs None · 0 overridden · 8 added · 0 deleted · 2 new · 0 inherited-as-is - -GroundingDinoModel · base model -12 × BertLayerBertLayer× 12 -Self-Attention · BertAttention -output · BertSelfOutput -self · BertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +encoder · Encoder +layers · 6× GroundingDinoEncoderLayer +decoder · Decoder +text_backbone · BertModel +layers · 6× GroundingDinoDecoderLayer +backbone · ConvModel +encoder · BertEncoder +layer · 12× BertLayer +deformable_layer · GroundingDinoDeformableLayer +conv_encoder · GroundingDinoConvEncoder +text_enhancer_layer · GroundingDinoTextEnhancerLayer +fusion_layer · GroundingDinoFusionLayer +model · SwinBackbone +embeddings · BertEmbeddings +encoder_attn · GroundingDinoMultiscaleDeformableAttention +attn · GroundingDinoBiMultiHeadAttention +self_attn · GroundingDinoMultiscaleDeformableAttention +self_attn · GroundingDinoMultiheadAttention +encoder_attn_text · GroundingDinoMultiheadAttention +swin · SwinModel +output · BertOutput +self_attn · GroundingDinoMultiheadAttention +input_proj_vision · 4× Sequential +encoder_output_bbox_embed · MLPPredictionHead +reference_points_head · GroundingDinoMLPPredictionHead +hidden_states_norms · ModuleDict +attention · BertAttention +intermediate · BertIntermediate + + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +embeddings: SwinEmbeddingsembeddings SwinEmbeddings +encoder: SwinEncoderencoder SwinEncoder +layernorm: LayerNorm 768layernorm LayerNorm 768 +stage2: LayerNorm 192stage2 LayerNorm 192 +stage3: LayerNorm 384stage3 LayerNorm 384 +stage4: LayerNorm 768stage4 LayerNorm 768 +position_embedding: GroundingDinoSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Conv2d 192→256 k1×10 Conv2d 192→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +self: BertSelfAttentionself BertSelfAttention +output: BertSelfOutputoutput BertSelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +text_projection · Linear +query_position_embeddings · Embedding +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +layer_norm_before: LayerNorm 256layer_norm_before LayerNorm 256 +layer_norm_after: LayerNorm 256layer_norm_after LayerNorm 256 +activation: ReLUactivation ReLU +layer_norm_vision: LayerNorm 256layer_norm_vision LayerNorm 256 +layer_norm_text: LayerNorm 256layer_norm_text LayerNorm 256 +vision_proj: Linear [256→1024]vision_proj [256→1024] +text_proj: Linear [256→1024]text_proj [256→1024] +values_vision_proj: Linear [256→1024]values_vision_proj [256→1024] +values_text_proj: Linear [256→1024]values_text_proj [256→1024] +out_vision_proj: Linear [1024→256]out_vision_proj [1024→256] +out_text_proj: Linear [1024→256]out_text_proj [1024→256] +drop_path: GroundingDinoDropPathdrop_path DropPath +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +encoder_attn_text_layer_norm: LayerNorm 256encoder_attn_text_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · Linear +enc_output_norm · LayerNorm +layers: 3× Linearlayers 3× Linear +encoder_output_class_embed · ContrastiveEmbedding model id IDEA-Research/grounding-dino-t diff --git a/grounding_dino.svg b/grounding_dino.svg index 97c062fc46c1b7e07918f8ef3b6618d62cf58d25..1c78dcd3757d050af3f5431e47f4c6c3f65426ba 100644 --- a/grounding_dino.svg +++ b/grounding_dino.svg @@ -1,4 +1,4 @@ - + - + grounding_dino -dense · 12× MHA - -GroundingDinoModel · base model -12 × BertLayerBertLayer× 12 -Self-Attention · BertAttention -output · BertSelfOutput -self · BertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +GroundingDinoModel · staged data flow (structure) +encoder · Encoder +layers · 6× GroundingDinoEncoderLayer +decoder · Decoder +text_backbone · BertModel +layers · 6× GroundingDinoDecoderLayer +backbone · ConvModel +encoder · BertEncoder +layer · 12× BertLayer +deformable_layer · GroundingDinoDeformableLayer +conv_encoder · GroundingDinoConvEncoder +text_enhancer_layer · GroundingDinoTextEnhancerLayer +fusion_layer · GroundingDinoFusionLayer +model · SwinBackbone +embeddings · BertEmbeddings +encoder_attn · GroundingDinoMultiscaleDeformableAttention +attn · GroundingDinoBiMultiHeadAttention +self_attn · GroundingDinoMultiscaleDeformableAttention +self_attn · GroundingDinoMultiheadAttention +encoder_attn_text · GroundingDinoMultiheadAttention +swin · SwinModel +output · BertOutput +self_attn · GroundingDinoMultiheadAttention +input_proj_vision · 4× Sequential +encoder_output_bbox_embed · MLPPredictionHead +reference_points_head · GroundingDinoMLPPredictionHead +hidden_states_norms · ModuleDict +attention · BertAttention +intermediate · BertIntermediate + + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +embeddings: SwinEmbeddingsembeddings SwinEmbeddings +encoder: SwinEncoderencoder SwinEncoder +layernorm: LayerNorm 768layernorm LayerNorm 768 +stage2: LayerNorm 192stage2 LayerNorm 192 +stage3: LayerNorm 384stage3 LayerNorm 384 +stage4: LayerNorm 768stage4 LayerNorm 768 +position_embedding: GroundingDinoSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Conv2d 192→256 k1×10 Conv2d 192→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +self: BertSelfAttentionself BertSelfAttention +output: BertSelfOutputoutput BertSelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +text_projection · Linear +query_position_embeddings · Embedding +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +layer_norm_before: LayerNorm 256layer_norm_before LayerNorm 256 +layer_norm_after: LayerNorm 256layer_norm_after LayerNorm 256 +activation: ReLUactivation ReLU +layer_norm_vision: LayerNorm 256layer_norm_vision LayerNorm 256 +layer_norm_text: LayerNorm 256layer_norm_text LayerNorm 256 +vision_proj: Linear [256→1024]vision_proj [256→1024] +text_proj: Linear [256→1024]text_proj [256→1024] +values_vision_proj: Linear [256→1024]values_vision_proj [256→1024] +values_text_proj: Linear [256→1024]values_text_proj [256→1024] +out_vision_proj: Linear [1024→256]out_vision_proj [1024→256] +out_text_proj: Linear [1024→256]out_text_proj [1024→256] +drop_path: GroundingDinoDropPathdrop_path DropPath +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +encoder_attn_text_layer_norm: LayerNorm 256encoder_attn_text_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · Linear +enc_output_norm · LayerNorm +layers: 3× Linearlayers 3× Linear +encoder_output_class_embed · ContrastiveEmbedding model id IDEA-Research/grounding-dino-… @@ -169,16 +259,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/hubert.diff.svg b/hubert.diff.svg index e48c9bf4566c95ee9c5554565682b0bf1428697d..5044d997bfeb16ea47c7d1dd20f16ab139b13ac3 100644 --- a/hubert.diff.svg +++ b/hubert.diff.svg @@ -1,4 +1,4 @@ - + - + hubert diff vs wav2vec2 · 2 overridden · 16 added · 1 deleted · 3 new · 6 inherited-as-is - -HubertModel · base model -12 × HubertEncoderLayerHubertEncoderLayer× 12 -HubertForSequenceClassification · task head -Self-Attention · Wav2Vec2Attention ↩ inherited -MLP · Wav2Vec2FeedForward ↩ inherited - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -HubertForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -HubertForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +encoder · Encoder +layers · 12× Wav2Vec2EncoderLayer ↩ inherited +pos_conv_embed · HubertPositionalConvEmbedding +feed_forward · Wav2Vec2FeedForward ↩ inherited +feature_extractor · FeatureEncoder +attention · Wav2Vec2Attention ↩ inherited +feature_projection · FeatureProjection +conv_layers · ModuleList [7] + + + +input audioinput_values / input_features +0: HubertGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× HubertNoLayerNormConvLayer[1:7] 6× HubertNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: HubertSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id facebook/hubert-base-ls960 diff --git a/hubert.svg b/hubert.svg index 8e2ba45a0e3317829a922c4ba741a820356ff757..044ba8f0feefc02dec6cccc771b1318318bfa1c7 100644 --- a/hubert.svg +++ b/hubert.svg @@ -1,4 +1,4 @@ - + - + hubert -dense · 12× MHA - -HubertModel · base model -12 × HubertEncoderLayerHubertEncoderLayer× 12 -HubertForSequenceClassification · task head -Self-Attention · HubertAttention -MLP · HubertFeedForward - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -HubertForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -HubertForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +HubertModel · staged data flow (structure) +encoder · Encoder +layers · 12× HubertEncoderLayer +pos_conv_embed · HubertPositionalConvEmbedding +feed_forward · HubertFeedForward +feature_extractor · FeatureEncoder +attention · HubertAttention +feature_projection · FeatureProjection +conv_layers · ModuleList [7] + + + +input audioinput_values / input_features +0: HubertGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× HubertNoLayerNormConvLayer[1:7] 6× HubertNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: HubertSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id facebook/hubert-base-ls960 @@ -169,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/ibert.svg b/ibert.svg index 2ba5fba87d1dac9ab9058db52c8e8961706a53e8..41697a98342ce651142b9bea83a724e589c3c83b 100644 --- a/ibert.svg +++ b/ibert.svg @@ -1,4 +1,4 @@ - + - + ibert -dense · 12× MHA - -IBertModel · base model -12 × IBertLayerIBertLayer× 12 -IBertForMaskedLM · task head -Self-Attention · IBertAttention -self · IBertSelfAttention -output · IBertSelfOutput -softmax · IntSoftmax - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: QuantLinear 768×768query QuantLinear 768×768 -key: QuantLinear 768×768key QuantLinear 768×768 -value: QuantLinear 768×768value QuantLinear 768×768 -query_activation: QuantActquery_activation QuantAct -key_activation: QuantActkey_activation QuantAct -value_activation: QuantActvalue_activation QuantAct -output_activation: QuantActoutput_activation QuantAct -dropout: Dropoutdropout Dropout -act: QuantActact QuantAct -dense: QuantLinear 768×768dense QuantLinear 768×768 -ln_input_act: QuantActln_input_act QuantAct -LayerNorm: IntLayerNorm 768LayerNorm IntLayerNorm 768 -output_activation: QuantActoutput_activation QuantAct -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -IBertForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -IBertForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +IBertModel · staged data flow (structure) +encoder · Encoder +layer · 12× IBertLayer +attention · IBertAttention +embeddings · Embeddings +self · IBertSelfAttention +intermediate · IBertIntermediate +output · IBertOutput +output · IBertSelfOutput +pooler · Pooler +intermediate_act_fn · IntGELU + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: QuantEmbedding 30522×768word_embeddings QuantEmbedding 30522×768 +token_type_embeddings: QuantEmbedding 2×768token_type_embeddings QuantEmbedding 2×768 +position_embeddings: QuantEmbedding 512×768position_embeddings QuantEmbedding 512×768 +embeddings_act1: QuantActembeddings_act1 QuantAct +embeddings_act2: QuantActembeddings_act2 QuantAct +LayerNorm: IntLayerNorm 768LayerNorm IntLayerNorm 768 +output_activation: QuantActoutput_activation QuantAct +dropout: Dropoutdropout Dropout +query: QuantLinear 768×768query QuantLinear 768×768 +key: QuantLinear 768×768key QuantLinear 768×768 +value: QuantLinear 768×768value QuantLinear 768×768 +query_activation: QuantActquery_activation QuantAct +key_activation: QuantActkey_activation QuantAct +value_activation: QuantActvalue_activation QuantAct +output_activation: QuantActoutput_activation QuantAct +dropout: Dropoutdropout Dropout +softmax: IntSoftmaxsoftmax IntSoftmax +dense: QuantLinear 768×768dense QuantLinear 768×768 +ln_input_act: QuantActln_input_act QuantAct +LayerNorm: IntLayerNorm 768LayerNorm IntLayerNorm 768 +output_activation: QuantActoutput_activation QuantAct +dropout: Dropoutdropout Dropout +dense: QuantLinear 3072×768dense QuantLinear 3072×768 +activation_fn: GELUactivation_fn GELU +output_activation: QuantActoutput_activation QuantAct +dense: QuantLinear 768×3072dense QuantLinear 768×3072 +ln_input_act: QuantActln_input_act QuantAct +LayerNorm: IntLayerNorm 768LayerNorm IntLayerNorm 768 +output_activation: QuantActoutput_activation QuantAct +dropout: Dropoutdropout Dropout +pre_intermediate_act: QuantActpre_intermediate_act QuantAct +pre_output_act: QuantActpre_output_act QuantAct +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id kssteven/ibert-roberta-base @@ -179,16 +187,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/jina_embeddings_v3.diff.svg b/jina_embeddings_v3.diff.svg index 514f7eafda27e0420625b467f768fbc6104c3558..af6f8b86da05dfcb5a38a4eac9ffc11537dd2daa 100644 --- a/jina_embeddings_v3.diff.svg +++ b/jina_embeddings_v3.diff.svg @@ -1,4 +1,4 @@ - + - + jina_embeddings_v3 diff vs xlm_roberta (+llama,clip,gpt_neox) · 11 overridden · 13 added · 3 deleted · 1 new · 7 inherited-as-is - -JinaEmbeddingsV3Model · base model -24 × JinaEmbeddingsV3LayerJinaEmbeddingsV3Layer× 24 -JinaEmbeddingsV3ForMaskedLM · task head -Self-Attention · JinaEmbeddingsV3Attention -MLP · XLMRobertaMLP ↩ inherited - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [250002 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -o_proj: Linear [1024→1024]o_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 1024] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [1024→4096]fc1 [1024→4096] -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, 1024] -JinaEmbeddingsV3ForMaskedLMPool (CLS / mean)[1, 6, 1024] → [1, 1024] -JinaEmbeddingsV3ForMaskedLMClassifier headLinear [1024→2] -Softmax -class logits[1, 2] (2 classes) +embeddings · Embeddings → [1×8×1024] +pooler · Pooler → [1×1024] + + + + +input_ids [1, 8] +word_embeddings: Embedding [250002×1024]word_embeddings Embedding [250002×1024] +token_type_embeddings: Embedding [1×1024]token_type_embeddings Embedding [1×1024] +LayerNorm: LayerNorm 1024LayerNorm LayerNorm 1024 +dropout: Dropoutdropout Dropout +rotary_emb · RotaryEmbedding → [1×8×64] +dense: Linear [1024→1024]dense [1024→1024] +activation: Tanhactivation Tanh +output [1×8×1024] model id jinaai/jina-embeddings-v3-hf diff --git a/jina_embeddings_v3.svg b/jina_embeddings_v3.svg index fac079e63818b8fd485d9af6ff7dea828db7f47c..8fd9e0092b9be922f4faca9a2b06781f4bd7541d 100644 --- a/jina_embeddings_v3.svg +++ b/jina_embeddings_v3.svg @@ -1,4 +1,4 @@ - + - + jina_embeddings_v3 -dense · 24× MHA - -JinaEmbeddingsV3Model · base model -24 × JinaEmbeddingsV3LayerJinaEmbeddingsV3Layer× 24 -JinaEmbeddingsV3ForMaskedLM · task head -Self-Attention · JinaEmbeddingsV3Attention -MLP · JinaEmbeddingsV3MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [250002 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -o_proj: Linear [1024→1024]o_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 1024] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [1024→4096]fc1 [1024→4096] -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, 1024] -JinaEmbeddingsV3ForMaskedLMPool (CLS / mean)[1, 6, 1024] → [1, 1024] -JinaEmbeddingsV3ForMaskedLMClassifier headLinear [1024→2] -Softmax -class logits[1, 2] (2 classes) +JinaEmbeddingsV3Model · forward data flow (shapes from a dummy input pass) +embeddings · Embeddings → [1×8×1024] +pooler · Pooler → [1×1024] + + + + +input_ids [1, 8] +word_embeddings: Embedding [250002×1024]word_embeddings Embedding [250002×1024] +token_type_embeddings: Embedding [1×1024]token_type_embeddings Embedding [1×1024] +LayerNorm: LayerNorm 1024LayerNorm LayerNorm 1024 +dropout: Dropoutdropout Dropout +rotary_emb · RotaryEmbedding → [1×8×64] +dense: Linear [1024→1024]dense [1024→1024] +activation: Tanhactivation Tanh +output [1×8×1024] model id jinaai/jina-embeddings-v3-hf @@ -175,16 +154,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/layoutlm.svg b/layoutlm.svg index 58a7a0e22b3c37b1973151bd2b098983b5a39732..739ec40395a6db3320bf0a8500484445083a7576 100644 --- a/layoutlm.svg +++ b/layoutlm.svg @@ -1,4 +1,4 @@ - + - + layoutlm -dense · 12× MHA - -LayoutLMModel · base model -12 × LayoutLMLayerLayoutLMLayer× 12 -LayoutLMForMaskedLM · task head -Self-Attention · LayoutLMAttention -output · LayoutLMSelfOutput -self · LayoutLMSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -LayoutLMForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -LayoutLMForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +LayoutLMModel · staged data flow (structure) +encoder · Encoder +layer · 12× LayoutLMLayer +embeddings · Embeddings +attention · LayoutLMAttention +output · LayoutLMOutput +self · LayoutLMSelfAttention +output · LayoutLMSelfOutput +pooler · Pooler +intermediate · LayoutLMIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +x_position_embeddings: Embedding [1024×768]x_position_embeddings Embedding [1024×768] +y_position_embeddings: Embedding [1024×768]y_position_embeddings Embedding [1024×768] +h_position_embeddings: Embedding [1024×768]h_position_embeddings Embedding [1024×768] +w_position_embeddings: Embedding [1024×768]w_position_embeddings Embedding [1024×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id microsoft/layoutlm-base-uncas… @@ -171,16 +175,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/lightglue.diff.svg b/lightglue.diff.svg index 8b2582e8a6a5e10a7b715b79f3c936af71a1b45d..5537e3a99525bc31034b444468196960489cfe5c 100644 --- a/lightglue.diff.svg +++ b/lightglue.diff.svg @@ -1,4 +1,4 @@ - + - + lightglue diff vs llama (+clip) · 4 overridden · 53 added · 0 deleted · 11 new · 0 inherited-as-is - -LightGlueForKeypointMatching · base model -9 × LightGlueTransformerLayerLightGlueTransformerLayer× 9 -Self-Attention · LightGlueAttention -MLP · LightGlueMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -Normpre-attention [1, 6, 256] -q_proj: Linear [256→256]q_proj [256→256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention4 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Normpre-FFN [1, 6, 256] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [512→512]fc1 [512→512] -fc2: Linear [512→256]fc2 [512→256] -layer_norm: LayerNorm 512layer_norm LayerNorm 512 -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +transformer_layers · 9× LightGlueTransformerLayer +keypoint_detector · SuperPointForKeypointDetection +encoder · SuperPointEncoder +keypoint_decoder · SuperPointInterestPointDecoder +descriptor_decoder · SuperPointDescriptorDecoder +self_attention · LightGlueAttention +self_mlp · LightGlueMLP +cross_attention · LightGlueAttention +cross_mlp · LightGlueMLP +conv_blocks · 4× SuperPointConvBlock +positional_encoder · PositionalEncoder +match_assignment_layers · 9× LightGlueMatchAssignmentLayer +token_confidence · 8× LightGlueTokenConfidenceLayer + + + + + + +inputsinput_ids / pixel_values / input_values +conv_a: Conv2d 1→64 k3×3conv_a Conv2d 1→64 k3×3 +conv_b: Conv2d 64→64 k3×3conv_b Conv2d 64→64 k3×3 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_score_a: Conv2d 128→256 k3×3conv_score_a Conv2d 128→256 k3×3 +conv_score_b: Conv2d 256→65 k1×1conv_score_b Conv2d 256→65 k1×1 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_descriptor_a: Conv2d 128→256 k3×3conv_descriptor_a Conv2d 128→256 k3×3 +conv_descriptor_b: Conv2d 256→256 k1×1conv_descriptor_b Conv2d 256→256 k1×1 +input_projection · Identity +projector: Linear [2→32]projector [2→32] +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [512→512]fc1 [512→512] +fc2: Linear [512→256]fc2 [512→256] +layer_norm: LayerNorm 512layer_norm LayerNorm 512 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [512→512]fc1 [512→512] +fc2: Linear [512→256]fc2 [512→256] +layer_norm: LayerNorm 512layer_norm LayerNorm 512 +final_projection: Linear [256→256]final_projection [256→256] +matchability: Linear [256→1]matchability [256→1] +token: Linear [256→1]token [256→1] model id ETH-CVG/lightglue_superpoint diff --git a/lightglue.svg b/lightglue.svg index 3ad8808acdf8ff7bfde5bda6bb36039521a619b7..dd1d3d435ef85b13adf06f5a42c7cf155b1f4a05 100644 --- a/lightglue.svg +++ b/lightglue.svg @@ -1,4 +1,4 @@ - + - + lightglue -dense · 9× MHA - -LightGlueForKeypointMatching · base model -9 × LightGlueTransformerLayerLightGlueTransformerLayer× 9 -Self-Attention · LightGlueAttention -MLP · LightGlueMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -Normpre-attention [1, 6, 256] -q_proj: Linear [256→256]q_proj [256→256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention4 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Normpre-FFN [1, 6, 256] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [512→512]fc1 [512→512] -fc2: Linear [512→256]fc2 [512→256] -layer_norm: LayerNorm 512layer_norm LayerNorm 512 -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +LightGlueForKeypointMatching · staged data flow (structure) +transformer_layers · 9× LightGlueTransformerLayer +keypoint_detector · SuperPointForKeypointDetection +encoder · SuperPointEncoder +keypoint_decoder · SuperPointInterestPointDecoder +descriptor_decoder · SuperPointDescriptorDecoder +self_attention · LightGlueAttention +self_mlp · LightGlueMLP +cross_attention · LightGlueAttention +cross_mlp · LightGlueMLP +conv_blocks · 4× SuperPointConvBlock +positional_encoder · PositionalEncoder +match_assignment_layers · 9× LightGlueMatchAssignmentLayer +token_confidence · 8× LightGlueTokenConfidenceLayer + + + + + + +inputsinput_ids / pixel_values / input_values +conv_a: Conv2d 1→64 k3×3conv_a Conv2d 1→64 k3×3 +conv_b: Conv2d 64→64 k3×3conv_b Conv2d 64→64 k3×3 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_score_a: Conv2d 128→256 k3×3conv_score_a Conv2d 128→256 k3×3 +conv_score_b: Conv2d 256→65 k1×1conv_score_b Conv2d 256→65 k1×1 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_descriptor_a: Conv2d 128→256 k3×3conv_descriptor_a Conv2d 128→256 k3×3 +conv_descriptor_b: Conv2d 256→256 k1×1conv_descriptor_b Conv2d 256→256 k1×1 +input_projection · Identity +projector: Linear [2→32]projector [2→32] +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [512→512]fc1 [512→512] +fc2: Linear [512→256]fc2 [512→256] +layer_norm: LayerNorm 512layer_norm LayerNorm 512 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [512→512]fc1 [512→512] +fc2: Linear [512→256]fc2 [512→256] +layer_norm: LayerNorm 512layer_norm LayerNorm 512 +final_projection: Linear [256→256]final_projection [256→256] +matchability: Linear [256→1]matchability [256→1] +token: Linear [256→1]token [256→1] model id ETH-CVG/lightglue_superpoint @@ -172,16 +192,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/lilt.svg b/lilt.svg index 0b16e34c3dca543e485a3b3bfc2da6709bf666a6..8ce1c1ccd24e31f0af3f1aecca7a2d9e71d8ac1a 100644 --- a/lilt.svg +++ b/lilt.svg @@ -1,4 +1,4 @@ - + - + lilt -dense · 12× MHA - -LiltModel · base model -12 × LiltLayerLiltLayer× 12 -LiltForSequenceClassification · task head -Self-Attention · LiltAttention -self · LiltSelfAttention -output · LiltSelfOutput -layout_output · LiltSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -layout_query: Linear [192→192]layout_query [192→192] -layout_key: Linear [192→192]layout_key [192→192] -layout_value: Linear [192→192]layout_value [192→192] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -dense: Linear [192→192]dense [192→192] -LayerNorm: LayerNorm 192LayerNorm LayerNorm 192 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LiltForSequenceClassificationLM HeadLinear [768→30522] -Softmax -logits[1, 6, 30522] +LiltModel · staged data flow (structure) +encoder · Encoder +layer · 12× LiltLayer +attention · LiltAttention +layout_embeddings · LayoutEmbeddings +embeddings · TextEmbeddings +self · LiltSelfAttention +output · LiltOutput +layout_output · LiltOutput +output · LiltSelfOutput +layout_output · LiltSelfOutput +pooler · Pooler +intermediate · LiltIntermediate +layout_intermediate · LiltIntermediate + + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +x_position_embeddings: Embedding [1024×128]x_position_embeddings Embedding [1024×128] +y_position_embeddings: Embedding [1024×128]y_position_embeddings Embedding [1024×128] +h_position_embeddings: Embedding [1024×128]h_position_embeddings Embedding [1024×128] +w_position_embeddings: Embedding [1024×128]w_position_embeddings Embedding [1024×128] +box_position_embeddings: Embedding [512×192]box_position_embeddings Embedding [512×192] +box_linear_embeddings: Linear [768→192]box_linear_embeddings [768→192] +LayerNorm: LayerNorm 192LayerNorm LayerNorm 192 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +layout_query: Linear [192→192]layout_query [192→192] +layout_key: Linear [192→192]layout_key [192→192] +layout_value: Linear [192→192]layout_value [192→192] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [192→192]dense [192→192] +LayerNorm: LayerNorm 192LayerNorm LayerNorm 192 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [192→768]dense [192→768] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [768→192]dense [768→192] +LayerNorm: LayerNorm 192LayerNorm LayerNorm 192 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id SCUT-DLVCLab/lilt-roberta-en-… @@ -177,16 +195,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/longformer.svg b/longformer.svg index 06b6150273e11e523e4e3061db53714f81c69938..d410a58f9529188fbb09fdba48c4516d2e1b8eec 100644 --- a/longformer.svg +++ b/longformer.svg @@ -1,4 +1,4 @@ - + - + longformer -dense · 12× MHA - -LongformerModel · base model -12 × LongformerLayerLongformerLayer× 12 -LongformerForMaskedLM · task head -Self-Attention · LongformerAttention -self · LongformerSelfAttention -output · LongformerSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -query_global: Linear [768→768]query_global [768→768] -key_global: Linear [768→768]key_global [768→768] -value_global: Linear [768→768]value_global [768→768] -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -LongformerForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -LongformerForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +LongformerModel · staged data flow (structure) +encoder · Encoder +layer · 12× LongformerLayer +attention · LongformerAttention +embeddings · Embeddings +output · LongformerOutput +self · LongformerSelfAttention +output · LongformerSelfOutput +pooler · Pooler +intermediate · LongformerIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +query_global: Linear [768→768]query_global [768→768] +key_global: Linear [768→768]key_global [768→768] +value_global: Linear [768→768]value_global [768→768] +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id allenai/longformer-base-4096 @@ -173,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/luke.svg b/luke.svg index 4152a0211cad23f0a210e97014c7f802d70c0d9b..8ae5759934b4a972df8be1c306d4cbf84918f637 100644 --- a/luke.svg +++ b/luke.svg @@ -1,4 +1,4 @@ - + - + luke -dense · 12× MHA - -LukeModel · base model -12 × LukeLayerLukeLayer× 12 -LukeForMaskedLM · task head -Self-Attention · LukeAttention -self · LukeSelfAttention -output · LukeSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [50267 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -w2e_query: Linear [768→768]w2e_query [768→768] -e2w_query: Linear [768→768]e2w_query [768→768] -e2e_query: Linear [768→768]e2e_query [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -LukeForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -LukeForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +LukeModel · staged data flow (structure) +encoder · Encoder +layer · 12× LukeLayer +attention · LukeAttention +entity_embeddings · EntityEmbeddings +embeddings · Embeddings +self · LukeSelfAttention +output · LukeOutput +output · LukeSelfOutput +pooler · Pooler +intermediate · LukeIntermediate + + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [50267×768]word_embeddings Embedding [50267×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +entity_embeddings: Embedding [500000×256]entity_embeddings Embedding [500000×256] +entity_embedding_dense: Linear [256→768]entity_embedding_dense [256→768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +w2e_query: Linear [768→768]w2e_query [768→768] +e2w_query: Linear [768→768]e2w_query [768→768] +e2e_query: Linear [768→768]e2e_query [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id studio-ousia/luke-base @@ -174,16 +182,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/lw_detr.diff.svg b/lw_detr.diff.svg index cff4803b43b5be7af5b6b13584991393d7f60bcc..30dc691b3179698122c4d46749d007428027f5ca 100644 --- a/lw_detr.diff.svg +++ b/lw_detr.diff.svg @@ -1,4 +1,4 @@ - + - + lw_detr diff vs deformable_detr (+vitdet,convnext,rt_detr,vit) · 16 overridden · 110 added · 0 deleted · 17 new · 6 inherited-as-is - -LwDetrModel · base model -13 × LwDetrViTLayerLwDetrViTLayer× 13 -Self-Attention · LwDetrViTAttention -MLP · DeformableDetrViTMlp ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -q_proj: Linear [192→192]q_proj [192→192] -k_proj: Linear [192→192]k_proj [192→192] -v_proj: Linear [192→192]v_proj [192→192] -o_proj: Linear [192→192]o_proj [192→192] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [192→768]fc1 [192→768] -act: GELUActivationact GELU -fc2: Linear [768→192]fc2 [768→192] -drop: Dropoutdrop Dropout -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +decoder · Decoder +layers · 3× LwDetrDecoderLayer +backbone · ConvEncoder +backbone · LwDetrViTBackbone +encoder · LwDetrViTEncoder +cross_attn · DeformableDetrMultiscaleDeformableAttention ↩ inherited +self_attn · LwDetrAttention +layer · 10× LwDetrViTLayer +enc_out_bbox_embed · 13× LwDetrMLPPredictionHead +projector · LwDetrMultiScaleProjector +ref_point_head · LwDetrMLPPredictionHead +embeddings · DeformableDetrViTEmbeddings ↩ inherited +mlp · LwDetrMLP + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→192 k16×16projection Conv2d 3→192 k16×16 +attention: LwDetrViTAttentionattention ViTAttention +intermediate: LwDetrViTMlpintermediate ViTMlp +layernorm_before: LayerNorm 192layernorm_before LayerNorm 192 +layernorm_after: LayerNorm 192layernorm_after LayerNorm 192 +scale_layers: ModuleListscale_layers ModuleList +reference_point_embed · Embedding +query_feat · Embedding +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→0]sampling_offsets [256→0] +attention_weights: Linear [256→0]attention_weights [256→0] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +cross_attn_layer_norm: LayerNorm 256cross_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · 13× Linear +enc_output_norm · 13× LayerNorm +layers: 3× Linearlayers 3× Linear +enc_out_class_embed · 13× Linear model id AnnaZhang/lwdetr_small_60e_coc diff --git a/lw_detr.svg b/lw_detr.svg index b220a938c9b6c34bda53bbe97a0ddef2a50c948f..ccf455a87dbe1626afeef663d2f1dd847f035be5 100644 --- a/lw_detr.svg +++ b/lw_detr.svg @@ -1,4 +1,4 @@ - + - + lw_detr -dense · 13× Attention - -LwDetrModel · base model -13 × LwDetrViTLayerLwDetrViTLayer× 13 -Self-Attention · LwDetrViTAttention -MLP · LwDetrViTMlp - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -q_proj: Linear [192→192]q_proj [192→192] -k_proj: Linear [192→192]k_proj [192→192] -v_proj: Linear [192→192]v_proj [192→192] -o_proj: Linear [192→192]o_proj [192→192] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [192→768]fc1 [192→768] -act: GELUActivationact GELU -fc2: Linear [768→192]fc2 [768→192] -drop: Dropoutdrop Dropout -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +LwDetrModel · staged data flow (structure) +decoder · Decoder +layers · 3× LwDetrDecoderLayer +backbone · ConvEncoder +backbone · LwDetrViTBackbone +encoder · LwDetrViTEncoder +cross_attn · LwDetrMultiscaleDeformableAttention +self_attn · LwDetrAttention +layer · 10× LwDetrViTLayer +enc_out_bbox_embed · 13× LwDetrMLPPredictionHead +projector · LwDetrMultiScaleProjector +ref_point_head · LwDetrMLPPredictionHead +embeddings · LwDetrViTEmbeddings +mlp · LwDetrMLP + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→192 k16×16projection Conv2d 3→192 k16×16 +attention: LwDetrViTAttentionattention ViTAttention +intermediate: LwDetrViTMlpintermediate ViTMlp +layernorm_before: LayerNorm 192layernorm_before LayerNorm 192 +layernorm_after: LayerNorm 192layernorm_after LayerNorm 192 +scale_layers: ModuleListscale_layers ModuleList +reference_point_embed · Embedding +query_feat · Embedding +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→0]sampling_offsets [256→0] +attention_weights: Linear [256→0]attention_weights [256→0] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +cross_attn_layer_norm: LayerNorm 256cross_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · 13× Linear +enc_output_norm · 13× LayerNorm +layers: 3× Linearlayers 3× Linear +enc_out_class_embed · 13× Linear model id AnnaZhang/lwdetr_small_60e_co… @@ -172,16 +191,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/lxmert.svg b/lxmert.svg index 7f91ab919cc43b75bb6a75839b57a9dd74abe37c..eff566f45ce0a4d15c6dbdb2b95b4cf7a148fc46 100644 --- a/lxmert.svg +++ b/lxmert.svg @@ -1,4 +1,4 @@ - + - + lxmert -dense · 9× MHA - -LxmertModel · base model -{'vision': 5, 'cross_encoder': 5, 'language': 9} × LxmertLayerLxmertLayer× {'vision': 5, 'cross_encoder': 5, 'language': 9} -LxmertForPreTraining · task head -Self-Attention · LxmertSelfAttentionLayer -output · LxmertAttentionOutput -self · LxmertAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LxmertForPreTrainingLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +LxmertModel · staged data flow (structure) +encoder · Encoder +x_layers · 5× LxmertXLayer +layer · 9× LxmertLayer +r_layers · 5× LxmertLayer +attention · LxmertSelfAttentionLayer +visual_attention · LxmertCrossAttentionLayer +lang_self_att · LxmertSelfAttentionLayer +visn_self_att · LxmertSelfAttentionLayer +attention · LxmertSelfAttentionLayer +embeddings · Embeddings +visn_fc · LxmertVisualFeatureEncoder +output · LxmertOutput +lang_output · LxmertOutput +visn_output · LxmertOutput +output · LxmertOutput +self · LxmertAttention +output · LxmertAttentionOutput +att · LxmertAttention +output · LxmertAttentionOutput +self · LxmertAttention +output · LxmertAttentionOutput +self · LxmertAttention +output · LxmertAttentionOutput +self · LxmertAttention +output · LxmertAttentionOutput +pooler · Pooler +intermediate · LxmertIntermediate +lang_inter · LxmertIntermediate +visn_inter · LxmertIntermediate +intermediate · LxmertIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +visn_fc: Linear [2048→768]visn_fc [2048→768] +visn_layer_norm: LayerNorm 768visn_layer_norm LayerNorm 768 +box_fc: Linear [4→768]box_fc [4→768] +box_layer_norm: LayerNorm 768box_layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id unc-nlp/lxmert-base-uncased @@ -170,16 +240,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/markuplm.svg b/markuplm.svg index 58678495b4bf73be9f76c5cb5d85615c7883ad1b..f8eb6fab6c309b78348b41bff0e854b599bba0b9 100644 --- a/markuplm.svg +++ b/markuplm.svg @@ -1,4 +1,4 @@ - + - + markuplm -dense · 12× MHA - -MarkupLMModel · base model -12 × MarkupLMLayerMarkupLMLayer× 12 -MarkupLMForSequenceClassification · task head -Self-Attention · MarkupLMAttention -output · MarkupLMSelfOutput -self · MarkupLMSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -MarkupLMForSequenceClassificationLM HeadLinear [768→30522] -Softmax -logits[1, 6, 30522] +MarkupLMModel · staged data flow (structure) +encoder · Encoder +layer · 12× MarkupLMLayer +embeddings · Embeddings +xpath_embeddings · XPathEmbeddings +attention · MarkupLMAttention +output · MarkupLMOutput +self · MarkupLMSelfAttention +output · MarkupLMSelfOutput +pooler · Pooler +intermediate · MarkupLMIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +xpath_unitseq2_embeddings: Linear [1600→768]xpath_unitseq2_embeddings [1600→768] +dropout: Dropoutdropout Dropout +activation: ReLUactivation ReLU +xpath_unitseq2_inner: Linear [1600→3072]xpath_unitseq2_inner [1600→3072] +inner2emb: Linear [3072→768]inner2emb [3072→768] +xpath_tag_sub_embeddings: 50× Embeddingxpath_tag_sub_embeddings 50× Embedding +xpath_subs_sub_embeddings: 50× Embeddingxpath_subs_sub_embeddings 50× Embedding +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id microsoft/markuplm-base @@ -170,16 +179,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/megatron_bert.svg b/megatron_bert.svg index 7bd54e884fedcbd0568acaf1e858747f4801a945..1d4a44f6786aca386965c7f06a757985e01ca654 100644 --- a/megatron_bert.svg +++ b/megatron_bert.svg @@ -1,4 +1,4 @@ - + - + megatron_bert -dense · 24× MHA - -MegatronBertModel · base model -24 × MegatronBertLayerMegatronBertLayer× 24 -MegatronBertForCausalLM · task head -Self-Attention · MegatronBertAttention -self · MegatronBertSelfAttention -output · MegatronBertSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [29056 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -ln: LayerNorm 1024ln LayerNorm 1024 -query: Linear [1024→1024]query [1024→1024] -key: Linear [1024→1024]key [1024→1024] -value: Linear [1024→1024]value [1024→1024] -dropout: Dropoutdropout Dropout -dense: Linear [1024→1024]dense [1024→1024] -dropout: Dropoutdropout Dropout -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 1024] -MegatronBertForCausalLMLM HeadLinear [1024→29056] · tied -Softmax -logits[1, 6, 29056] +MegatronBertModel · staged data flow (structure) +encoder · Encoder +layer · 24× MegatronBertLayer +attention · MegatronBertAttention +embeddings · Embeddings +self · MegatronBertSelfAttention +pooler · Pooler +intermediate · MegatronBertIntermediate +output · MegatronBertOutput +output · MegatronBertSelfOutput + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [29056×1024]word_embeddings Embedding [29056×1024] +position_embeddings: Embedding [512×1024]position_embeddings Embedding [512×1024] +token_type_embeddings: Embedding [2×1024]token_type_embeddings Embedding [2×1024] +dropout: Dropoutdropout Dropout +ln: LayerNorm 1024ln LayerNorm 1024 +query: Linear [1024→1024]query [1024→1024] +key: Linear [1024→1024]key [1024→1024] +value: Linear [1024→1024]value [1024→1024] +dropout: Dropoutdropout Dropout +dense: Linear [1024→1024]dense [1024→1024] +dropout: Dropoutdropout Dropout +ln: LayerNorm 1024ln LayerNorm 1024 +dense: Linear [1024→4096]dense [1024→4096] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [4096→1024]dense [4096→1024] +dropout: Dropoutdropout Dropout +ln: LayerNorm 1024ln LayerNorm 1024 +dense: Linear [1024→1024]dense [1024→1024] +activation: Tanhactivation Tanh model id nvidia/megatron-bert-uncased-… @@ -170,16 +171,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/mgp_str.svg b/mgp_str.svg index ac821496f853c0446669ae764769e5adbcb17e32..fa102fdc688f60b71208c294f3bf0678b6e63d81 100644 --- a/mgp_str.svg +++ b/mgp_str.svg @@ -1,4 +1,4 @@ - + - + mgp_str -MgpstrForSceneTextRecognition · full module tree (no attention — shown structurally) -mgp_str · MgpstrModel -encoder · MgpstrEncoder -blocks · 12× MgpstrLayer -char_a3_module · MgpstrA3Module -bpe_a3_module · MgpstrA3Module -wp_a3_module · MgpstrA3Module -attn · MgpstrAttention -mlp · MgpstrMlp -embeddings · MgpstrEmbeddings -inputsinput_ids / pixel_values / input_values -proj: Conv2d 3→768 k4×4proj Conv2d 3→768 k4×4 -pos_drop: Dropoutpos_drop Dropout -norm1: LayerNorm 768norm1 LayerNorm 768 -qkv: Linear [768→2304]qkv [768→2304] -attn_drop: Dropoutattn_drop Dropout -proj: Linear [768→768]proj [768→768] -proj_drop: Dropoutproj_drop Dropout -drop_path: MgpStrDropPathdrop_path MgpStrDropPath -norm2: LayerNorm 768norm2 LayerNorm 768 -fc1: Linear [768→3072]fc1 [768→3072] -act: GELUact GELU -fc2: Linear [3072→768]fc2 [3072→768] -drop: Dropoutdrop Dropout -token_norm: LayerNorm 768token_norm LayerNorm 768 -tokenLearner: 2× Conv2dtokenLearner 2× Conv2d -feat: Conv2d 768→768 k1×1 g8feat Conv2d 768→768 k1×1 g8 -norm: LayerNorm 768norm LayerNorm 768 -token_norm: LayerNorm 768token_norm LayerNorm 768 -tokenLearner: 2× Conv2dtokenLearner 2× Conv2d -feat: Conv2d 768→768 k1×1 g8feat Conv2d 768→768 k1×1 g8 -norm: LayerNorm 768norm LayerNorm 768 -token_norm: LayerNorm 768token_norm LayerNorm 768 -tokenLearner: 2× Conv2dtokenLearner 2× Conv2d -feat: Conv2d 768→768 k1×1 g8feat Conv2d 768→768 k1×1 g8 -norm: LayerNorm 768norm LayerNorm 768 -char_head: Linear [768→38]char_head [768→38] -bpe_head: Linear [768→50257]bpe_head [768→50257] -wp_head: Linear [768→30522]wp_head [768→30522] +MgpstrForSceneTextRecognition · staged data flow (structure) +mgp_str · Model +encoder · MgpstrEncoder +blocks · 12× MgpstrLayer +char_a3_module · A3Module +bpe_a3_module · A3Module +wp_a3_module · A3Module +attn · MgpstrAttention +mlp · MgpstrMlp +embeddings · MgpstrEmbeddings + + + + + + + +inputsinput_ids / pixel_values / input_values +proj: Conv2d 3→768 k4×4proj Conv2d 3→768 k4×4 +pos_drop: Dropoutpos_drop Dropout +norm1: LayerNorm 768norm1 LayerNorm 768 +qkv: Linear [768→2304]qkv [768→2304] +attn_drop: Dropoutattn_drop Dropout +proj: Linear [768→768]proj [768→768] +proj_drop: Dropoutproj_drop Dropout +drop_path: MgpStrDropPathdrop_path MgpStrDropPath +norm2: LayerNorm 768norm2 LayerNorm 768 +fc1: Linear [768→3072]fc1 [768→3072] +act: GELUact GELU +fc2: Linear [3072→768]fc2 [3072→768] +drop: Dropoutdrop Dropout +token_norm: LayerNorm 768token_norm LayerNorm 768 +tokenLearner: 2× Conv2dtokenLearner 2× Conv2d +feat: Conv2d 768→768 k1×1 g8feat Conv2d 768→768 k1×1 g8 +norm: LayerNorm 768norm LayerNorm 768 +token_norm: LayerNorm 768token_norm LayerNorm 768 +tokenLearner: 2× Conv2dtokenLearner 2× Conv2d +feat: Conv2d 768→768 k1×1 g8feat Conv2d 768→768 k1×1 g8 +norm: LayerNorm 768norm LayerNorm 768 +token_norm: LayerNorm 768token_norm LayerNorm 768 +tokenLearner: 2× Conv2dtokenLearner 2× Conv2d +feat: Conv2d 768→768 k1×1 g8feat Conv2d 768→768 k1×1 g8 +norm: LayerNorm 768norm LayerNorm 768 +char_head · Linear +bpe_head · Linear +wp_head · Linear model id alibaba-damo/mgp-str-base diff --git a/mimi.svg b/mimi.svg index 87dcd78c3a1c8bb37c0a46e8aee3140645a51f67..08680100467ffc4c4e407b0abc92d395b328f280 100644 --- a/mimi.svg +++ b/mimi.svg @@ -1,4 +1,4 @@ - + - + mimi -dense · 8× MHA - -MimiModel · base model -8 × MimiTransformerLayerMimiTransformerLayer× 8 -Self-Attention · MimiSdpaAttention -MLP · MimiMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 512] → [1, 6, 512] -LayerNormpre-attention [1, 6, 512] -q_proj: Linear [512→512]q_proj [512→512] -k_proj: Linear [512→512]k_proj [512→512] -v_proj: Linear [512→512]v_proj [512→512] -o_proj: Linear [512→512]o_proj [512→512] -rotary_emb: MimiRotaryEmbeddingrotary_emb RotaryEmbedding -scaled dot-product attention8 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 512] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [512→2048]fc1 [512→2048] -fc2: Linear [2048→512]fc2 [2048→512] -residual add+ -Final LayerNorm[1, 6, 512] -LM HeadLinear [512→?] · tied -Softmax -logits[1, 6, ?] +MimiModel · staged data flow (structure) +encoder · Encoder +decoder · Decoder +layers · ModuleList [15] +layers · ModuleList [15] +[0:12] · 4× (MimiConv1d, MimiResnetBlock, ELU) +[1:13] · 4× (ELU, MimiConvTranspose1d, MimiResnetBlock) +quantizer · SplitResidualVectorQuantizer +encoder_transformer · TransformerModel +decoder_transformer · TransformerModel +layers · 8× MimiTransformerLayer +layers · 8× MimiTransformerLayer +1 · MimiResnetBlock +3 · MimiResnetBlock +semantic_residual_vector_quantizer · MimiResidualVectorQuantizer +block · ModuleList [4] +block · ModuleList [4] +acoustic_residual_vector_quantizer · MimiResidualVectorQuantizer +self_attn · MimiSdpaAttention +self_attn · MimiSdpaAttention +[0:4] · 2× (ELU, MimiConv1d) +[0:4] · 2× (ELU, MimiConv1d) +layers · ModuleList +downsample · Conv1d +upsample · ConvTranspose1d +12 · MimiConv1d +14 · MimiConv1d +mlp · MimiMLP +mlp · MimiMLP +0 · MimiConv1d +14 · MimiConv1d +layers · 31× MimiVectorQuantization +0 · MimiConv1d +2 · MimiConvTranspose1d +0 · MimiVectorQuantization +1 · MimiConv1d +1 · MimiConv1d + + + + + + + +inputsinput_ids / pixel_values / input_values +conv: Conv1d 1→64 k7conv Conv1d 1→64 k7 +0: ELU0 ELU +conv: Conv1d 64→32 k3conv Conv1d 64→32 k3 +shortcut: Identityshortcut Identity +2: ELU2 ELU +conv: Conv1d 512→1024 k16conv Conv1d 512→1024 k16 +13: ELU13 ELU +conv: Conv1d 1024→512 k3conv Conv1d 1024→512 k3 +q_proj: Linear [512→512]q_proj [512→512] +k_proj: Linear [512→512]k_proj [512→512] +v_proj: Linear [512→512]v_proj [512→512] +o_proj: Linear [512→512]o_proj [512→512] +rotary_emb: MimiRotaryEmbeddingrotary_emb RotaryEmbedding +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [512→2048]fc1 [512→2048] +fc2: Linear [2048→512]fc2 [2048→512] +input_layernorm: LayerNorm 512input_layernorm LayerNorm 512 +post_attention_layernorm: LayerNorm 512post_attention_layernorm LayerNorm 512 +self_attn_layer_scale: MimiLayerScaleself_attn_layer_scale LayerScale +mlp_layer_scale: MimiLayerScalemlp_layer_scale LayerScale +conv: Conv1d 512→512 k4conv Conv1d 512→512 k4 +conv: ConvTranspose1dconv ConvTranspose1d +q_proj: Linear [512→512]q_proj [512→512] +k_proj: Linear [512→512]k_proj [512→512] +v_proj: Linear [512→512]v_proj [512→512] +o_proj: Linear [512→512]o_proj [512→512] +rotary_emb: MimiRotaryEmbeddingrotary_emb RotaryEmbedding +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [512→2048]fc1 [512→2048] +fc2: Linear [2048→512]fc2 [2048→512] +input_layernorm: LayerNorm 512input_layernorm LayerNorm 512 +post_attention_layernorm: LayerNorm 512post_attention_layernorm LayerNorm 512 +self_attn_layer_scale: MimiLayerScaleself_attn_layer_scale LayerScale +mlp_layer_scale: MimiLayerScalemlp_layer_scale LayerScale +conv: Conv1d 512→1024 k7conv Conv1d 512→1024 k7 +1: ELU1 ELU +conv: ConvTranspose1dconv ConvTranspose1d +0: ELU0 ELU +conv: Conv1d 512→256 k3conv Conv1d 512→256 k3 +shortcut: Identityshortcut Identity +13: ELU13 ELU +conv: Conv1d 64→1 k3conv Conv1d 64→1 k3 +codebook: MimiEuclideanCodebookcodebook EuclideanCodebook +input_proj: Conv1d 512→256 k1input_proj Conv1d 512→256 k1 +output_proj: Conv1d 256→512 k1output_proj Conv1d 256→512 k1 +codebook: MimiEuclideanCodebookcodebook EuclideanCodebook +input_proj: Conv1d 512→256 k1input_proj Conv1d 512→256 k1 +output_proj: Conv1d 256→512 k1output_proj Conv1d 256→512 k1 model id kyutai/mimi @@ -176,16 +233,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/mm_grounding_dino.diff.svg b/mm_grounding_dino.diff.svg index 1c6128193801593b91a77bb854a0e0809d2eab46..cf731d11065dc85298623ccb7a30e3d16c4048bb 100644 --- a/mm_grounding_dino.diff.svg +++ b/mm_grounding_dino.diff.svg @@ -1,4 +1,4 @@ - + - + mm_grounding_dino diff vs grounding_dino · 6 overridden · 42 added · 0 deleted · 1 new · 5 inherited-as-is - -MMGroundingDinoModel · base model -12 × BertLayerBertLayer× 12 -Self-Attention · BertAttention -output · BertSelfOutput -self · BertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +encoder · Encoder +layers · 6× GroundingDinoEncoderLayer ↩ inherited +decoder · Decoder +text_backbone · BertModel +layers · 6× GroundingDinoDecoderLayer ↩ inherited +backbone · ConvModel +encoder · BertEncoder +layer · 12× BertLayer +deformable_layer · GroundingDinoDeformableLayer ↩ inherited +conv_encoder · GroundingDinoConvEncoder ↩ inherited +text_enhancer_layer · GroundingDinoTextEnhancerLayer ↩ inherited +fusion_layer · GroundingDinoFusionLayer ↩ inherited +model · SwinBackbone +embeddings · BertEmbeddings +encoder_attn · GroundingDinoMultiscaleDeformableAttention ↩ inherited +attn · GroundingDinoBiMultiHeadAttention ↩ inherited +self_attn · GroundingDinoMultiscaleDeformableAttention ↩ inherited +self_attn · GroundingDinoMultiheadAttention ↩ inherited +encoder_attn_text · GroundingDinoMultiheadAttention ↩ inherited +swin · SwinModel +output · BertOutput +self_attn · GroundingDinoMultiheadAttention ↩ inherited +input_proj_vision · 4× Sequential +encoder_output_bbox_embed · MLPPredictionHead +reference_points_head · GroundingDinoMLPPredictionHead ↩ inherited +hidden_states_norms · ModuleDict +attention · BertAttention +intermediate · BertIntermediate + + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +embeddings: SwinEmbeddingsembeddings SwinEmbeddings +encoder: SwinEncoderencoder SwinEncoder +layernorm: LayerNorm 768layernorm LayerNorm 768 +stage2: LayerNorm 192stage2 LayerNorm 192 +stage3: LayerNorm 384stage3 LayerNorm 384 +stage4: LayerNorm 768stage4 LayerNorm 768 +position_embedding: MMGroundingDinoSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Conv2d 192→256 k1×10 Conv2d 192→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +self: BertSelfAttentionself BertSelfAttention +output: BertSelfOutputoutput BertSelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +text_projection · Linear +query_position_embeddings · Embedding +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +layer_norm_before: LayerNorm 256layer_norm_before LayerNorm 256 +layer_norm_after: LayerNorm 256layer_norm_after LayerNorm 256 +activation: ReLUactivation ReLU +layer_norm_vision: LayerNorm 256layer_norm_vision LayerNorm 256 +layer_norm_text: LayerNorm 256layer_norm_text LayerNorm 256 +vision_proj: Linear [256→1024]vision_proj [256→1024] +text_proj: Linear [256→1024]text_proj [256→1024] +values_vision_proj: Linear [256→1024]values_vision_proj [256→1024] +values_text_proj: Linear [256→1024]values_text_proj [256→1024] +out_vision_proj: Linear [1024→256]out_vision_proj [1024→256] +out_text_proj: Linear [1024→256]out_text_proj [1024→256] +drop_path: MMGroundingDinoDropPathdrop_path DropPath +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +encoder_attn_text_layer_norm: LayerNorm 256encoder_attn_text_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · Linear +enc_output_norm · LayerNorm +layers: 3× Linearlayers 3× Linear +encoder_output_class_embed · ContrastiveEmbedding model id openmmlab-community/mm_groundi diff --git a/mm_grounding_dino.svg b/mm_grounding_dino.svg index a7de66a56e79bbb41df2a92ae7d2a3b8d16f7bbb..c8f9d176f82b72005ee967ed4ebf2f662a0ee115 100644 --- a/mm_grounding_dino.svg +++ b/mm_grounding_dino.svg @@ -1,4 +1,4 @@ - + - + mm_grounding_dino -dense · 12× MHA - -MMGroundingDinoModel · base model -12 × BertLayerBertLayer× 12 -Self-Attention · BertAttention -output · BertSelfOutput -self · BertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +MMGroundingDinoModel · staged data flow (structure) +encoder · Encoder +layers · 6× MMGroundingDinoEncoderLayer +decoder · Decoder +text_backbone · BertModel +layers · 6× MMGroundingDinoDecoderLayer +backbone · ConvModel +encoder · BertEncoder +layer · 12× BertLayer +deformable_layer · MMGroundingDinoDeformableLayer +conv_encoder · MMGroundingDinoConvEncoder +text_enhancer_layer · MMGroundingDinoTextEnhancerLayer +fusion_layer · MMGroundingDinoFusionLayer +model · SwinBackbone +embeddings · BertEmbeddings +encoder_attn · MMGroundingDinoMultiscaleDeformableAttention +attn · MMGroundingDinoBiMultiHeadAttention +self_attn · MMGroundingDinoMultiscaleDeformableAttention +self_attn · MMGroundingDinoMultiheadAttention +encoder_attn_text · MMGroundingDinoMultiheadAttention +swin · SwinModel +output · BertOutput +self_attn · MMGroundingDinoMultiheadAttention +input_proj_vision · 4× Sequential +encoder_output_bbox_embed · MLPPredictionHead +reference_points_head · MMGroundingDinoMLPPredictionHead +hidden_states_norms · ModuleDict +attention · BertAttention +intermediate · BertIntermediate + + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +embeddings: SwinEmbeddingsembeddings SwinEmbeddings +encoder: SwinEncoderencoder SwinEncoder +layernorm: LayerNorm 768layernorm LayerNorm 768 +stage2: LayerNorm 192stage2 LayerNorm 192 +stage3: LayerNorm 384stage3 LayerNorm 384 +stage4: LayerNorm 768stage4 LayerNorm 768 +position_embedding: MMGroundingDinoSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Conv2d 192→256 k1×10 Conv2d 192→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +self: BertSelfAttentionself BertSelfAttention +output: BertSelfOutputoutput BertSelfOutput +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +text_projection · Linear +query_position_embeddings · Embedding +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +layer_norm_before: LayerNorm 256layer_norm_before LayerNorm 256 +layer_norm_after: LayerNorm 256layer_norm_after LayerNorm 256 +activation: ReLUactivation ReLU +layer_norm_vision: LayerNorm 256layer_norm_vision LayerNorm 256 +layer_norm_text: LayerNorm 256layer_norm_text LayerNorm 256 +vision_proj: Linear [256→1024]vision_proj [256→1024] +text_proj: Linear [256→1024]text_proj [256→1024] +values_vision_proj: Linear [256→1024]values_vision_proj [256→1024] +values_text_proj: Linear [256→1024]values_text_proj [256→1024] +out_vision_proj: Linear [1024→256]out_vision_proj [1024→256] +out_text_proj: Linear [1024→256]out_text_proj [1024→256] +drop_path: MMGroundingDinoDropPathdrop_path DropPath +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +encoder_attn_text_layer_norm: LayerNorm 256encoder_attn_text_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→256]sampling_offsets [256→256] +attention_weights: Linear [256→128]attention_weights [256→128] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · Linear +enc_output_norm · LayerNorm +layers: 3× Linearlayers 3× Linear +encoder_output_class_embed · ContrastiveEmbedding model id openmmlab-community/mm_ground… @@ -169,16 +259,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/mobilevit.svg b/mobilevit.svg index bf8e9c8992fc06056a1b54fc81f712c5e0885f1f..aec436c547dbf3858b3f8d836bd8b6e4e878dfb5 100644 --- a/mobilevit.svg +++ b/mobilevit.svg @@ -1,4 +1,4 @@ - + - + mobilevit -dense · 5× MHA - -MobileViTModel · base model -5 × MobileViTTransformerLayerMobileViTTransformerLayer× 5 -MobileViTForImageClassification · task head -Self-Attention · MobileViTAttention -attention · MobileViTSelfAttention -output · MobileViTSelfOutput - -input imagepixel_values [1, 3, H, W] -Patch Embeddingconv patches → [1, 6, ?]+ position embeddings -LayerNormpre-attention [1, 6, ?] -query: Linear [144→144]query [144→144] -key: Linear [144→144]key [144→144] -value: Linear [144→144]value [144→144] -dropout: Dropoutdropout Dropout -dense: Linear [144→144]dense [144→144] -dropout: Dropoutdropout Dropout -scaled dot-product attention4 heads · head_dim ? -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, ?] -MobileViTForImageClassificationPool (CLS / mean)[1, 6, ?] → [1, ?] -MobileViTForImageClassificationClassifier headLinear [?→2] -Softmax -class logits[1, 2] (2 classes) +MobileViTModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×160×8×8] +layer · ModuleList [5] +[2:5] · 3× MobileViTLayer +downsampling_layer · MobileViTInvertedResidual +transformer · MobileViTTransformer +[0:2] · 2× MobileViTMobileNetLayer +conv_3x3 · MobileViTConvLayer +layer · 2× MobileViTTransformerLayer +conv_stem · ConvLayer → [1×16×128×128] +conv_1x1_exp · ConvLayer → [1×640×8×8] +layer · ModuleList +conv_kxk · MobileViTConvLayer +conv_projection · MobileViTConvLayer +fusion · MobileViTConvLayer +expand_1x1 · MobileViTConvLayer +conv_1x1 · MobileViTConvLayer +0 · MobileViTInvertedResidual +reduce_1x1 · MobileViTConvLayer + + + + +pixel_values [1, 3, 256, 256] +convolution: Conv2d 3→16 k3×3convolution Conv2d 3→16 k3×3 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: SiLUActivationactivation SiLU +expand_1x1: MobileViTConvLayerexpand_1x1 ConvLayer +conv_3x3: MobileViTConvLayerconv_3x3 ConvLayer +reduce_1x1: MobileViTConvLayerreduce_1x1 ConvLayer +convolution: Conv2d 64→256 k1×1convolution Conv2d 64→256 k1×1 +normalization: BatchNorm2d 256normalization BatchNorm2d 256 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 256→256 k3×3 g256convolution Conv2d 256→256 k3×3 g256 +normalization: BatchNorm2d 256normalization BatchNorm2d 256 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 256→96 k1×1convolution Conv2d 256→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +convolution: Conv2d 96→96 k3×3convolution Conv2d 96→96 k3×3 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 96→144 k1×1convolution Conv2d 96→144 k1×1 +attention: MobileViTAttentionattention Attention +intermediate: MobileViTIntermediateintermediate Intermediate +output: MobileViTOutputoutput Output +layernorm_before: LayerNorm 144layernorm_before LayerNorm 144 +layernorm_after: LayerNorm 144layernorm_after LayerNorm 144 +layernorm: LayerNorm 144layernorm LayerNorm 144 +convolution: Conv2d 144→96 k1×1convolution Conv2d 144→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 192→96 k3×3convolution Conv2d 192→96 k3×3 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 160→640 k1×1convolution Conv2d 160→640 k1×1 +normalization: BatchNorm2d 640normalization BatchNorm2d 640 +activation: SiLUActivationactivation SiLU +output [1×640×8×8] model id google/mobilenet_v2_1.0_224 @@ -164,16 +196,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/mpnet.svg b/mpnet.svg index be3da685b17f754b0a81bafdd77170f29c07c92b..6f266feb29e70d6f75668e7dc6fbf6b731d0daa6 100644 --- a/mpnet.svg +++ b/mpnet.svg @@ -1,4 +1,4 @@ - + - + mpnet -dense · 12× MHA - -MPNetModel · base model -12 × MPNetLayerMPNetLayer× 12 -MPNetForMaskedLM · task head -Self-Attention · MPNetAttention -attn · MPNetSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey'hey0 -token 1: ',',1 -token 2: 'how'how2 -token 3: 'are'are3 -token 4: 'you'you4 -token 5: '?'?5 -Token Embeddingweight [30527 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -q: Linear [768→768]q [768→768] -k: Linear [768→768]k [768→768] -v: Linear [768→768]v [768→768] -o: Linear [768→768]o [768→768] -dropout: Dropoutdropout Dropout -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -MPNetForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -MPNetForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +MPNetModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× MPNetLayer +attention · MPNetAttention +embeddings · Embeddings → [1×8×768] +output · MPNetOutput +attn · MPNetSelfAttention +pooler · Pooler → [1×768] +intermediate · MPNetIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30527×768]word_embeddings Embedding [30527×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +q: Linear [768→768]q [768→768] +k: Linear [768→768]k [768→768] +v: Linear [768→768]v [768→768] +o: Linear [768→768]o [768→768] +dropout: Dropoutdropout Dropout +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +relative_attention_bias: Embedding [32×12]relative_attention_bias Embedding [32×12] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id microsoft/mpnet-base @@ -170,16 +172,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/omdet_turbo.svg b/omdet_turbo.svg index 562312f8d28f73b800561a99721afb30e5db5263..859badb711289c9fa1ff3fd6f935b038b0ada0b0 100644 --- a/omdet_turbo.svg +++ b/omdet_turbo.svg @@ -1,4 +1,4 @@ - + - + omdet_turbo -dense · 12× MHA - -OmDetTurboForObjectDetection · base model -12 × CLIPEncoderLayerCLIPEncoderLayer× 12 -Self-Attention · CLIPAttention -MLP · CLIPMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [49408 × 512] → [1, 6, 512] -LayerNormpre-attention [1, 6, 512] -k_proj: Linear [512→512]k_proj [512→512] -v_proj: Linear [512→512]v_proj [512→512] -q_proj: Linear [512→512]q_proj [512→512] -out_proj: Linear [512→512]out_proj [512→512] -scaled dot-product attention8 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 512] -activation_fn: QuickGELUActivationactivation_fn QuickGELU -fc1: Linear [512→2048]fc1 [512→2048] -fc2: Linear [2048→512]fc2 [2048→512] -residual add+ -Final LayerNorm[1, 6, 512] -LM HeadLinear [512→49408] -Softmax -logits[1, 6, 49408] +OmDetTurboForObjectDetection · staged data flow (structure) +decoder · Decoder +encoder · HybridEncoder +vision_backbone · VisionBackbone +vision_backbone · TimmBackbone +layers · 6× OmDetTurboDeformableTransformerDecoderLayer +_backbone · FeatureListNet +language_backbone · LanguageBackbone +model · CLIPTextModel +task_encoder · OmDetTurboTaskEncoder +fpn_blocks · 2× OmDetTurboCSPRepLayer +pan_blocks · 2× OmDetTurboCSPRepLayer +encoder · ModuleList +encoder · CLIPEncoder +cross_attn · OmDetTurboMultiscaleDeformableAttention +0 · OmDetTurboEncoder +embeddings · CLIPTextEmbeddings +mlp · OmDetTurboMLPWithDropout +self_attn · OmDetTurboMultiheadAttention +layers · 12× CLIPEncoderLayer +channel_projection_layers · 3× Sequential +channel_projection_layers · 3× Sequential +query_position_head · OmDetTurboMLP +encoder_vision_features · Sequential [2] +encoder_bbox_head · OmDetTurboMLP +decoder_bbox_head · 6× OmDetTurboMLP +bottlenecks · 3× OmDetTurboRepVggBlock +bottlenecks · 3× OmDetTurboRepVggBlock +res1 · OmDetTurboResidualLayer +patch_embed · PatchEmbed +layers_0 · SwinTransformerStage +layers_1 · SwinTransformerStage +layers_2 · SwinTransformerStage +layers_3 · SwinTransformerStage +layers · ModuleList + + + + +inputsinput_ids / pixel_values / input_values +proj: Conv2d 3→96 k4×4proj Conv2d 3→96 k4×4 +norm: LayerNorm 96norm LayerNorm 96 +downsample: Identitydownsample Identity +blocks: Sequential [2]blocks Sequential [2] +downsample: PatchMergingdownsample PatchMerging +blocks: Sequential [2]blocks Sequential [2] +downsample: PatchMergingdownsample PatchMerging +blocks: Sequential [6]blocks Sequential [6] +downsample: PatchMergingdownsample PatchMerging +blocks: Sequential [2]blocks Sequential [2] +layer_norms: 3× LayerNormlayer_norms 3× LayerNorm +token_embedding: Embedding [49408×512]token_embedding Embedding [49408×512] +position_embedding: Embedding [77×512]position_embedding Embedding [77×512] +self_attn: CLIPAttentionself_attn CLIPAttention +layer_norm1: LayerNorm 512layer_norm1 LayerNorm 512 +mlp: CLIPMLPmlp CLIPMLP +layer_norm2: LayerNorm 512layer_norm2 LayerNorm 512 +final_layer_norm: LayerNorm 512final_layer_norm LayerNorm 512 +0: Conv2d 192→256 k1×10 Conv2d 192→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +0: OmDetTurboEncoderLayer0 EncoderLayer +lateral_convs: 2× OmDetTurboConvNormLayerlateral_convs 2× OmDetTurboConvNormLayer +conv1: OmDetTurboConvNormLayerconv1 ConvNormLayer +conv2: OmDetTurboConvNormLayerconv2 ConvNormLayer +conv1: OmDetTurboConvNormLayerconv1 ConvNormLayer +conv2: OmDetTurboConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× OmDetTurboConvNormLayerdownsample_convs 2× OmDetTurboConvNormLayer +conv1: OmDetTurboConvNormLayerconv1 ConvNormLayer +conv2: OmDetTurboConvNormLayerconv2 ConvNormLayer +conv1: OmDetTurboConvNormLayerconv1 ConvNormLayer +conv2: OmDetTurboConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +linear1: Linear [512→1024]linear1 [512→1024] +activation: ReLUactivation ReLU +dropout: Dropoutdropout Dropout +linear2: Linear [1024→512]linear2 [1024→512] +norm1: LayerNorm 512norm1 LayerNorm 512 +dropout: Dropoutdropout Dropout +task_project: Linear [512→256]task_project [512→256] +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +out_proj: Linear [256→256]out_proj [256→256] +dropout: Dropoutdropout Dropout +dropout1: Dropoutdropout1 Dropout +norm1: LayerNorm 256norm1 LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +dropout2: Dropoutdropout2 Dropout +norm2: LayerNorm 256norm2 LayerNorm 256 +linear1: Linear [256→2048]linear1 [256→2048] +act: ReLUact ReLU +dropout3: Dropoutdropout3 Dropout +linear2: Linear [2048→256]linear2 [2048→256] +dropout4: Dropoutdropout4 Dropout +norm3: LayerNorm 256norm3 LayerNorm 256 +layers: 2× Linearlayers 2× Linear +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +encoder_class_head: Linear [512→256]encoder_class_head [512→256] +layers: 3× Linearlayers 3× Linear +decoder_class_head: 6× Lineardecoder_class_head 6× Linear +layers: 3× Linearlayers 3× Linear model id omlab/omdet-turbo-swin-tiny-hf @@ -171,16 +249,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/oneformer.svg b/oneformer.svg index 0c608dc0b4aa2ca10657dfa8dab2f23477d31d20..09c2c4c5411aad051df74389ac6a86c2e819fb43 100644 --- a/oneformer.svg +++ b/oneformer.svg @@ -1,4 +1,4 @@ - + - + oneformer -dense · 9× MHA - -OneFormerModel · base model -10 × OneFormerTransformerDecoderLayerOneFormerTransformerDecoderLayer× 10 -Self-Attention · OneFormerTransformerDecoderSelfA… -MLP · OneFormerTransformerDecoderFFNLayer -multihead_attn · MultiheadAttention - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -Normpre-attention [1, 6, 256] -out_proj: NonDynamicallyQuantizableLinear [256→256]out_projNonDynamicallyQuantizableLinear [256→256] -norm: LayerNorm 256norm LayerNorm 256 -dropout: Dropoutdropout Dropout -activation: ReLUactivation ReLU -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -Normpre-FFN [1, 6, 256] -linear1: Linear [256→2048]linear1 [256→2048] -dropout: Dropoutdropout Dropout -linear2: Linear [2048→256]linear2 [2048→256] -norm: LayerNorm 256norm LayerNorm 256 -activation: ReLUactivation ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +OneFormerModel · staged data flow (structure) +pixel_level_module · PixelLevelModule +transformer_module · TransformerModule +decoder · OneFormerTransformerDecoder +decoder · OneFormerPixelDecoder +encoder · SwinBackbone +layers · 9× OneFormerTransformerDecoderLayer +swin · SwinModel +encoder · OneFormerPixelDecoderEncoderOnly +layers · 6× OneFormerPixelDecoderEncoderLayer +task_encoder · TaskModel +embeddings · SwinEmbeddings +task_mlp · OneFormerMLPPredictionHead +query_transformer · OneFormerTransformerDecoderQueryTransformer +mask_embed · OneFormerMLPPredictionHead +hidden_states_norms · ModuleDict +cross_attn · OneFormerTransformerDecoderCrossAttentionLayer +self_attn · OneFormerTransformerDecoderSelfAttentionLayer +ffn · OneFormerTransformerDecoderFFNLayer +input_projections · 3× Sequential +adapter_1 · Sequential [2] +layer_1 · Sequential [3] +layers · 2× PredictionBlock +encoder · SwinEncoder +decoder · OneFormerTransformerDecoderQueryTransformerDecoder +layers · 3× PredictionBlock + + + +inputsinput_ids / pixel_values / input_values +patch_embeddings: SwinPatchEmbeddingspatch_embeddings SwinPatchEmbeddings +norm: LayerNorm 96norm LayerNorm 96 +dropout: Dropoutdropout Dropout +layers: ModuleList [4]layers ModuleList [4] +layernorm: LayerNorm 768layernorm LayerNorm 768 +stage1: LayerNorm 96stage1 LayerNorm 96 +stage2: LayerNorm 192stage2 LayerNorm 192 +stage3: LayerNorm 384stage3 LayerNorm 384 +stage4: LayerNorm 768stage4 LayerNorm 768 +position_embedding: OneFormerSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: Conv2d 768→256 k1×10 Conv2d 768→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +self_attn: OneFormerPixelDecoderEncoderMultiscaleDeformableAttentionself_attn PixelDecoderEncoderMultiscaleDeformableAttention +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +mask_projection: Conv2d 256→256 k1×1mask_projection Conv2d 256→256 k1×1 +0: Conv2d 96→256 k1×10 Conv2d 96→256 k1×1 +1: GroupNorm 2561 GroupNorm 256 +0: Conv2d 256→256 k3×30 Conv2d 256→256 k3×3 +1: GroupNorm 2561 GroupNorm 256 +2: ReLU2 ReLU +position_embedder: OneFormerSinePositionEmbeddingposition_embedder SinePositionEmbedding +queries_embedder: Embedding [150×256]queries_embedder Embedding [150×256] +layers: ModuleList [2]layers ModuleList [2] +norm: LayerNorm 256norm LayerNorm 256 +decoder_norm: LayerNorm 256decoder_norm LayerNorm 256 +multihead_attn: MultiheadAttentionmultihead_attn MultiheadAttention +norm: LayerNorm 256norm LayerNorm 256 +dropout: Dropoutdropout Dropout +activation: ReLUactivation ReLU +self_attn: OneFormerAttentionself_attn Attention +norm: LayerNorm 256norm LayerNorm 256 +dropout: Dropoutdropout Dropout +activation: ReLUactivation ReLU +linear1: Linear [256→2048]linear1 [256→2048] +dropout: Dropoutdropout Dropout +linear2: Linear [2048→256]linear2 [2048→256] +norm: LayerNorm 256norm LayerNorm 256 +activation: ReLUactivation ReLU +query_input_projection: Conv2d 256→256 k1×1query_input_projection Conv2d 256→256 k1×1 +class_embed: Linear [256→3]class_embed [256→3] +0: Linear [256→256]0 [256→256] +1: ReLU1 ReLU +level_embed: Embedding [3×256]level_embed Embedding [3×256] +0: Linear [77→256]0 [77→256] +1: ReLU1 ReLU model id shi-labs/oneformer_ade20k_swi… @@ -174,16 +216,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/pe_video.diff.svg b/pe_video.diff.svg index beaf4df044ed2a3d9e40eeffedb580cc0f7a7b03..32a3fbecd749578dcf52b38d7e0c0e1b3e5c08f3 100644 --- a/pe_video.diff.svg +++ b/pe_video.diff.svg @@ -1,4 +1,4 @@ - + - + pe_video diff vs pe_audio_video · 6 overridden · 13 added · 0 deleted · 3 new · 2 inherited-as-is - -PeVideoModel · base model -22 × ModernBertEncoderLayerModernBertEncoderLayer× 22 -layers (idx) -Self-Attention · ModernBertAttention (2 layer types — same modules, mask differs) -MLP · ModernBertMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [50368 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -Wqkv: Linear [1024→3072]Wqkv [1024→3072] -Wo: Linear [1024→1024]Wo [1024→1024] -out_drop: Identityout_drop Identity -scaled dot-product attention16 heads · head_dim 64 -full_attention attention mask (q↓ × k→)full mask -sliding_attention attention mask (q↓ × k→)sliding mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 1024] -Wi: Linear [1024→5248]Wi [1024→5248] -act: GELUActivationact GELU -drop: Dropoutdrop Dropout -Wo: Linear [2624→1024]Wo [2624→1024] -residual add+ -Final RMSNorm[1, 6, 1024] -LM HeadLinear [1024→50368] -Softmax -logits[1, 6, 50368] -layer 0: full_attention0 -layer 1: sliding_attention1 -layer 2: sliding_attention2 -layer 3: full_attention3 -layer 4: sliding_attention4 -layer 5: sliding_attention5 -layer 6: full_attention6 -layer 7: sliding_attention7 -layer 8: sliding_attention8 -layer 9: full_attention9 -layer 10: sliding_attention10 -layer 11: sliding_attention11 -layer 12: full_attention12 -layer 13: sliding_attention13 -layer 14: sliding_attention14 -layer 15: full_attention15 -layer 16: sliding_attention16 -layer 17: sliding_attention17 -layer 18: full_attention18 -layer 19: sliding_attention19 -layer 20: sliding_attention20 -layer 21: full_attention21 - -model id -facebook/pe-av-large -parent -pe_audio_video -classes -7 -overridden -6 -added -13 -new classes -3 -inherited as-is -2 -legend - -new submodule (vs parent) - -changed / redefined - -deleted - -inherited / copy-pasted -changes by class - -PeVideoEncoder -ovr __init__,forward; 2 attr - -PeVideoEncoderEmbedder -add __init__,forward - -PeVideoModel -add __init__,forward; 1 attr - -PeVideoOutput -add to_tuple; 6 attr - -PeVideoPreTrainedModel -3 attr +video_encoder · Encoder +text_model · ModernBertModel +layers · 6× PeVideoEncoderLayer +embedder · PeVideoEncoderEmbedder +patch_embedder · PeVideoEncoderPatchEmbedder +layers · 22× ModernBertEncoderLayer +resnet_block · PeAudioVideoResnetBlock1d ↩ inherited +vision_model · TimmWrapperForImageClassification +timm_model · Eva +self_attn · PeVideoEncoderAttention +embeddings · ModernBertEmbeddings +mlp · ModernBertMLP +mlp · PeVideoEncoderMLP +block1 · PeAudioVideoConvBlock1d ↩ inherited +block2 · PeAudioVideoConvBlock1d ↩ inherited +text_video_head · ContrastiveHead +video_head · ContrastiveHead +attn · ModernBertAttention + + + + +inputsinput_ids / pixel_values / input_values +tok_embeddings: Embedding [50368×1024]tok_embeddings Embedding [50368×1024] +norm: LayerNorm 1024norm LayerNorm 1024 +drop: Dropoutdrop Dropout +attn_norm: Identityattn_norm Identity +Wqkv: Linear [1024→3072]Wqkv [1024→3072] +Wo: Linear [1024→1024]Wo [1024→1024] +out_drop: Identityout_drop Identity +mlp_norm: LayerNorm 1024mlp_norm LayerNorm 1024 +Wi: Linear [1024→5248]Wi [1024→5248] +act: GELUActivationact GELU +drop: Dropoutdrop Dropout +Wo: Linear [2624→1024]Wo [2624→1024] +final_norm: LayerNorm 1024final_norm LayerNorm 1024 +rotary_emb: ModernBertRotaryEmbeddingrotary_emb ModernBertRotaryEmbedding +patch_embed: PatchEmbedpatch_embed PatchEmbed +pos_drop: Dropoutpos_drop Dropout +rope: RotaryEmbeddingCatrope RotaryEmbeddingCat +norm_pre: LayerNorm 1024norm_pre LayerNorm 1024 +blocks: ModuleList [24]blocks ModuleList [24] +norm: LayerNorm 1024norm LayerNorm 1024 +attn_pool: AttentionPoolLatentattn_pool AttentionPoolLatent +fc_norm: Identityfc_norm Identity +head_drop: Dropouthead_drop Dropout +head: Linear [1024→1024]head [1024→1024] +proj: Linear [1024→1792]proj [1024→1792] +data_proj: Linear [1792→1792]data_proj [1792→1792] +groupnorm: PeVideoMaskedGroupNorm 1792groupnorm MaskedGroupNorm 1792 +activation: SiLUactivation SiLU +project: Conv1d 1792→1792 k3project Conv1d 1792→1792 k3 +groupnorm: PeVideoMaskedGroupNorm 1792groupnorm MaskedGroupNorm 1792 +activation: SiLUactivation SiLU +project: Conv1d 1792→1792 k3project Conv1d 1792→1792 k3 +q_proj: Linear [1792→1792]q_proj [1792→1792] +k_proj: Linear [1792→1792]k_proj [1792→1792] +v_proj: Linear [1792→1792]v_proj [1792→1792] +o_proj: Linear [1792→1792]o_proj [1792→1792] +q_norm: PeVideoEncoderRMSNorm 128q_norm EncoderRMSNorm 128 +k_norm: PeVideoEncoderRMSNorm 128k_norm EncoderRMSNorm 128 +gate_proj: Linear [1792→4800]gate_proj [1792→4800] +up_proj: Linear [1792→4800]up_proj [1792→4800] +down_proj: Linear [4800→1792]down_proj [4800→1792] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: PeVideoEncoderRMSNorm 1792input_layernorm EncoderRMSNorm 1792 +post_attention_layernorm: PeVideoEncoderRMSNorm 1792post_attention_layernorm EncoderRMSNorm 1792 +norm: PeVideoEncoderRMSNorm 1792norm EncoderRMSNorm 1792 +rotary_emb: PeVideoEncoderRotaryEmbeddingrotary_emb EncoderRotaryEmbedding +output: Linear [1792→1792]output [1792→1792] +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +proj: Linear [1024→1024]proj [1024→1024] +layer_norm: LayerNorm 1792layer_norm LayerNorm 1792 +proj: Linear [1792→1024]proj [1792→1024] + +model id +facebook/pe-av-large +parent +pe_audio_video +classes +7 +overridden +6 +added +13 +new classes +3 +inherited as-is +2 +legend + +new submodule (vs parent) + +changed / redefined + +deleted + +inherited / copy-pasted +changes by class + +PeVideoEncoder +ovr __init__,forward; 2 attr + +PeVideoEncoderEmbedder +add __init__,forward + +PeVideoModel +add __init__,forward; 1 attr + +PeVideoOutput +add to_tuple; 6 attr + +PeVideoPreTrainedModel +3 attr \ No newline at end of file diff --git a/pe_video.svg b/pe_video.svg index e01763b73479b8d81d9cc552cc6f775f909f98ea..ff5e0c18a5cad7c479284a035b60e279e7015955 100644 --- a/pe_video.svg +++ b/pe_video.svg @@ -1,4 +1,4 @@ - + - + pe_video -dense · 8× full + 14× sliding - -PeVideoModel · base model -22 × ModernBertEncoderLayerModernBertEncoderLayer× 22 -layers (idx) -Self-Attention · ModernBertAttention (2 layer types — same modules, mask differs) -MLP · ModernBertMLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [50368 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -Wqkv: Linear [1024→3072]Wqkv [1024→3072] -Wo: Linear [1024→1024]Wo [1024→1024] -out_drop: Identityout_drop Identity -scaled dot-product attention16 heads · head_dim 64 -full_attention attention mask (q↓ × k→)full mask -sliding_attention attention mask (q↓ × k→)sliding mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, 1024] -Wi: Linear [1024→5248]Wi [1024→5248] -act: GELUActivationact GELU -drop: Dropoutdrop Dropout -Wo: Linear [2624→1024]Wo [2624→1024] -residual add+ -Final RMSNorm[1, 6, 1024] -LM HeadLinear [1024→50368] -Softmax -logits[1, 6, 50368] -layer 0: full_attention0 -layer 1: sliding_attention1 -layer 2: sliding_attention2 -layer 3: full_attention3 -layer 4: sliding_attention4 -layer 5: sliding_attention5 -layer 6: full_attention6 -layer 7: sliding_attention7 -layer 8: sliding_attention8 -layer 9: full_attention9 -layer 10: sliding_attention10 -layer 11: sliding_attention11 -layer 12: full_attention12 -layer 13: sliding_attention13 -layer 14: sliding_attention14 -layer 15: full_attention15 -layer 16: sliding_attention16 -layer 17: sliding_attention17 -layer 18: full_attention18 -layer 19: sliding_attention19 -layer 20: sliding_attention20 -layer 21: full_attention21 - -model id -facebook/pe-av-large -model_type -pe_video -config -PeVideoConfig -decoder -dense -layers -22 -hidden -1,024 -intermediate -2,624 -heads / kv -16 / 16 -attention -MHA -norm -RMSNorm -positional -RoPE -vocab -50,368 -max_pos -8,192 -sliding_window -64 -tie_embeddings -None -legend - -self-attention - -full - -sliding - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip +PeVideoModel · staged data flow (structure) +video_encoder · Encoder +text_model · ModernBertModel +layers · 6× PeVideoEncoderLayer +embedder · PeVideoEncoderEmbedder +patch_embedder · PeVideoEncoderPatchEmbedder +layers · 22× ModernBertEncoderLayer +resnet_block · PeVideoResnetBlock1d +vision_model · TimmWrapperForImageClassification +timm_model · Eva +self_attn · PeVideoEncoderAttention +embeddings · ModernBertEmbeddings +mlp · ModernBertMLP +mlp · PeVideoEncoderMLP +block1 · PeVideoConvBlock1d +block2 · PeVideoConvBlock1d +text_video_head · ContrastiveHead +video_head · ContrastiveHead +attn · ModernBertAttention + + + + +inputsinput_ids / pixel_values / input_values +tok_embeddings: Embedding [50368×1024]tok_embeddings Embedding [50368×1024] +norm: LayerNorm 1024norm LayerNorm 1024 +drop: Dropoutdrop Dropout +attn_norm: Identityattn_norm Identity +Wqkv: Linear [1024→3072]Wqkv [1024→3072] +Wo: Linear [1024→1024]Wo [1024→1024] +out_drop: Identityout_drop Identity +mlp_norm: LayerNorm 1024mlp_norm LayerNorm 1024 +Wi: Linear [1024→5248]Wi [1024→5248] +act: GELUActivationact GELU +drop: Dropoutdrop Dropout +Wo: Linear [2624→1024]Wo [2624→1024] +final_norm: LayerNorm 1024final_norm LayerNorm 1024 +rotary_emb: ModernBertRotaryEmbeddingrotary_emb ModernBertRotaryEmbedding +patch_embed: PatchEmbedpatch_embed PatchEmbed +pos_drop: Dropoutpos_drop Dropout +rope: RotaryEmbeddingCatrope RotaryEmbeddingCat +norm_pre: LayerNorm 1024norm_pre LayerNorm 1024 +blocks: ModuleList [24]blocks ModuleList [24] +norm: LayerNorm 1024norm LayerNorm 1024 +attn_pool: AttentionPoolLatentattn_pool AttentionPoolLatent +fc_norm: Identityfc_norm Identity +head_drop: Dropouthead_drop Dropout +head: Linear [1024→1024]head [1024→1024] +proj: Linear [1024→1792]proj [1024→1792] +data_proj: Linear [1792→1792]data_proj [1792→1792] +groupnorm: PeVideoMaskedGroupNorm 1792groupnorm MaskedGroupNorm 1792 +activation: SiLUactivation SiLU +project: Conv1d 1792→1792 k3project Conv1d 1792→1792 k3 +groupnorm: PeVideoMaskedGroupNorm 1792groupnorm MaskedGroupNorm 1792 +activation: SiLUactivation SiLU +project: Conv1d 1792→1792 k3project Conv1d 1792→1792 k3 +q_proj: Linear [1792→1792]q_proj [1792→1792] +k_proj: Linear [1792→1792]k_proj [1792→1792] +v_proj: Linear [1792→1792]v_proj [1792→1792] +o_proj: Linear [1792→1792]o_proj [1792→1792] +q_norm: PeVideoEncoderRMSNorm 128q_norm EncoderRMSNorm 128 +k_norm: PeVideoEncoderRMSNorm 128k_norm EncoderRMSNorm 128 +gate_proj: Linear [1792→4800]gate_proj [1792→4800] +up_proj: Linear [1792→4800]up_proj [1792→4800] +down_proj: Linear [4800→1792]down_proj [4800→1792] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: PeVideoEncoderRMSNorm 1792input_layernorm EncoderRMSNorm 1792 +post_attention_layernorm: PeVideoEncoderRMSNorm 1792post_attention_layernorm EncoderRMSNorm 1792 +norm: PeVideoEncoderRMSNorm 1792norm EncoderRMSNorm 1792 +rotary_emb: PeVideoEncoderRotaryEmbeddingrotary_emb EncoderRotaryEmbedding +output: Linear [1792→1792]output [1792→1792] +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +proj: Linear [1024→1024]proj [1024→1024] +layer_norm: LayerNorm 1792layer_norm LayerNorm 1792 +proj: Linear [1792→1024]proj [1792→1024] + +model id +facebook/pe-av-large +model_type +pe_video +config +PeVideoConfig +decoder +dense +layers +22 +hidden +1,024 +intermediate +2,624 +heads / kv +16 / 16 +attention +MHA +norm +RMSNorm +positional +RoPE +vocab +50,368 +max_pos +8,192 +sliding_window +64 +tie_embeddings +None +legend + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/poolformer.svg b/poolformer.svg index 10d76624ba0002e653cd9098a43d3f6eef1c7f9d..16e0ba148bccefceded08e5dcf458d8345e455a4 100644 --- a/poolformer.svg +++ b/poolformer.svg @@ -1,4 +1,4 @@ - + - + poolformer -PoolFormerModel · forward data flow (shapes from a dummy input pass) -encoder · Encoder → [1×512×2×2] -block · 4× ModuleList -0 · PoolFormerLayer -1 · PoolFormerLayer -output · PoolFormerOutput -output · PoolFormerOutput -patch_embeddings · 4× PoolFormerEmbeddings -pooling · PoolFormerPooling -pooling · PoolFormerPooling - - -pixel_values [1, 3, 64, 64] -projection: Conv2d 3→64 k7×7projection Conv2d 3→64 k7×7 -norm: Identitynorm Identity -pool: AvgPool2dpool AvgPool2d -conv1: Conv2d 64→256 k1×1conv1 Conv2d 64→256 k1×1 -conv2: Conv2d 256→64 k1×1conv2 Conv2d 256→64 k1×1 -drop: PoolFormerDropPathdrop DropPath -act_fn: GELUActivationact_fn GELU -before_norm: PoolFormerGroupNorm 64before_norm GroupNorm 64 -after_norm: PoolFormerGroupNorm 64after_norm GroupNorm 64 -drop_path: Identitydrop_path Identity -pool: AvgPool2dpool AvgPool2d -conv1: Conv2d 64→256 k1×1conv1 Conv2d 64→256 k1×1 -conv2: Conv2d 256→64 k1×1conv2 Conv2d 256→64 k1×1 -drop: PoolFormerDropPathdrop DropPath -act_fn: GELUActivationact_fn GELU -before_norm: PoolFormerGroupNorm 64before_norm GroupNorm 64 -after_norm: PoolFormerGroupNorm 64after_norm GroupNorm 64 -drop_path: Identitydrop_path Identity -output [1×512×2×2] +PoolFormerModel · staged data flow (structure) +encoder · Encoder +block · 4× ModuleList +0 · PoolFormerLayer +1 · PoolFormerLayer +output · PoolFormerOutput +output · PoolFormerOutput +patch_embeddings · 4× PoolFormerEmbeddings +pooling · PoolFormerPooling +pooling · PoolFormerPooling + +input imagepixel_values [1, 3, H, W] +projection: Conv2d 3→64 k7×7projection Conv2d 3→64 k7×7 +norm: Identitynorm Identity +pool: AvgPool2dpool AvgPool2d +conv1: Conv2d 64→256 k1×1conv1 Conv2d 64→256 k1×1 +conv2: Conv2d 256→64 k1×1conv2 Conv2d 256→64 k1×1 +drop: PoolFormerDropPathdrop DropPath +act_fn: GELUActivationact_fn GELU +before_norm: PoolFormerGroupNorm 64before_norm GroupNorm 64 +after_norm: PoolFormerGroupNorm 64after_norm GroupNorm 64 +drop_path: Identitydrop_path Identity +pool: AvgPool2dpool AvgPool2d +conv1: Conv2d 64→256 k1×1conv1 Conv2d 64→256 k1×1 +conv2: Conv2d 256→64 k1×1conv2 Conv2d 256→64 k1×1 +drop: PoolFormerDropPathdrop DropPath +act_fn: GELUActivationact_fn GELU +before_norm: PoolFormerGroupNorm 64before_norm GroupNorm 64 +after_norm: PoolFormerGroupNorm 64after_norm GroupNorm 64 +drop_path: Identitydrop_path Identity model id sail/poolformer_s12 diff --git a/pp_doclayout_v3.diff.svg b/pp_doclayout_v3.diff.svg index aba5f5f1787f6dfde88452718f6c88ca37f0b9f0..b57881f481f6d07d0d0d335cca270edd66c87f89 100644 --- a/pp_doclayout_v3.diff.svg +++ b/pp_doclayout_v3.diff.svg @@ -1,4 +1,4 @@ - + - + pp_doclayout_v3 diff vs rt_detr (+resnet) · 9 overridden · 100 added · 0 deleted · 8 new · 3 inherited-as-is - -PPDocLayoutV3Model · base model -6 × PPDocLayoutV3EncoderLayerPPDocLayoutV3EncoderLayer× 6 -layers (idx) -Self-Attention · RTDetrSelfAttention ↩ inherited -MLP · RTDetrMLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: GELUActivationactivation_fn GELU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 +encoder · HybridEncoder +backbone · ConvEncoder +model · HGNetV2Backbone +decoder · Decoder +embedder · HGNetV2Embeddings +layers · 6× PPDocLayoutV3DecoderLayer +mask_feature_head · PPDocLayoutV3MaskFeatFPN +aifi · ModuleList +fpn_blocks · 2× RTDetrCSPRepLayer ↩ inherited +pan_blocks · 2× RTDetrCSPRepLayer ↩ inherited +encoder_mask_output · PPDocLayoutV3EncoderMaskOutput +0 · RTDetrAIFILayer ↩ inherited +encoder_attn · RTDetrMultiscaleDeformableAttention ↩ inherited +encoder · HGNetV2Encoder +scale_heads · 3× PPDocLayoutV3ScaleHead +encoder_mask_lateral · RTDetrConvLayer ↩ inherited +output_conv · RTDetrConvLayer ↩ inherited +base_conv · RTDetrConvLayer ↩ inherited +self_attn · RTDetrSelfAttention ↩ inherited +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +decoder_input_proj · 3× Sequential +decoder_global_pointer · GlobalPointer +mask_query_head · MLPPredictionHead +query_pos_head · RTDetrMLPPredictionHead ↩ inherited +bbox_embed · RTDetrMLPPredictionHead ↩ inherited +bottlenecks · 3× RTDetrRepVggBlock ↩ inherited +bottlenecks · 3× RTDetrRepVggBlock ↩ inherited +mlp · RTDetrMLP ↩ inherited +stages · 4× HGNetV2Stage +layers · ModuleList +layers · ModuleList + + + + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: PPDocLayoutV3FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: PPDocLayoutV3FrozenBatchNorm2d 16normalization FrozenBatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: PPDocLayoutV3FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: PPDocLayoutV3FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: PPDocLayoutV3FrozenBatchNorm2d 48normalization FrozenBatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: PPDocLayoutV3SinePositionEmbeddingposition_embedding SinePositionEmbedding +0: PPDocLayoutV3EncoderLayer0 EncoderLayer +lateral_convs: 2× PPDocLayoutV3ConvNormLayerlateral_convs 2× PPDocLayoutV3ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× PPDocLayoutV3ConvNormLayerdownsample_convs 2× PPDocLayoutV3ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +0: PPDocLayoutV3ConvLayer0 ConvLayer +convolution: Conv2d 64→64 k3×3convolution Conv2d 64→64 k3×3 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 128→64 k3×3convolution Conv2d 128→64 k3×3 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 64→64 k3×3convolution Conv2d 64→64 k3×3 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: SiLUActivationactivation SiLU +conv: Conv2d 64→32 k1×1conv Conv2d 64→32 k1×1 +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +class_embed: Linear [256→2]class_embed [256→2] +layers: 3× Linearlayers 3× Linear +decoder_order_head · 6× Linear +dense: Linear [256→128]dense [256→128] +dropout: Dropoutdropout Dropout +decoder_norm · LayerNorm +layers: 3× Linearlayers 3× Linear model id PaddlePaddle/PP-DocLayoutV3_sa diff --git a/pp_doclayout_v3.svg b/pp_doclayout_v3.svg index bb1016305761ec0de64f2dd1eaf27af215c12463..dce005b4dc10560a116daa339e0c80ad43a7b692 100644 --- a/pp_doclayout_v3.svg +++ b/pp_doclayout_v3.svg @@ -1,4 +1,4 @@ - + - + pp_doclayout_v3 -dense · 2× MHA - -PPDocLayoutV3Model · base model -6 × PPDocLayoutV3EncoderLayerPPDocLayoutV3EncoderLayer× 6 -layers (idx) -Self-Attention · PPDocLayoutV3SelfAttention -MLP · PPDocLayoutV3MLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: GELUActivationactivation_fn GELU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 +PPDocLayoutV3Model · staged data flow (structure) +encoder · HybridEncoder +backbone · ConvEncoder +model · HGNetV2Backbone +decoder · Decoder +embedder · HGNetV2Embeddings +layers · 6× PPDocLayoutV3DecoderLayer +mask_feature_head · PPDocLayoutV3MaskFeatFPN +aifi · ModuleList +fpn_blocks · 2× PPDocLayoutV3CSPRepLayer +pan_blocks · 2× PPDocLayoutV3CSPRepLayer +encoder_mask_output · PPDocLayoutV3EncoderMaskOutput +0 · PPDocLayoutV3AIFILayer +encoder_attn · PPDocLayoutV3MultiscaleDeformableAttention +encoder · HGNetV2Encoder +scale_heads · 3× PPDocLayoutV3ScaleHead +encoder_mask_lateral · PPDocLayoutV3ConvLayer +output_conv · PPDocLayoutV3ConvLayer +base_conv · PPDocLayoutV3ConvLayer +self_attn · PPDocLayoutV3SelfAttention +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +decoder_input_proj · 3× Sequential +decoder_global_pointer · GlobalPointer +mask_query_head · MLPPredictionHead +query_pos_head · PPDocLayoutV3MLPPredictionHead +bbox_embed · PPDocLayoutV3MLPPredictionHead +bottlenecks · 3× PPDocLayoutV3RepVggBlock +bottlenecks · 3× PPDocLayoutV3RepVggBlock +mlp · PPDocLayoutV3MLP +stages · 4× HGNetV2Stage +layers · ModuleList +layers · ModuleList + + + + + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: PPDocLayoutV3FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: PPDocLayoutV3FrozenBatchNorm2d 16normalization FrozenBatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: PPDocLayoutV3FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: PPDocLayoutV3FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: PPDocLayoutV3FrozenBatchNorm2d 48normalization FrozenBatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: PPDocLayoutV3SinePositionEmbeddingposition_embedding SinePositionEmbedding +0: PPDocLayoutV3EncoderLayer0 EncoderLayer +lateral_convs: 2× PPDocLayoutV3ConvNormLayerlateral_convs 2× PPDocLayoutV3ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× PPDocLayoutV3ConvNormLayerdownsample_convs 2× PPDocLayoutV3ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +conv1: PPDocLayoutV3ConvNormLayerconv1 ConvNormLayer +conv2: PPDocLayoutV3ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +0: PPDocLayoutV3ConvLayer0 ConvLayer +convolution: Conv2d 64→64 k3×3convolution Conv2d 64→64 k3×3 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 128→64 k3×3convolution Conv2d 128→64 k3×3 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: SiLUActivationactivation SiLU +convolution: Conv2d 64→64 k3×3convolution Conv2d 64→64 k3×3 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: SiLUActivationactivation SiLU +conv: Conv2d 64→32 k1×1conv Conv2d 64→32 k1×1 +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +class_embed: Linear [256→2]class_embed [256→2] +layers: 3× Linearlayers 3× Linear +decoder_order_head · 6× Linear +dense: Linear [256→128]dense [256→128] +dropout: Dropoutdropout Dropout +decoder_norm · LayerNorm +layers: 3× Linearlayers 3× Linear model id PaddlePaddle/PP-DocLayoutV3_s… @@ -174,20 +273,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -basic - -bottleneck - -linear / proj - -MLP / feed-forward - -RoPE + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution normalization - -residual / skip + +activation + +pooling + +head \ No newline at end of file diff --git a/pp_ocrv5_mobile_rec.diff.svg b/pp_ocrv5_mobile_rec.diff.svg index 09bd6a0cc8578fc6f57cc169b31ae9946ec9ef2e..547d6ff5ea85cc869d12731d57c7a9d8c97f6b6e 100644 --- a/pp_ocrv5_mobile_rec.diff.svg +++ b/pp_ocrv5_mobile_rec.diff.svg @@ -109,16 +109,17 @@ rect.b { rx: 9; stroke-width: 1.6; } pp_ocrv5_mobile_rec diff vs pp_ocrv5_server_rec · 1 overridden · 1 added · 0 deleted · 1 new · 2 inherited-as-is -backbone · PPLCNetV3Backbone -encoder · PPLCNetV3Encoder -blocks · 5× PPLCNetV3Block -convolution · PPLCNetV3ConvLayer -layers · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→16 k3×3convolution Conv2d 3→16 k3×3 -normalization: BatchNorm2d 16normalization BatchNorm2d 16 -activation: Identityactivation Identity -0: PPLCNetV3DepthwiseSeparableConvLayer0 PPLCNetV3DepthwiseSeparableConvLayer +backbone · PPLCNetV3Backbone +encoder · PPLCNetV3Encoder +blocks · 5× PPLCNetV3Block +convolution · PPLCNetV3ConvLayer +layers · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→16 k3×3convolution Conv2d 3→16 k3×3 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: Identityactivation Identity +0: PPLCNetV3DepthwiseSeparableConvLayer0 PPLCNetV3DepthwiseSeparableConvLayer model id PaddlePaddle/PP-OCRv5_mobile_r diff --git a/pp_ocrv5_mobile_rec.svg b/pp_ocrv5_mobile_rec.svg index a756dfb2344b3f8698990055eeff055578327c0c..8851d2bfaaba8aa1875a64c22ac060b211ee4271 100644 --- a/pp_ocrv5_mobile_rec.svg +++ b/pp_ocrv5_mobile_rec.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv5_mobile_rec -PPOCRV5MobileRecModel · full module tree (no attention — shown structurally) -backbone · PPLCNetV3Backbone -encoder · PPLCNetV3Encoder -blocks · 5× PPLCNetV3Block -convolution · PPLCNetV3ConvLayer -layers · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→16 k3×3convolution Conv2d 3→16 k3×3 -normalization: BatchNorm2d 16normalization BatchNorm2d 16 -activation: Identityactivation Identity -0: PPLCNetV3DepthwiseSeparableConvLayer0 PPLCNetV3DepthwiseSeparableConvLayer +PPOCRV5MobileRecModel · staged data flow (structure) +backbone · PPLCNetV3Backbone +encoder · PPLCNetV3Encoder +blocks · 5× PPLCNetV3Block +convolution · PPLCNetV3ConvLayer +layers · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→16 k3×3convolution Conv2d 3→16 k3×3 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: Identityactivation Identity +0: PPLCNetV3DepthwiseSeparableConvLayer0 PPLCNetV3DepthwiseSeparableConvLayer model id PaddlePaddle/PP-OCRv5_mobile_… diff --git a/pp_ocrv5_server_det.diff.svg b/pp_ocrv5_server_det.diff.svg index e01c4b355beae0442935a5140c4de23152e41d09..504c0b7c0a3209966c53208956d9f67a530d385c 100644 --- a/pp_ocrv5_server_det.diff.svg +++ b/pp_ocrv5_server_det.diff.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv5_server_det diff vs None · 0 overridden · 57 added · 0 deleted · 12 new · 0 inherited-as-is -model · PPOCRV5ServerDetModel -backbone · HGNetV2Backbone -embedder · HGNetV2Embeddings -neck · PPOCRV5ServerDetNeck -intraclass_blocks · 4× PPOCRV5ServerDetIntraclassBlock -head · PPOCRV5ServerDetHead -encoder · HGNetV2Encoder -stem1 · HGNetV2ConvLayer -stem2a · HGNetV2ConvLayer -stem2b · HGNetV2ConvLayer -stem3 · HGNetV2ConvLayer -stem4 · HGNetV2ConvLayer -binarize_head · PPOCRV5ServerDetSegmentationHead -local_refinement_module · PPOCRV5ServerDetLocalModule -stages · 4× HGNetV2Stage -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 -normalization: BatchNorm2d 16normalization BatchNorm2d 16 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -downsample: Identitydownsample Identity -blocks: ModuleListblocks ModuleList -input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d -input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d -path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d -path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d -conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 -vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 -vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 -vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 -horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 -horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 -horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 -symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 -symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 -symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 -conv_final: PPOCRV5ServerDetConvBatchnormLayerconv_final ConvBatchnormLayer -conv_down: PPOCRV5ServerDetConvBatchnormLayerconv_down ConvBatchnormLayer -conv_up: PPOCRV5ServerDetConvBatchnormLayerconv_up ConvBatchnormLayer -conv_final: ConvTranspose2dconv_final ConvTranspose2d -upsample_convolution: Upsampleupsample_convolution Upsample -convolution_backbone: PPOCRV5ServerDetConvBatchnormLayerconvolution_backbone ConvBatchnormLayer -convolution_final: Conv2d 64→1 k1×1convolution_final Conv2d 64→1 k1×1 +model · Model +backbone · HGNetV2Backbone +embedder · HGNetV2Embeddings +neck · PPOCRV5ServerDetNeck +intraclass_blocks · 4× PPOCRV5ServerDetIntraclassBlock +head · Head +encoder · HGNetV2Encoder +binarize_head · PPOCRV5ServerDetSegmentationHead +local_refinement_module · PPOCRV5ServerDetLocalModule +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +stages · 4× HGNetV2Stage + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d +input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d +path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d +path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d +conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 +vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 +vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 +vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 +horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 +horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 +horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 +symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 +symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 +symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 +conv_final: PPOCRV5ServerDetConvBatchnormLayerconv_final ConvBatchnormLayer +conv_down: PPOCRV5ServerDetConvBatchnormLayerconv_down ConvBatchnormLayer +conv_up: PPOCRV5ServerDetConvBatchnormLayerconv_up ConvBatchnormLayer +conv_final: ConvTranspose2dconv_final ConvTranspose2d +upsample_convolution: Upsampleupsample_convolution Upsample +convolution_backbone: PPOCRV5ServerDetConvBatchnormLayerconvolution_backbone ConvBatchnormLayer +convolution_final: Conv2d 64→1 k1×1convolution_final Conv2d 64→1 k1×1 model id PaddlePaddle/PP-OCRv5_server_d diff --git a/pp_ocrv5_server_det.svg b/pp_ocrv5_server_det.svg index 668f580422cd4c4921de208f48187e0736866b43..371e8d1fdbbb4f78e52c64bdff658dc9d70cac9b 100644 --- a/pp_ocrv5_server_det.svg +++ b/pp_ocrv5_server_det.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv5_server_det -PPOCRV5ServerDetForObjectDetection · full module tree (no attention — shown structurally) -model · PPOCRV5ServerDetModel -backbone · HGNetV2Backbone -embedder · HGNetV2Embeddings -neck · PPOCRV5ServerDetNeck -intraclass_blocks · 4× PPOCRV5ServerDetIntraclassBlock -head · PPOCRV5ServerDetHead -encoder · HGNetV2Encoder -stem1 · HGNetV2ConvLayer -stem2a · HGNetV2ConvLayer -stem2b · HGNetV2ConvLayer -stem3 · HGNetV2ConvLayer -stem4 · HGNetV2ConvLayer -binarize_head · PPOCRV5ServerDetSegmentationHead -local_refinement_module · PPOCRV5ServerDetLocalModule -stages · 4× HGNetV2Stage -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 -normalization: BatchNorm2d 16normalization BatchNorm2d 16 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -downsample: Identitydownsample Identity -blocks: ModuleListblocks ModuleList -input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d -input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d -path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d -path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d -conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 -vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 -vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 -vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 -horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 -horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 -horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 -symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 -symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 -symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 -conv_final: PPOCRV5ServerDetConvBatchnormLayerconv_final ConvBatchnormLayer -conv_down: PPOCRV5ServerDetConvBatchnormLayerconv_down ConvBatchnormLayer -conv_up: PPOCRV5ServerDetConvBatchnormLayerconv_up ConvBatchnormLayer -conv_final: ConvTranspose2dconv_final ConvTranspose2d -upsample_convolution: Upsampleupsample_convolution Upsample -convolution_backbone: PPOCRV5ServerDetConvBatchnormLayerconvolution_backbone ConvBatchnormLayer -convolution_final: Conv2d 64→1 k1×1convolution_final Conv2d 64→1 k1×1 +PPOCRV5ServerDetForObjectDetection · staged data flow (structure) +model · Model +backbone · HGNetV2Backbone +embedder · HGNetV2Embeddings +neck · PPOCRV5ServerDetNeck +intraclass_blocks · 4× PPOCRV5ServerDetIntraclassBlock +head · Head +encoder · HGNetV2Encoder +binarize_head · PPOCRV5ServerDetSegmentationHead +local_refinement_module · PPOCRV5ServerDetLocalModule +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +stages · 4× HGNetV2Stage + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +downsample: Identitydownsample Identity +blocks: ModuleListblocks ModuleList +input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d +input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d +path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d +path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d +conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 +vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 +vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 +vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 +horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 +horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 +horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 +symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 +symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 +symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 +conv_final: PPOCRV5ServerDetConvBatchnormLayerconv_final ConvBatchnormLayer +conv_down: PPOCRV5ServerDetConvBatchnormLayerconv_down ConvBatchnormLayer +conv_up: PPOCRV5ServerDetConvBatchnormLayerconv_up ConvBatchnormLayer +conv_final: ConvTranspose2dconv_final ConvTranspose2d +upsample_convolution: Upsampleupsample_convolution Upsample +convolution_backbone: PPOCRV5ServerDetConvBatchnormLayerconvolution_backbone ConvBatchnormLayer +convolution_final: Conv2d 64→1 k1×1convolution_final Conv2d 64→1 k1×1 model id PaddlePaddle/PP-OCRv5_server_… diff --git a/pp_ocrv5_server_rec.diff.svg b/pp_ocrv5_server_rec.diff.svg index 126f3c9f8097f08b7c8a7a43567783ea4a1aa5fb..f1cb007c180e5e1089ab3998c0eb7125c5cadf82 100644 --- a/pp_ocrv5_server_rec.diff.svg +++ b/pp_ocrv5_server_rec.diff.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv5_server_rec diff vs clip (+blip_2,focalnet,paddleocr_vl,resnet) · 6 overridden · 44 added · 1 deleted · 8 new · 1 inherited-as-is -backbone · HGNetV2Backbone -embedder · HGNetV2Embeddings -encoder · HGNetV2Encoder -stages · 4× HGNetV2Stage -stem1 · HGNetV2ConvLayer -stem2a · HGNetV2ConvLayer -stem2b · HGNetV2ConvLayer -stem3 · HGNetV2ConvLayer -stem4 · HGNetV2ConvLayer -downsample · HGNetV2ConvLayer -blocks · ModuleList - - -pixel_values [1, 3, 64, 64] -convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 -normalization: BatchNorm2d 16normalization BatchNorm2d 16 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -convolution: Conv2d 48→48 k3×3 g48convolution Conv2d 48→48 k3×3 g48 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: Identityactivation Identity -lab: Identitylab Identity -0: HGNetV2BasicLayer0 HGNetV2BasicLayer -output [1×2048×1×8] +backbone · HGNetV2Backbone +embedder · HGNetV2Embeddings +encoder · HGNetV2Encoder +stages · 4× HGNetV2Stage +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +downsample · HGNetV2ConvLayer +blocks · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +convolution: Conv2d 48→48 k3×3 g48convolution Conv2d 48→48 k3×3 g48 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: Identityactivation Identity +lab: Identitylab Identity +0: HGNetV2BasicLayer0 HGNetV2BasicLayer model id PaddlePaddle/PP-OCRv5_server_r diff --git a/pp_ocrv5_server_rec.svg b/pp_ocrv5_server_rec.svg index de69b524bc8bd2677758391bfad7707160073d2c..59ddea0dc178592b2e045cb9f84b85442912f77d 100644 --- a/pp_ocrv5_server_rec.svg +++ b/pp_ocrv5_server_rec.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv5_server_rec -PPOCRV5ServerRecModel · forward data flow (shapes from a dummy input pass) -backbone · HGNetV2Backbone -embedder · HGNetV2Embeddings -encoder · HGNetV2Encoder -stages · 4× HGNetV2Stage -stem1 · HGNetV2ConvLayer -stem2a · HGNetV2ConvLayer -stem2b · HGNetV2ConvLayer -stem3 · HGNetV2ConvLayer -stem4 · HGNetV2ConvLayer -downsample · HGNetV2ConvLayer -blocks · ModuleList - - -pixel_values [1, 3, 64, 64] -convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 -normalization: BatchNorm2d 16normalization BatchNorm2d 16 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -convolution: Conv2d 48→48 k3×3 g48convolution Conv2d 48→48 k3×3 g48 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: Identityactivation Identity -lab: Identitylab Identity -0: HGNetV2BasicLayer0 HGNetV2BasicLayer -output [1×2048×1×8] +PPOCRV5ServerRecModel · staged data flow (structure) +backbone · HGNetV2Backbone +embedder · HGNetV2Embeddings +encoder · HGNetV2Encoder +stages · 4× HGNetV2Stage +stem1 · HGNetV2ConvLayer +stem2a · HGNetV2ConvLayer +stem2b · HGNetV2ConvLayer +stem3 · HGNetV2ConvLayer +stem4 · HGNetV2ConvLayer +downsample · HGNetV2ConvLayer +blocks · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→16 k2×2convolution Conv2d 32→16 k2×2 +normalization: BatchNorm2d 16normalization BatchNorm2d 16 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 16→32 k2×2convolution Conv2d 16→32 k2×2 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 64→32 k3×3convolution Conv2d 64→32 k3×3 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 32→48 k1×1convolution Conv2d 32→48 k1×1 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +convolution: Conv2d 48→48 k3×3 g48convolution Conv2d 48→48 k3×3 g48 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: Identityactivation Identity +lab: Identitylab Identity +0: HGNetV2BasicLayer0 HGNetV2BasicLayer model id PaddlePaddle/PP-OCRv5_server_… diff --git a/pp_ocrv6_medium_det.diff.svg b/pp_ocrv6_medium_det.diff.svg index 4715b8f37c8c4277d7cfbbfe517cd286a9853d29..712bb9746ea62e3446f8d598bf60feeb0643c7aa 100644 --- a/pp_ocrv6_medium_det.diff.svg +++ b/pp_ocrv6_medium_det.diff.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_medium_det diff vs pp_ocrv5_server_det (+pp_ocrv5_mobile_det) · 1 overridden · 2 added · 0 deleted · 1 new · 3 inherited-as-is -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -neck · PPOCRV6MediumDetNeck -intraclass_blocks · 4× PPOCRV5ServerDetIntraclassBlock ↩ inherited -blocks · 4× PPLCNetV4Block -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d -input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d -path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d -path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d -conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 -vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 -vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 -vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 -horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 -horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 -horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 -symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 -symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 -symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 -conv_final: PPOCRV6MediumDetConvBatchnormLayerconv_final ConvBatchnormLayer +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +neck · Neck +convolution · PPLCNetV4LargeStem +intraclass_blocks · 4× PPOCRV5ServerDetIntraclassBlock ↩ inherited +blocks · 4× PPLCNetV4Block +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer +input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d +input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d +path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d +path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d +conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 +vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 +vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 +vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 +horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 +horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 +horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 +symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 +symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 +symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 +conv_final: PPOCRV6MediumDetConvBatchnormLayerconv_final ConvBatchnormLayer model id PaddlePaddle/PP-OCRv6_medium_d diff --git a/pp_ocrv6_medium_det.svg b/pp_ocrv6_medium_det.svg index 2097b8a065377337f43f745d34c9742c4998d4f7..667568631d3ab6d65772e872876601032e199646 100644 --- a/pp_ocrv6_medium_det.svg +++ b/pp_ocrv6_medium_det.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_medium_det -PPOCRV6MediumDetModel · full module tree (no attention — shown structurally) -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -neck · PPOCRV6MediumDetNeck -intraclass_blocks · 4× PPOCRV6MediumDetIntraclassBlock -blocks · 4× PPLCNetV4Block -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d -input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d -path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d -path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d -conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 -vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 -vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 -vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 -horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 -horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 -horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 -symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 -symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 -symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 -conv_final: PPOCRV6MediumDetConvBatchnormLayerconv_final ConvBatchnormLayer +PPOCRV6MediumDetModel · staged data flow (structure) +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +neck · Neck +convolution · PPLCNetV4LargeStem +intraclass_blocks · 4× PPOCRV6MediumDetIntraclassBlock +blocks · 4× PPLCNetV4Block +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer +input_channel_adjustment_convolution: 4× Conv2dinput_channel_adjustment_convolution 4× Conv2d +input_feature_projection_convolution: 4× Conv2dinput_feature_projection_convolution 4× Conv2d +path_aggregation_head_convolution: 3× Conv2dpath_aggregation_head_convolution 3× Conv2d +path_aggregation_lateral_convolution: 4× Conv2dpath_aggregation_lateral_convolution 4× Conv2d +conv_reduce_channel: Conv2d 64→32 k1×1conv_reduce_channel Conv2d 64→32 k1×1 +vertical_long_to_small_conv_longratio: Conv2d 32→32 k7×1vertical_long_to_small_conv_longratio Conv2d 32→32 k7×1 +vertical_long_to_small_conv_midratio: Conv2d 32→32 k5×1vertical_long_to_small_conv_midratio Conv2d 32→32 k5×1 +vertical_long_to_small_conv_shortratio: Conv2d 32→32 k3×1vertical_long_to_small_conv_shortratio Conv2d 32→32 k3×1 +horizontal_small_to_long_conv_longratio: Conv2d 32→32 k1×7horizontal_small_to_long_conv_longratio Conv2d 32→32 k1×7 +horizontal_small_to_long_conv_midratio: Conv2d 32→32 k1×5horizontal_small_to_long_conv_midratio Conv2d 32→32 k1×5 +horizontal_small_to_long_conv_shortratio: Conv2d 32→32 k1×3horizontal_small_to_long_conv_shortratio Conv2d 32→32 k1×3 +symmetric_conv_long_longratio: Conv2d 32→32 k7×7symmetric_conv_long_longratio Conv2d 32→32 k7×7 +symmetric_conv_long_midratio: Conv2d 32→32 k5×5symmetric_conv_long_midratio Conv2d 32→32 k5×5 +symmetric_conv_long_shortratio: Conv2d 32→32 k3×3symmetric_conv_long_shortratio Conv2d 32→32 k3×3 +conv_final: PPOCRV6MediumDetConvBatchnormLayerconv_final ConvBatchnormLayer model id PaddlePaddle/PP-OCRv6_medium_… diff --git a/pp_ocrv6_small_det.diff.svg b/pp_ocrv6_small_det.diff.svg index 626babf75ae72b6e10f0b225f86078df93a00109..52745c6e8e71131f9f05ab4d8df5ee85827ac73a 100644 --- a/pp_ocrv6_small_det.diff.svg +++ b/pp_ocrv6_small_det.diff.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_small_det diff vs pp_ocrv5_mobile_det (+pp_lcnet,pp_ocrv5_server_det) · 3 overridden · 2 added · 0 deleted · 1 new · 4 inherited-as-is -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -neck · PPOCRV6SmallDetNeck -input_conv · 4× PPOCRV6SmallDetDepthwiseSeparableConvLayer -insert_conv · 4× PPOCRV5MobileDetResidualSqueezeExcitationLayer ↩ inherited -blocks · 4× PPLCNetV4Block -squeeze_excitation_block · PPOCRV5MobileDetSqueezeExcitationModule ↩ inherited -squeeze_excitation_module · PPOCRV5MobileDetSqueezeExcitationModule ↩ inherited -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -in_conv: Conv2d 12→96 k1×1in_conv Conv2d 12→96 k1×1 -avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d -conv1: Conv2d 96→24 k1×1conv1 Conv2d 96→24 k1×1 -conv2: Conv2d 24→96 k1×1conv2 Conv2d 24→96 k1×1 -act_fn: ReLUact_fn ReLU -depthwise_convolution: Conv2d 96→96 k7×7 g96depthwise_convolution Conv2d 96→96 k7×7 g96 -avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d -conv1: Conv2d 24→6 k1×1conv1 Conv2d 24→6 k1×1 -conv2: Conv2d 6→24 k1×1conv2 Conv2d 6→24 k1×1 -act_fn: ReLUact_fn ReLU -pointwise_convolution: Conv2d 96→24 k1×1pointwise_convolution Conv2d 96→24 k1×1 +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +convolution · PPLCNetV4LargeStem +neck · Neck +input_conv · 4× PPOCRV6SmallDetDepthwiseSeparableConvLayer +insert_conv · 4× PPOCRV5MobileDetResidualSqueezeExcitationLayer ↩ inherited +blocks · 4× PPLCNetV4Block +squeeze_excitation_block · PPOCRV5MobileDetSqueezeExcitationModule ↩ inherited +squeeze_excitation_module · PPOCRV5MobileDetSqueezeExcitationModule ↩ inherited +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer +in_conv: Conv2d 12→96 k1×1in_conv Conv2d 12→96 k1×1 +avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d +conv1: Conv2d 96→24 k1×1conv1 Conv2d 96→24 k1×1 +conv2: Conv2d 24→96 k1×1conv2 Conv2d 24→96 k1×1 +act_fn: ReLUact_fn ReLU +depthwise_convolution: Conv2d 96→96 k7×7 g96depthwise_convolution Conv2d 96→96 k7×7 g96 +avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d +conv1: Conv2d 24→6 k1×1conv1 Conv2d 24→6 k1×1 +conv2: Conv2d 6→24 k1×1conv2 Conv2d 6→24 k1×1 +act_fn: ReLUact_fn ReLU +pointwise_convolution: Conv2d 96→24 k1×1pointwise_convolution Conv2d 96→24 k1×1 model id PaddlePaddle/PP-OCRv6_small_de diff --git a/pp_ocrv6_small_det.svg b/pp_ocrv6_small_det.svg index ada3e6642373b3ea09255adac00cb6cefd6545ed..f22a849102171d75854e5be60435fa7f1f1867e1 100644 --- a/pp_ocrv6_small_det.svg +++ b/pp_ocrv6_small_det.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_small_det -PPOCRV6SmallDetModel · full module tree (no attention — shown structurally) -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -neck · PPOCRV6SmallDetNeck -input_conv · 4× PPOCRV6SmallDetDepthwiseSeparableConvLayer -insert_conv · 4× PPOCRV6SmallDetResidualSqueezeExcitationLayer -blocks · 4× PPLCNetV4Block -squeeze_excitation_block · PPOCRV6SmallDetSqueezeExcitationModule -squeeze_excitation_module · PPOCRV6SmallDetSqueezeExcitationModule -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -in_conv: Conv2d 12→96 k1×1in_conv Conv2d 12→96 k1×1 -avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d -conv1: Conv2d 96→24 k1×1conv1 Conv2d 96→24 k1×1 -conv2: Conv2d 24→96 k1×1conv2 Conv2d 24→96 k1×1 -act_fn: ReLUact_fn ReLU -depthwise_convolution: Conv2d 96→96 k7×7 g96depthwise_convolution Conv2d 96→96 k7×7 g96 -avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d -conv1: Conv2d 24→6 k1×1conv1 Conv2d 24→6 k1×1 -conv2: Conv2d 6→24 k1×1conv2 Conv2d 6→24 k1×1 -act_fn: ReLUact_fn ReLU -pointwise_convolution: Conv2d 96→24 k1×1pointwise_convolution Conv2d 96→24 k1×1 +PPOCRV6SmallDetModel · staged data flow (structure) +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +convolution · PPLCNetV4LargeStem +neck · Neck +input_conv · 4× PPOCRV6SmallDetDepthwiseSeparableConvLayer +insert_conv · 4× PPOCRV6SmallDetResidualSqueezeExcitationLayer +blocks · 4× PPLCNetV4Block +squeeze_excitation_block · PPOCRV6SmallDetSqueezeExcitationModule +squeeze_excitation_module · PPOCRV6SmallDetSqueezeExcitationModule +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer +in_conv: Conv2d 12→96 k1×1in_conv Conv2d 12→96 k1×1 +avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d +conv1: Conv2d 96→24 k1×1conv1 Conv2d 96→24 k1×1 +conv2: Conv2d 24→96 k1×1conv2 Conv2d 24→96 k1×1 +act_fn: ReLUact_fn ReLU +depthwise_convolution: Conv2d 96→96 k7×7 g96depthwise_convolution Conv2d 96→96 k7×7 g96 +avg_pool: AdaptiveAvgPool2davg_pool AdaptiveAvgPool2d +conv1: Conv2d 24→6 k1×1conv1 Conv2d 24→6 k1×1 +conv2: Conv2d 6→24 k1×1conv2 Conv2d 6→24 k1×1 +act_fn: ReLUact_fn ReLU +pointwise_convolution: Conv2d 96→24 k1×1pointwise_convolution Conv2d 96→24 k1×1 model id PaddlePaddle/PP-OCRv6_small_d… diff --git a/pp_ocrv6_small_rec.diff.svg b/pp_ocrv6_small_rec.diff.svg index d97f7256ebfe7017bed6403b7b647455e99e7a3c..6cddc4c3f257990733b20b4915c8a65ffe9810f3 100644 --- a/pp_ocrv6_small_rec.diff.svg +++ b/pp_ocrv6_small_rec.diff.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_small_rec diff vs pp_ocrv5_server_rec · 3 overridden · 3 added · 0 deleted · 2 new · 1 inherited-as-is -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -blocks · 4× PPLCNetV4Block -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList - - -pixel_values [1, 3, 64, 64] -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -output [1×384×1×8] +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +convolution · PPLCNetV4LargeStem +blocks · 4× PPLCNetV4Block +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer model id PaddlePaddle/PP-OCRv6_small_re diff --git a/pp_ocrv6_small_rec.svg b/pp_ocrv6_small_rec.svg index d0d320a2145dfad02a753dfb8413ed715bab783d..16e3681febf367384e617a00414dc25e29482633 100644 --- a/pp_ocrv6_small_rec.svg +++ b/pp_ocrv6_small_rec.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_small_rec -PPOCRV6SmallRecModel · forward data flow (shapes from a dummy input pass) -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -blocks · 4× PPLCNetV4Block -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList - - -pixel_values [1, 3, 64, 64] -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -output [1×384×1×8] +PPOCRV6SmallRecModel · staged data flow (structure) +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +convolution · PPLCNetV4LargeStem +blocks · 4× PPLCNetV4Block +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer model id PaddlePaddle/PP-OCRv6_small_r… diff --git a/pp_ocrv6_tiny_rec.diff.svg b/pp_ocrv6_tiny_rec.diff.svg index f9f4bbd46476e3a72118e17987c06a88f2924298..9aa0b539f06241c998a586ff73626bd7176ff8c4 100644 --- a/pp_ocrv6_tiny_rec.diff.svg +++ b/pp_ocrv6_tiny_rec.diff.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_tiny_rec diff vs pp_ocrv6_small_rec · 4 overridden · 12 added · 0 deleted · 2 new · 0 inherited-as-is -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -blocks · 4× PPLCNetV4Block -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList - - -pixel_values [1, 3, 64, 64] -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -output [1×384×1×8] +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +convolution · PPLCNetV4LargeStem +blocks · 4× PPLCNetV4Block +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer model id PaddlePaddle/PP-OCRv6_tiny_rec diff --git a/pp_ocrv6_tiny_rec.svg b/pp_ocrv6_tiny_rec.svg index 87dd268e7d33689f518cd37ebe2feb1cc269d1a7..99afd7ef655545172c0a58d5c9c75e573cd61e62 100644 --- a/pp_ocrv6_tiny_rec.svg +++ b/pp_ocrv6_tiny_rec.svg @@ -1,4 +1,4 @@ - + - + pp_ocrv6_tiny_rec -PPOCRV6TinyRecModel · forward data flow (shapes from a dummy input pass) -backbone · PPLCNetV4Backbone -encoder · PPLCNetV4Encoder -convolution · PPLCNetV4LargeStem -blocks · 4× PPLCNetV4Block -stem1 · PPLCNetV4ConvLayer -stem2a · PPLCNetV4ConvLayer -stem2b · PPLCNetV4ConvLayer -stem3 · PPLCNetV4ConvLayer -stem4 · PPLCNetV4ConvLayer -blocks · ModuleList - - -pixel_values [1, 3, 64, 64] -convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 -normalization: BatchNorm2d 24normalization BatchNorm2d 24 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 -normalization: BatchNorm2d 48normalization BatchNorm2d 48 -activation: ReLUactivation ReLU -lab: Identitylab Identity -convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 -normalization: BatchNorm2d 96normalization BatchNorm2d 96 -activation: ReLUactivation ReLU -lab: Identitylab Identity -pool: MaxPool2dpool MaxPool2d -0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer -output [1×384×1×8] +PPOCRV6TinyRecModel · staged data flow (structure) +backbone · PPLCNetV4Backbone +encoder · PPLCNetV4Encoder +convolution · PPLCNetV4LargeStem +blocks · 4× PPLCNetV4Block +stem1 · PPLCNetV4ConvLayer +stem2a · PPLCNetV4ConvLayer +stem2b · PPLCNetV4ConvLayer +stem3 · PPLCNetV4ConvLayer +stem4 · PPLCNetV4ConvLayer +blocks · ModuleList + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→48 k3×3convolution Conv2d 3→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→24 k2×2convolution Conv2d 48→24 k2×2 +normalization: BatchNorm2d 24normalization BatchNorm2d 24 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 24→48 k2×2convolution Conv2d 24→48 k2×2 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 96→48 k3×3convolution Conv2d 96→48 k3×3 +normalization: BatchNorm2d 48normalization BatchNorm2d 48 +activation: ReLUactivation ReLU +lab: Identitylab Identity +convolution: Conv2d 48→96 k1×1convolution Conv2d 48→96 k1×1 +normalization: BatchNorm2d 96normalization BatchNorm2d 96 +activation: ReLUactivation ReLU +lab: Identitylab Identity +pool: MaxPool2dpool MaxPool2d +0: PPLCNetV4DepthwiseSeparableConvLayer0 PPLCNetV4DepthwiseSeparableConvLayer model id PaddlePaddle/PP-OCRv6_tiny_re… diff --git a/prompt_depth_anything.diff.svg b/prompt_depth_anything.diff.svg index 35c87ae4dd767523e8da74ef1e1e22cd479778d1..7e16a90598022614026d96a88d6f2d6948520aed 100644 --- a/prompt_depth_anything.diff.svg +++ b/prompt_depth_anything.diff.svg @@ -1,4 +1,4 @@ - + - + prompt_depth_anything diff vs depth_anything · 6 overridden · 9 added · 0 deleted · 4 new · 1 inherited-as-is - -PromptDepthAnythingForDepthEstimation · base model -12 × Dinov2LayerDinov2Layer× 12 -Self-Attention · Dinov2Attention -MLP · Dinov2MLP -attention · Dinov2SelfAttention -output · Dinov2SelfOutput - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × ?] → [1, 6, ?] -LayerNormpre-attention [1, 6, ?] -query: Linear [384→384]query [384→384] -key: Linear [384→384]key [384→384] -value: Linear [384→384]value [384→384] -dense: Linear [384→384]dense [384→384] -dropout: Dropoutdropout Dropout -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, ?] -fc1: Linear [384→1536]fc1 [384→1536] -activation: GELUActivationactivation GELU -fc2: Linear [1536→384]fc2 [1536→384] -residual add+ -Final LayerNorm[1, 6, ?] -LM HeadLinear [?→?] -Softmax -logits[1, 6, ?] +neck · Neck → [1×64×4×4] +backbone · Dinov2Backbone +fusion_stage · PromptDepthAnythingFeatureFusionStage +layers · 4× PromptDepthAnythingFeatureFusionLayer +encoder · Dinov2Encoder +layer · 12× Dinov2Layer +embeddings · Dinov2Embeddings +prompt_depth_layer · PromptDepthAnythingLayer +reassemble_stage · DepthAnythingReassembleStage ↩ inherited +head · DepthEstimationHead → [1×56×56] +residual_layer1 · DepthAnythingPreActResidualLayer ↩ inherited +residual_layer2 · DepthAnythingPreActResidualLayer ↩ inherited +patch_embeddings · Dinov2PatchEmbeddings +layers · 4× PromptDepthAnythingReassembleLayer +attention · Dinov2Attention +mlp · Dinov2MLP + + + +pixel_values [1, 3, 64, 64] +projection: Conv2d 3→384 k14×14projection Conv2d 3→384 k14×14 +dropout: Dropoutdropout Dropout +norm1: LayerNorm 384norm1 LayerNorm 384 +attention: Dinov2SelfAttentionattention Dinov2SelfAttention +output: Dinov2SelfOutputoutput Dinov2SelfOutput +layer_scale1: Dinov2LayerScalelayer_scale1 Dinov2LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 384norm2 LayerNorm 384 +fc1: Linear [384→1536]fc1 [384→1536] +activation: GELUActivationactivation GELU +fc2: Linear [1536→384]fc2 [1536→384] +layer_scale2: Dinov2LayerScalelayer_scale2 Dinov2LayerScale +layernorm: LayerNorm 384layernorm LayerNorm 384 +projection: Conv2d 384→48 k1×1projection Conv2d 384→48 k1×1 +resize: ConvTranspose2dresize ConvTranspose2d +convs: 4× Conv2dconvs 4× Conv2d +projection: Conv2d 64→64 k1×1projection Conv2d 64→64 k1×1 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 64→64 k3×3convolution1 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 64→64 k3×3convolution1 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +convolution1: Conv2d 1→64 k3×3convolution1 Conv2d 1→64 k3×3 +activation1: ReLUactivation1 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution3: Conv2d 64→64 k3×3convolution3 Conv2d 64→64 k3×3 +conv1: Conv2d 64→32 k3×3conv1 Conv2d 64→32 k3×3 +conv2: Conv2d 32→32 k3×3conv2 Conv2d 32→32 k3×3 +activation1: ReLUactivation1 ReLU +conv3: Conv2d 32→1 k1×1conv3 Conv2d 32→1 k1×1 +activation2: ReLUactivation2 ReLU model id LiheYoung/depth-anything-small diff --git a/prompt_depth_anything.svg b/prompt_depth_anything.svg index fa3f85fd21e7f676a34f018f727dc7d4b09e411e..a97d98be6ffce2bceb04b2232b46f1f382ab178b 100644 --- a/prompt_depth_anything.svg +++ b/prompt_depth_anything.svg @@ -1,4 +1,4 @@ - + - + prompt_depth_anything -dense · 12× Attention - -PromptDepthAnythingForDepthEstimation · base model -12 × Dinov2LayerDinov2Layer× 12 -Self-Attention · Dinov2Attention -MLP · Dinov2MLP -attention · Dinov2SelfAttention -output · Dinov2SelfOutput - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × ?] → [1, 6, ?] -LayerNormpre-attention [1, 6, ?] -query: Linear [384→384]query [384→384] -key: Linear [384→384]key [384→384] -value: Linear [384→384]value [384→384] -dense: Linear [384→384]dense [384→384] -dropout: Dropoutdropout Dropout -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, ?] -fc1: Linear [384→1536]fc1 [384→1536] -activation: GELUActivationactivation GELU -fc2: Linear [1536→384]fc2 [1536→384] -residual add+ -Final LayerNorm[1, 6, ?] -LM HeadLinear [?→?] -Softmax -logits[1, 6, ?] +PromptDepthAnythingForDepthEstimation · forward data flow (shapes from a dummy input pass) +neck · Neck → [1×64×4×4] +backbone · Dinov2Backbone +fusion_stage · PromptDepthAnythingFeatureFusionStage +layers · 4× PromptDepthAnythingFeatureFusionLayer +encoder · Dinov2Encoder +layer · 12× Dinov2Layer +embeddings · Dinov2Embeddings +prompt_depth_layer · PromptDepthAnythingLayer +reassemble_stage · PromptDepthAnythingReassembleStage +head · DepthEstimationHead → [1×56×56] +residual_layer1 · PromptDepthAnythingPreActResidualLayer +residual_layer2 · PromptDepthAnythingPreActResidualLayer +patch_embeddings · Dinov2PatchEmbeddings +layers · 4× PromptDepthAnythingReassembleLayer +attention · Dinov2Attention +mlp · Dinov2MLP + + + +pixel_values [1, 3, 64, 64] +projection: Conv2d 3→384 k14×14projection Conv2d 3→384 k14×14 +dropout: Dropoutdropout Dropout +norm1: LayerNorm 384norm1 LayerNorm 384 +attention: Dinov2SelfAttentionattention Dinov2SelfAttention +output: Dinov2SelfOutputoutput Dinov2SelfOutput +layer_scale1: Dinov2LayerScalelayer_scale1 Dinov2LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 384norm2 LayerNorm 384 +fc1: Linear [384→1536]fc1 [384→1536] +activation: GELUActivationactivation GELU +fc2: Linear [1536→384]fc2 [1536→384] +layer_scale2: Dinov2LayerScalelayer_scale2 Dinov2LayerScale +layernorm: LayerNorm 384layernorm LayerNorm 384 +projection: Conv2d 384→48 k1×1projection Conv2d 384→48 k1×1 +resize: ConvTranspose2dresize ConvTranspose2d +convs: 4× Conv2dconvs 4× Conv2d +projection: Conv2d 64→64 k1×1projection Conv2d 64→64 k1×1 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 64→64 k3×3convolution1 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 64→64 k3×3convolution1 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +convolution1: Conv2d 1→64 k3×3convolution1 Conv2d 1→64 k3×3 +activation1: ReLUactivation1 ReLU +convolution2: Conv2d 64→64 k3×3convolution2 Conv2d 64→64 k3×3 +activation2: ReLUactivation2 ReLU +convolution3: Conv2d 64→64 k3×3convolution3 Conv2d 64→64 k3×3 +conv1: Conv2d 64→32 k3×3conv1 Conv2d 64→32 k3×3 +conv2: Conv2d 32→32 k3×3conv2 Conv2d 32→32 k3×3 +activation1: ReLUactivation1 ReLU +conv3: Conv2d 32→1 k1×1conv3 Conv2d 32→1 k1×1 +activation2: ReLUactivation2 ReLU model id LiheYoung/depth-anything-smal… @@ -174,16 +194,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/qwen2_5_omni.diff.svg b/qwen2_5_omni.diff.svg index 9d3be49a970a369187318e4815cc025b9948c1fc..4709b6132957fe97b84e9e383219a53484cce620 100644 --- a/qwen2_5_omni.diff.svg +++ b/qwen2_5_omni.diff.svg @@ -1,4 +1,4 @@ - + - + qwen2_5_omni diff vs qwen2_5_vl (+llama,qwen2_audio,qwen2_vl) · 23 overridden · 267 added · 0 deleted · 43 new · 2 inherited-as-is - -Qwen2_5OmniForConditionalGeneration · base model -28 × Qwen2_5OmniDecoderLayerQwen2_5OmniDecoderLayer× 28 -Self-Attention · Qwen2_5OmniAttention -MLP · Qwen2MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [152064 × 3584] → [1, 6, 3584] -Qwen2_5OmniRMSNormpre-attention [1, 6, 3584] -q_proj: Linear [3584→3584]q_proj [3584→3584] -k_proj: Linear [3584→512]k_proj [3584→512] -v_proj: Linear [3584→512]v_proj [3584→512] -o_proj: Linear [3584→3584]o_proj [3584→3584] -scaled dot-product attention28 heads · head_dim 128 · GQA 28:4 -full_attention attention mask (q↓ × k→)full mask -RoPErotary positions → Q, K -residual add+ -Qwen2_5OmniRMSNormpre-FFN [1, 6, 3584] -gate_proj: Linear [3584→18944]gate_proj [3584→18944] -up_proj: Linear [3584→18944]up_proj [3584→18944] -down_proj: Linear [18944→3584]down_proj [18944→3584] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 3584] -LM HeadLinear [3584→152064] -Softmax -logits[1, 6, 152064] +thinker · ThinkerForConditionalGeneration +token2wav · Token2WavModel +code2wav_dit_model · Qwen2_5OmniToken2WavDiTModel +visual · Qwen2_5OmniVisionEncoder +talker · TalkerForConditionalGeneration +code2wav_bigvgan_model · Qwen2_5OmniToken2WavBigVGANModel +audio_tower · Qwen2_5OmniAudioEncoder +model · Qwen2_5OmniThinkerTextModel +model · Qwen2_5OmniTalkerModel +layers · 28× Qwen2_5_VLDecoderLayer ↩ inherited +layers · 28× Qwen2_5_VLDecoderLayer ↩ inherited +blocks · 32× Qwen2_5OmniVisionBlock +transformer_blocks · 22× DiTDecoderLayer +layers · 32× Qwen2_5OmniAudioEncoderLayer +input_embed · DiTInputEmbedding +resblocks · 18× AMPBlock +merger · Qwen2_5_VLPatchMerger ↩ inherited +time_embed · DiTTimestepEmbedding +activation_post · TorchActivation1d +self_attn · Qwen2_5OmniAudioAttention +attn · Qwen2_5OmniVisionAttention +mlp · Qwen2_5_VLMLP ↩ inherited +self_attn · Qwen2_5OmniAttention +mlp · Qwen2MLP +self_attn · Qwen2_5OmniAttention +mlp · Qwen2MLP +spk_encoder · ECAPA_TimeDelayNet +attn · DiTAttention +activations · 6× TorchActivation1d +patch_embed · Qwen2_5_VisionPatchEmbed +text_embed · DiTCodecEmbedding +ups · 6× ModuleList +mlp · Sequential [3] +time_mlp · ModuleList [3] +ff · DiTMLP + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv1d 128→1280 k3conv1 Conv1d 128→1280 k3 +conv2: Conv1d 1280→1280 k3conv2 Conv1d 1280→1280 k3 +positional_embedding: SinusoidsPositionEmbeddingpositional_embedding SinusoidsPositionEmbedding +audio_bos_eos_token: Embedding [2×3584]audio_bos_eos_token Embedding [2×3584] +k_proj: Linear [1280→1280]k_proj [1280→1280] +v_proj: Linear [1280→1280]v_proj [1280→1280] +q_proj: Linear [1280→1280]q_proj [1280→1280] +out_proj: Linear [1280→1280]out_proj [1280→1280] +self_attn_layer_norm: LayerNorm 1280self_attn_layer_norm LayerNorm 1280 +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [1280→5120]fc1 [1280→5120] +fc2: Linear [5120→1280]fc2 [5120→1280] +final_layer_norm: LayerNorm 1280final_layer_norm LayerNorm 1280 +ln_post: LayerNorm 1280ln_post LayerNorm 1280 +avg_pooler: AvgPool1davg_pooler AvgPool1d +proj: Linear [1280→3584]proj [1280→3584] +proj: Conv3d 3→3584 k2×14×14proj Conv3d 3→3584 k2×14×14 +rotary_pos_emb: Qwen2_5_VisionRotaryEmbeddingrotary_pos_emb Qwen2_5_VisionRotaryEmbedding +norm1: Qwen2_5OmniRMSNorm 3584norm1 RMSNorm 3584 +norm2: Qwen2_5OmniRMSNorm 3584norm2 RMSNorm 3584 +q: Linear [3584→3584]q [3584→3584] +k: Linear [3584→3584]k [3584→3584] +v: Linear [3584→3584]v [3584→3584] +proj: Linear [3584→3584]proj [3584→3584] +gate_proj: Linear [3584→3420]gate_proj [3584→3420] +up_proj: Linear [3584→3420]up_proj [3584→3420] +down_proj: Linear [3420→3584]down_proj [3420→3584] +act_fn: SiLUActivationact_fn SiLU +ln_q: Qwen2_5OmniRMSNorm 3584ln_q RMSNorm 3584 +0: Linear [14336→14336]0 [14336→14336] +1: GELU1 GELU +2: Linear [14336→3584]2 [14336→3584] +embed_tokens: Embedding [152064×3584]embed_tokens Embedding [152064×3584] +q_proj: Linear [3584→3584]q_proj [3584→3584] +k_proj: Linear [3584→512]k_proj [3584→512] +v_proj: Linear [3584→512]v_proj [3584→512] +o_proj: Linear [3584→3584]o_proj [3584→3584] +gate_proj: Linear [3584→18944]gate_proj [3584→18944] +up_proj: Linear [3584→18944]up_proj [3584→18944] +down_proj: Linear [18944→3584]down_proj [18944→3584] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: Qwen2_5OmniRMSNorm 3584input_layernorm RMSNorm 3584 +post_attention_layernorm: Qwen2_5OmniRMSNorm 3584post_attention_layernorm RMSNorm 3584 +norm: Qwen2_5OmniRMSNorm 3584norm RMSNorm 3584 +rotary_emb: Qwen2_5OmniRotaryEmbeddingrotary_emb RotaryEmbedding +lm_head: Linear [3584→152064]lm_head [3584→152064] +thinker_to_talker_proj: Linear [3584→3584]thinker_to_talker_proj [3584→3584] +embed_tokens: Embedding [8448×3584]embed_tokens Embedding [8448×3584] +q_proj: Linear [3584→3584]q_proj [3584→3584] +k_proj: Linear [3584→512]k_proj [3584→512] +v_proj: Linear [3584→512]v_proj [3584→512] +o_proj: Linear [3584→3584]o_proj [3584→3584] +gate_proj: Linear [3584→18944]gate_proj [3584→18944] +up_proj: Linear [3584→18944]up_proj [3584→18944] +down_proj: Linear [18944→3584]down_proj [18944→3584] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: Qwen2_5OmniRMSNorm 3584input_layernorm RMSNorm 3584 +post_attention_layernorm: Qwen2_5OmniRMSNorm 3584post_attention_layernorm RMSNorm 3584 +norm: Qwen2_5OmniRMSNorm 3584norm RMSNorm 3584 +rotary_emb: Qwen2_5OmniRotaryEmbeddingrotary_emb RotaryEmbedding +codec_head: Linear [3584→8448]codec_head [3584→8448] +time_embed: SinusPositionEmbeddingtime_embed SinusPositionEmbedding +0: Linear [256→1024]0 [256→1024] +1: SiLU1 SiLU +2: Linear [1024→1024]2 [1024→1024] +codec_embed: Embedding [8194×512]codec_embed Embedding [8194×512] +proj: Linear [912→1024]proj [912→1024] +blocks: ModuleList [4]blocks ModuleList [4] +mfa: TimeDelayNetBlockmfa TimeDelayNetBlock +asp: AttentiveStatisticsPoolingasp AttentiveStatisticsPooling +fc: Conv1d 1536→128 k1fc Conv1d 1536→128 k1 +rotary_embed: Qwen2_5OmniDiTRotaryEmbeddingrotary_embed DiTRotaryEmbedding +attn_norm: Qwen2_5_OmniAdaLayerNormZeroattn_norm Qwen2_5_OmniAdaLayerNormZero +to_q: Linear [1024→1024]to_q [1024→1024] +to_k: Linear [1024→1024]to_k [1024→1024] +to_v: Linear [1024→1024]to_v [1024→1024] +to_out: ModuleList [2]to_out ModuleList [2] +ff_norm: LayerNormff_norm LayerNorm +ff: ModuleList [4]ff ModuleList [4] +norm_out: Qwen2_5_OmniAdaLayerNormZero_Finalnorm_out Qwen2_5_OmniAdaLayerNormZero_Final +proj_out: Linear [1024→80]proj_out [1024→80] +conv_pre: Conv1d 80→1536 k7conv_pre Conv1d 80→1536 k7 +0: ConvTranspose1d0 ConvTranspose1d +convs1: 3× Conv1dconvs1 3× Conv1d +convs2: 3× Conv1dconvs2 3× Conv1d +act: SnakeBetaact SnakeBeta +upsample: UpSample1dupsample UpSample1d +downsample: DownSample1ddownsample DownSample1d +act: SnakeBetaact SnakeBeta +upsample: UpSample1dupsample UpSample1d +downsample: DownSample1ddownsample DownSample1d +conv_post: Conv1d 24→1 k7conv_post Conv1d 24→1 k7 model id Qwen/Qwen2.5-Omni-7B diff --git a/qwen2_5_omni.svg b/qwen2_5_omni.svg index c58240ee65ac10b2ab1d61ebaab5580e8fa34ba2..ca3fff4beac4f2328dfbcd4ae700125aa9320616 100644 --- a/qwen2_5_omni.svg +++ b/qwen2_5_omni.svg @@ -1,4 +1,4 @@ - + - + qwen2_5_omni -dense · 28× full - -Qwen2_5OmniForConditionalGeneration · base model -28 × Qwen2_5OmniDecoderLayerQwen2_5OmniDecoderLayer× 28 -Self-Attention · Qwen2_5OmniAttention -MLP · Qwen2MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [152064 × 3584] → [1, 6, 3584] -Qwen2_5OmniRMSNormpre-attention [1, 6, 3584] -q_proj: Linear [3584→3584]q_proj [3584→3584] -k_proj: Linear [3584→512]k_proj [3584→512] -v_proj: Linear [3584→512]v_proj [3584→512] -o_proj: Linear [3584→3584]o_proj [3584→3584] -scaled dot-product attention28 heads · head_dim 128 · GQA 28:4 -full_attention attention mask (q↓ × k→)full mask -RoPErotary positions → Q, K -residual add+ -Qwen2_5OmniRMSNormpre-FFN [1, 6, 3584] -gate_proj: Linear [3584→18944]gate_proj [3584→18944] -up_proj: Linear [3584→18944]up_proj [3584→18944] -down_proj: Linear [18944→3584]down_proj [18944→3584] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 3584] -LM HeadLinear [3584→152064] -Softmax -logits[1, 6, 152064] +Qwen2_5OmniForConditionalGeneration · staged data flow (structure) +thinker · ThinkerForConditionalGeneration +token2wav · Token2WavModel +code2wav_dit_model · Qwen2_5OmniToken2WavDiTModel +visual · Qwen2_5OmniVisionEncoder +talker · TalkerForConditionalGeneration +code2wav_bigvgan_model · Qwen2_5OmniToken2WavBigVGANModel +audio_tower · Qwen2_5OmniAudioEncoder +model · Qwen2_5OmniThinkerTextModel +model · Qwen2_5OmniTalkerModel +layers · 28× Qwen2_5OmniDecoderLayer +layers · 28× Qwen2_5OmniDecoderLayer +blocks · 32× Qwen2_5OmniVisionBlock +transformer_blocks · 22× DiTDecoderLayer +layers · 32× Qwen2_5OmniAudioEncoderLayer +input_embed · DiTInputEmbedding +resblocks · 18× AMPBlock +merger · Qwen2_5OmniPatchMerger +time_embed · DiTTimestepEmbedding +activation_post · TorchActivation1d +self_attn · Qwen2_5OmniAudioAttention +attn · Qwen2_5OmniVisionAttention +mlp · Qwen2_5OmniMLP +self_attn · Qwen2_5OmniAttention +mlp · Qwen2MLP +self_attn · Qwen2_5OmniAttention +mlp · Qwen2MLP +spk_encoder · ECAPA_TimeDelayNet +attn · DiTAttention +activations · 6× TorchActivation1d +patch_embed · Qwen2_5_VisionPatchEmbed +text_embed · DiTCodecEmbedding +ups · 6× ModuleList +mlp · Sequential [3] +time_mlp · ModuleList [3] +ff · DiTMLP + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv1d 128→1280 k3conv1 Conv1d 128→1280 k3 +conv2: Conv1d 1280→1280 k3conv2 Conv1d 1280→1280 k3 +positional_embedding: SinusoidsPositionEmbeddingpositional_embedding SinusoidsPositionEmbedding +audio_bos_eos_token: Embedding [2×3584]audio_bos_eos_token Embedding [2×3584] +k_proj: Linear [1280→1280]k_proj [1280→1280] +v_proj: Linear [1280→1280]v_proj [1280→1280] +q_proj: Linear [1280→1280]q_proj [1280→1280] +out_proj: Linear [1280→1280]out_proj [1280→1280] +self_attn_layer_norm: LayerNorm 1280self_attn_layer_norm LayerNorm 1280 +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [1280→5120]fc1 [1280→5120] +fc2: Linear [5120→1280]fc2 [5120→1280] +final_layer_norm: LayerNorm 1280final_layer_norm LayerNorm 1280 +ln_post: LayerNorm 1280ln_post LayerNorm 1280 +avg_pooler: AvgPool1davg_pooler AvgPool1d +proj: Linear [1280→3584]proj [1280→3584] +proj: Conv3d 3→3584 k2×14×14proj Conv3d 3→3584 k2×14×14 +rotary_pos_emb: Qwen2_5_VisionRotaryEmbeddingrotary_pos_emb Qwen2_5_VisionRotaryEmbedding +norm1: Qwen2_5OmniRMSNorm 3584norm1 RMSNorm 3584 +norm2: Qwen2_5OmniRMSNorm 3584norm2 RMSNorm 3584 +q: Linear [3584→3584]q [3584→3584] +k: Linear [3584→3584]k [3584→3584] +v: Linear [3584→3584]v [3584→3584] +proj: Linear [3584→3584]proj [3584→3584] +gate_proj: Linear [3584→3420]gate_proj [3584→3420] +up_proj: Linear [3584→3420]up_proj [3584→3420] +down_proj: Linear [3420→3584]down_proj [3420→3584] +act_fn: SiLUActivationact_fn SiLU +ln_q: Qwen2_5OmniRMSNorm 3584ln_q RMSNorm 3584 +0: Linear [14336→14336]0 [14336→14336] +1: GELU1 GELU +2: Linear [14336→3584]2 [14336→3584] +embed_tokens: Embedding [152064×3584]embed_tokens Embedding [152064×3584] +q_proj: Linear [3584→3584]q_proj [3584→3584] +k_proj: Linear [3584→512]k_proj [3584→512] +v_proj: Linear [3584→512]v_proj [3584→512] +o_proj: Linear [3584→3584]o_proj [3584→3584] +gate_proj: Linear [3584→18944]gate_proj [3584→18944] +up_proj: Linear [3584→18944]up_proj [3584→18944] +down_proj: Linear [18944→3584]down_proj [18944→3584] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: Qwen2_5OmniRMSNorm 3584input_layernorm RMSNorm 3584 +post_attention_layernorm: Qwen2_5OmniRMSNorm 3584post_attention_layernorm RMSNorm 3584 +norm: Qwen2_5OmniRMSNorm 3584norm RMSNorm 3584 +rotary_emb: Qwen2_5OmniRotaryEmbeddingrotary_emb RotaryEmbedding +lm_head: Linear [3584→152064]lm_head [3584→152064] +thinker_to_talker_proj: Linear [3584→3584]thinker_to_talker_proj [3584→3584] +embed_tokens: Embedding [8448×3584]embed_tokens Embedding [8448×3584] +q_proj: Linear [3584→3584]q_proj [3584→3584] +k_proj: Linear [3584→512]k_proj [3584→512] +v_proj: Linear [3584→512]v_proj [3584→512] +o_proj: Linear [3584→3584]o_proj [3584→3584] +gate_proj: Linear [3584→18944]gate_proj [3584→18944] +up_proj: Linear [3584→18944]up_proj [3584→18944] +down_proj: Linear [18944→3584]down_proj [18944→3584] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: Qwen2_5OmniRMSNorm 3584input_layernorm RMSNorm 3584 +post_attention_layernorm: Qwen2_5OmniRMSNorm 3584post_attention_layernorm RMSNorm 3584 +norm: Qwen2_5OmniRMSNorm 3584norm RMSNorm 3584 +rotary_emb: Qwen2_5OmniRotaryEmbeddingrotary_emb RotaryEmbedding +codec_head: Linear [3584→8448]codec_head [3584→8448] +time_embed: SinusPositionEmbeddingtime_embed SinusPositionEmbedding +0: Linear [256→1024]0 [256→1024] +1: SiLU1 SiLU +2: Linear [1024→1024]2 [1024→1024] +codec_embed: Embedding [8194×512]codec_embed Embedding [8194×512] +proj: Linear [912→1024]proj [912→1024] +blocks: ModuleList [4]blocks ModuleList [4] +mfa: TimeDelayNetBlockmfa TimeDelayNetBlock +asp: AttentiveStatisticsPoolingasp AttentiveStatisticsPooling +fc: Conv1d 1536→128 k1fc Conv1d 1536→128 k1 +rotary_embed: Qwen2_5OmniDiTRotaryEmbeddingrotary_embed DiTRotaryEmbedding +attn_norm: Qwen2_5_OmniAdaLayerNormZeroattn_norm Qwen2_5_OmniAdaLayerNormZero +to_q: Linear [1024→1024]to_q [1024→1024] +to_k: Linear [1024→1024]to_k [1024→1024] +to_v: Linear [1024→1024]to_v [1024→1024] +to_out: ModuleList [2]to_out ModuleList [2] +ff_norm: LayerNormff_norm LayerNorm +ff: ModuleList [4]ff ModuleList [4] +norm_out: Qwen2_5_OmniAdaLayerNormZero_Finalnorm_out Qwen2_5_OmniAdaLayerNormZero_Final +proj_out: Linear [1024→80]proj_out [1024→80] +conv_pre: Conv1d 80→1536 k7conv_pre Conv1d 80→1536 k7 +0: ConvTranspose1d0 ConvTranspose1d +convs1: 3× Conv1dconvs1 3× Conv1d +convs2: 3× Conv1dconvs2 3× Conv1d +act: SnakeBetaact SnakeBeta +upsample: UpSample1dupsample UpSample1d +downsample: DownSample1ddownsample DownSample1d +act: SnakeBetaact SnakeBeta +upsample: UpSample1dupsample UpSample1d +downsample: DownSample1ddownsample DownSample1d +conv_post: Conv1d 24→1 k7conv_post Conv1d 24→1 k7 model id Qwen/Qwen2.5-Omni-7B @@ -174,16 +270,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/rembert.svg b/rembert.svg index b0137d271f554ab1bf6c28c7f2ef8ca0d1a28d2b..a2569c8005aad6030b6756ab1dd6ae966fca63a6 100644 --- a/rembert.svg +++ b/rembert.svg @@ -1,4 +1,4 @@ - + - + rembert -dense · 32× MHA - -RemBertModel · base model -32 × RemBertLayerRemBertLayer× 32 -RemBertForCausalLM · task head -Self-Attention · RemBertAttention -output · RemBertSelfOutput -self · RemBertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: '␣Hey'␣Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [250300 × 1152] → [1, 6, 1152] -Normpre-attention [1, 6, 1152] -query: Linear [1152→1152]query [1152→1152] -key: Linear [1152→1152]key [1152→1152] -value: Linear [1152→1152]value [1152→1152] -dropout: Dropoutdropout Dropout -dense: Linear [1152→1152]dense [1152→1152] -LayerNorm: LayerNorm 1152LayerNorm LayerNorm 1152 -dropout: Dropoutdropout Dropout -scaled dot-product attention18 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 1152] -RemBertForCausalLMLM HeadLinear [1152→250300] -Softmax -logits[1, 6, 250300] +RemBertModel · staged data flow (structure) +encoder · Encoder +layer · 32× RemBertLayer +attention · RemBertAttention +embeddings · Embeddings +output · RemBertOutput +self · RemBertSelfAttention +output · RemBertSelfOutput +pooler · Pooler +intermediate · RemBertIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [250300×256]word_embeddings Embedding [250300×256] +position_embeddings: Embedding [512×256]position_embeddings Embedding [512×256] +token_type_embeddings: Embedding [2×256]token_type_embeddings Embedding [2×256] +LayerNorm: LayerNorm 256LayerNorm LayerNorm 256 +dropout: Dropoutdropout Dropout +embedding_hidden_mapping_in: Linear [256→1152]embedding_hidden_mapping_in [256→1152] +query: Linear [1152→1152]query [1152→1152] +key: Linear [1152→1152]key [1152→1152] +value: Linear [1152→1152]value [1152→1152] +dropout: Dropoutdropout Dropout +dense: Linear [1152→1152]dense [1152→1152] +LayerNorm: LayerNorm 1152LayerNorm LayerNorm 1152 +dropout: Dropoutdropout Dropout +dense: Linear [1152→4608]dense [1152→4608] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [4608→1152]dense [4608→1152] +LayerNorm: LayerNorm 1152LayerNorm LayerNorm 1152 +dropout: Dropoutdropout Dropout +dense: Linear [1152→1152]dense [1152→1152] +activation: Tanhactivation Tanh model id google/rembert @@ -170,16 +172,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings False legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/rf_detr.diff.svg b/rf_detr.diff.svg index 9f02f6ccdd38b2ec54864ccf5237e015f791cf00..7ed9327880046fecd94f6c8bcf7022d5f73788cd 100644 --- a/rf_detr.diff.svg +++ b/rf_detr.diff.svg @@ -1,4 +1,4 @@ - + - + rf_detr diff vs lw_detr (+dinov2,clip,convnext) · 16 overridden · 66 added · 0 deleted · 8 new · 3 inherited-as-is - -RfDetrModel · base model -13 × RfDetrDinov2LayerRfDetrDinov2Layer× 13 -Self-Attention · LwDetrDinov2Attention ↩ inherited -MLP · LwDetrDinov2MLP ↩ inherited -attention · LwDetrDinov2SelfAttention ↩ inherited -output · LwDetrDinov2SelfOutput ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -query: Linear [384→384]query [384→384] -key: Linear [384→384]key [384→384] -value: Linear [384→384]value [384→384] -dense: Linear [384→384]dense [384→384] -dropout: Dropoutdropout Dropout -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [384→1536]fc1 [384→1536] -activation: GELUActivationactivation GELU -fc2: Linear [1536→384]fc2 [1536→384] -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +backbone · ConvEncoder +decoder · Decoder +layers · 3× LwDetrDecoderLayer ↩ inherited +backbone · RfDetrDinov2Backbone +projector · RfDetrScaleProjector +encoder · RfDetrDinov2Encoder +layer · 12× RfDetrDinov2Layer +embeddings · RfDetrDinov2Embeddings +projector_layer · LwDetrC2FLayer ↩ inherited +cross_attn · LwDetrMultiscaleDeformableAttention ↩ inherited +self_attn · LwDetrAttention ↩ inherited +enc_out_bbox_embed · 13× LwDetrMLPPredictionHead ↩ inherited +ref_point_head · LwDetrMLPPredictionHead ↩ inherited +mlp · LwDetrMLP ↩ inherited +patch_embeddings · RfDetrDinov2PatchEmbeddings +bottlenecks · 3× LwDetrRepVggBlock ↩ inherited + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→384 k14×14projection Conv2d 3→384 k14×14 +dropout: Dropoutdropout Dropout +norm1: LayerNorm 384norm1 LayerNorm 384 +attention: RfDetrDinov2Attentionattention Dinov2Attention +layer_scale1: RfDetrDinov2LayerScalelayer_scale1 Dinov2LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 384norm2 LayerNorm 384 +mlp: RfDetrDinov2MLPmlp Dinov2MLP +layer_scale2: RfDetrDinov2LayerScalelayer_scale2 Dinov2LayerScale +layernorm: LayerNorm 384layernorm LayerNorm 384 +conv1: RfDetrConvNormLayerconv1 ConvNormLayer +conv2: RfDetrConvNormLayerconv2 ConvNormLayer +conv1: RfDetrConvNormLayerconv1 ConvNormLayer +conv2: RfDetrConvNormLayerconv2 ConvNormLayer +layer_norm: RfDetrLayerNorm 256layer_norm LayerNorm 256 +reference_point_embed · Embedding +query_feat · Embedding +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→128]sampling_offsets [256→128] +attention_weights: Linear [256→64]attention_weights [256→64] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +cross_attn_layer_norm: LayerNorm 256cross_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · 13× Linear +enc_output_norm · 13× LayerNorm +layers: 3× Linearlayers 3× Linear +enc_out_class_embed · 13× Linear model id Roboflow/rf-detr-base diff --git a/rf_detr.svg b/rf_detr.svg index ae94893c6f626e67d7110e0aab2ce8439b300610..1e46d99ad8cda7deb8399932a1c3cf57b3142e17 100644 --- a/rf_detr.svg +++ b/rf_detr.svg @@ -1,4 +1,4 @@ - + - + rf_detr -dense · 13× Attention - -RfDetrModel · base model -13 × RfDetrDinov2LayerRfDetrDinov2Layer× 13 -Self-Attention · RfDetrDinov2Attention -MLP · RfDetrDinov2MLP -attention · RfDetrDinov2SelfAttention -output · RfDetrDinov2SelfOutput - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -query: Linear [384→384]query [384→384] -key: Linear [384→384]key [384→384] -value: Linear [384→384]value [384→384] -dense: Linear [384→384]dense [384→384] -dropout: Dropoutdropout Dropout -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [384→1536]fc1 [384→1536] -activation: GELUActivationactivation GELU -fc2: Linear [1536→384]fc2 [1536→384] -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +RfDetrModel · staged data flow (structure) +backbone · ConvEncoder +decoder · Decoder +layers · 3× RfDetrDecoderLayer +backbone · RfDetrDinov2Backbone +projector · RfDetrScaleProjector +encoder · RfDetrDinov2Encoder +layer · 12× RfDetrDinov2Layer +embeddings · RfDetrDinov2Embeddings +projector_layer · RfDetrC2FLayer +cross_attn · RfDetrMultiscaleDeformableAttention +self_attn · RfDetrAttention +enc_out_bbox_embed · 13× RfDetrMLPPredictionHead +ref_point_head · RfDetrMLPPredictionHead +mlp · RfDetrMLP +patch_embeddings · RfDetrDinov2PatchEmbeddings +bottlenecks · 3× RfDetrRepVggBlock + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→384 k14×14projection Conv2d 3→384 k14×14 +dropout: Dropoutdropout Dropout +norm1: LayerNorm 384norm1 LayerNorm 384 +attention: RfDetrDinov2Attentionattention Dinov2Attention +layer_scale1: RfDetrDinov2LayerScalelayer_scale1 Dinov2LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 384norm2 LayerNorm 384 +mlp: RfDetrDinov2MLPmlp Dinov2MLP +layer_scale2: RfDetrDinov2LayerScalelayer_scale2 Dinov2LayerScale +layernorm: LayerNorm 384layernorm LayerNorm 384 +conv1: RfDetrConvNormLayerconv1 ConvNormLayer +conv2: RfDetrConvNormLayerconv2 ConvNormLayer +conv1: RfDetrConvNormLayerconv1 ConvNormLayer +conv2: RfDetrConvNormLayerconv2 ConvNormLayer +layer_norm: RfDetrLayerNorm 256layer_norm LayerNorm 256 +reference_point_embed · Embedding +query_feat · Embedding +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→128]sampling_offsets [256→128] +attention_weights: Linear [256→64]attention_weights [256→64] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +cross_attn_layer_norm: LayerNorm 256cross_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +layers: 2× Linearlayers 2× Linear +enc_output · 13× Linear +enc_output_norm · 13× LayerNorm +layers: 3× Linearlayers 3× Linear +enc_out_class_embed · 13× Linear model id Roboflow/rf-detr-base @@ -174,16 +203,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/roberta.diff.svg b/roberta.diff.svg index 4d71cc8f84a5f9091e9a41a3e4c7a8e23676fef8..b50e3f46ced0ace38f190b8304ef062bf6b7cf00 100644 --- a/roberta.diff.svg +++ b/roberta.diff.svg @@ -1,4 +1,4 @@ - + - + roberta diff vs bert · 3 overridden · 33 added · 0 deleted · 9 new · 3 inherited-as-is - -RobertaModel · base model -12 × RobertaLayerRobertaLayer× 12 -RobertaForCausalLM · task head -Self-Attention · BertAttention ↩ inherited -output · BertSelfOutput ↩ inherited -self · BertSelfAttention ↩ inherited - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [50265 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -RobertaForCausalLMLM HeadLinear [768→50265] · tied -Softmax -logits[1, 6, 50265] +encoder · Encoder → [1×8×768] +layer · 12× BertLayer ↩ inherited +attention · BertAttention ↩ inherited +embeddings · Embeddings → [1×8×768] +output · BertOutput ↩ inherited +self · BertSelfAttention ↩ inherited +output · BertSelfOutput ↩ inherited +pooler · Pooler → [1×768] +intermediate · BertIntermediate ↩ inherited + + + + +input_ids [1, 8] +word_embeddings: Embedding [50265×768]word_embeddings Embedding [50265×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id FacebookAI/roberta-base diff --git a/roberta.svg b/roberta.svg index 381f5a46dbd7f6fc1b9fd3ef2c09b58cc0559a08..cbd51d3e081c0a5bd104a9e9b534c22e90162987 100644 --- a/roberta.svg +++ b/roberta.svg @@ -1,4 +1,4 @@ - + - + roberta -dense · 12× MHA - -RobertaModel · base model -12 × RobertaLayerRobertaLayer× 12 -RobertaForCausalLM · task head -Self-Attention · RobertaAttention -output · RobertaSelfOutput -self · RobertaSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [50265 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -RobertaForCausalLMLM HeadLinear [768→50265] · tied -Softmax -logits[1, 6, 50265] +RobertaModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× RobertaLayer +attention · RobertaAttention +embeddings · Embeddings → [1×8×768] +output · RobertaOutput +self · RobertaSelfAttention +output · RobertaSelfOutput +pooler · Pooler → [1×768] +intermediate · RobertaIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [50265×768]word_embeddings Embedding [50265×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id FacebookAI/roberta-base @@ -170,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/roc_bert.svg b/roc_bert.svg index 6fcd0ca5863ca2edcce5f5a124a59b4f4caf6d1a..339e80f516aacaf727d68adc778d8fff0ce3b14f 100644 --- a/roc_bert.svg +++ b/roc_bert.svg @@ -1,4 +1,4 @@ - + - + roc_bert -dense · 12× MHA - -RoCBertModel · base model -12 × RoCBertLayerRoCBertLayer× 12 -RoCBertForCausalLM · task head -Self-Attention · RoCBertAttention -output · RoCBertSelfOutput -self · RoCBertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -RoCBertForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +RoCBertModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× RoCBertLayer +attention · RoCBertAttention +embeddings · Embeddings → [1×8×768] +output · RoCBertOutput +self · RoCBertSelfAttention +output · RoCBertSelfOutput +pooler · Pooler → [1×768] +intermediate · RoCBertIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +pronunciation_embed: Embedding [910×768]pronunciation_embed Embedding [910×768] +shape_embed: Embedding [24858×512]shape_embed Embedding [24858×512] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +map_inputs_layer: Linear [2048→768]map_inputs_layer [2048→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id weiweishi/roc-bert-base-zh @@ -170,16 +176,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/rt_detr.diff.svg b/rt_detr.diff.svg index 9dbb8f9eaec7b7dbe11475eab83bbc74b4c83497..407bf48e5cac082630c9e5fadea8040db192883b 100644 --- a/rt_detr.diff.svg +++ b/rt_detr.diff.svg @@ -1,4 +1,4 @@ - + - + rt_detr diff vs detr (+deformable_detr) · 0 overridden · 137 added · 0 deleted · 20 new · 4 inherited-as-is - -RTDetrModel · base model -6 × RTDetrDecoderLayerRTDetrDecoderLayer× 6 -layers (idx) -Self-Attention · DetrMultiscaleDeformableAttention (3 layer types — same modules, mask differs) ↩ inherited -MLP · RTDetrMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -bottleneck attention mask (q↓ × k→)bottleneck mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 - -model id -PekingU/rtdetr_r50vd -parent -detr -classes -24 -overridden -0 -added -137 -new classes -20 -inherited as-is -4 -legend - -new submodule (vs parent) - -changed / redefined - -deleted - -inherited / copy-pasted -changes by class - -RTDetrAIFILayer -add __init__,forward - -RTDetrCSPRepLayer -add __init__,forward - -RTDetrConvEncoder -add __init__,forward - -RTDetrConvNormLayer -add __init__,forward - -RTDetrDecoder -add __init__,forward; 1 attr - -RTDetrDecoderLayer -add __init__,forward - -RTDetrDecoderOutput -9 attr - -RTDetrEncoderLayer -add __init__,forward - -RTDetrForObjectDetection -add __init__,_set_aux_loss,forward; 1 attr - -RTDetrHybridEncoder -add __init__,forward; 1 attr - -RTDetrImageProcessor -add __init__,_preprocess,post_process_instan… - -RTDetrImageProcessorKwargs -2 attr - -RTDetrImageProcessorPil -add __init__,_preprocess,post_process_instan… - -RTDetrMLP -add __init__,forward - -RTDetrModel -add __init__,_cached_generate_anchors,forwar… - -RTDetrModelOutput -18 attr - -RTDetrObjectDetectionOutput -23 attr - -RTDetrPreTrainedModel -add _init_weights; 9 attr - -RTDetrRepVggBlock -add __init__,forward - -RTDetrSinePositionEmbedding -add __init__,_cached_build_2d_sinusoidal_pos… +encoder · HybridEncoder +decoder · Decoder +layers · 6× RTDetrDecoderLayer +backbone · ConvEncoder +model · DetrResNetBackbone ↩ inherited +aifi · ModuleList +fpn_blocks · 2× RTDetrCSPRepLayer +pan_blocks · 2× RTDetrCSPRepLayer +embedder · RTDetrResNetEmbeddings +0 · RTDetrAIFILayer +encoder_attn · DetrMultiscaleDeformableAttention ↩ inherited +encoder · DetrResNetEncoder ↩ inherited +self_attn · DetrSelfAttention ↩ inherited +embedder · 3× DetrResNetConvLayer ↩ inherited +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +decoder_input_proj · 3× Sequential +query_pos_head · RTDetrMLPPredictionHead +bottlenecks · 3× RTDetrRepVggBlock +bottlenecks · 3× RTDetrRepVggBlock +mlp · RTDetrMLP +stages · 4× DetrResNetStage ↩ inherited +layers · ModuleList + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: RTDetrFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +pooler: MaxPool2dpooler MaxPool2d +layers: Sequential [3]layers Sequential [3] +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: RTDetrSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: RTDetrEncoderLayer0 EncoderLayer +lateral_convs: 2× RTDetrConvNormLayerlateral_convs 2× RTDetrConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× RTDetrConvNormLayerdownsample_convs 2× RTDetrConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear + +model id +PekingU/rtdetr_r50vd +parent +detr +classes +24 +overridden +0 +added +137 +new classes +20 +inherited as-is +4 +legend + +new submodule (vs parent) + +changed / redefined + +deleted + +inherited / copy-pasted +changes by class + +RTDetrAIFILayer +add __init__,forward + +RTDetrCSPRepLayer +add __init__,forward + +RTDetrConvEncoder +add __init__,forward + +RTDetrConvNormLayer +add __init__,forward + +RTDetrDecoder +add __init__,forward; 1 attr + +RTDetrDecoderLayer +add __init__,forward + +RTDetrDecoderOutput +9 attr + +RTDetrEncoderLayer +add __init__,forward + +RTDetrForObjectDetection +add __init__,_set_aux_loss,forward; 1 attr + +RTDetrHybridEncoder +add __init__,forward; 1 attr + +RTDetrImageProcessor +add __init__,_preprocess,post_process_instan… + +RTDetrImageProcessorKwargs +2 attr + +RTDetrImageProcessorPil +add __init__,_preprocess,post_process_instan… + +RTDetrMLP +add __init__,forward + +RTDetrModel +add __init__,_cached_generate_anchors,forwar… + +RTDetrModelOutput +18 attr + +RTDetrObjectDetectionOutput +23 attr + +RTDetrPreTrainedModel +add _init_weights; 9 attr + +RTDetrRepVggBlock +add __init__,forward + +RTDetrSinePositionEmbedding +add __init__,_cached_build_2d_sinusoidal_pos… \ No newline at end of file diff --git a/rt_detr.svg b/rt_detr.svg index 2afdc64c28f4623e33b10417167d20e51c95d408..409d6f901b59324e381644e329c49534837940ba 100644 --- a/rt_detr.svg +++ b/rt_detr.svg @@ -1,4 +1,4 @@ - + - + rt_detr -dense · 2× MHA - -RTDetrModel · base model -6 × RTDetrDecoderLayerRTDetrDecoderLayer× 6 -layers (idx) -Self-Attention · RTDetrMultiscaleDeformableAttention (3 layer types — same modules, mask differs) -MLP · RTDetrMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -bottleneck attention mask (q↓ × k→)bottleneck mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 - -model id -PekingU/rtdetr_r50vd -model_type -rt_detr -config -RTDetrConfig -decoder -dense -layers -6 -hidden -256 -intermediate -— -heads / kv -8 / 8 -attention -MHA -norm -LayerNorm -positional -n/a -vocab -— -max_pos -— -tie_embeddings -None -legend - -self-attention - -basic - -bottleneck - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip +RTDetrModel · staged data flow (structure) +encoder · HybridEncoder +decoder · Decoder +layers · 6× RTDetrDecoderLayer +backbone · ConvEncoder +model · RTDetrResNetBackbone +aifi · ModuleList +fpn_blocks · 2× RTDetrCSPRepLayer +pan_blocks · 2× RTDetrCSPRepLayer +embedder · RTDetrResNetEmbeddings +0 · RTDetrAIFILayer +encoder_attn · RTDetrMultiscaleDeformableAttention +encoder · RTDetrResNetEncoder +self_attn · RTDetrSelfAttention +embedder · 3× RTDetrResNetConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +decoder_input_proj · 3× Sequential +query_pos_head · RTDetrMLPPredictionHead +bottlenecks · 3× RTDetrRepVggBlock +bottlenecks · 3× RTDetrRepVggBlock +mlp · RTDetrMLP +stages · 4× RTDetrResNetStage +layers · ModuleList + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: RTDetrFrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +pooler: MaxPool2dpooler MaxPool2d +layers: Sequential [3]layers Sequential [3] +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: RTDetrSinePositionEmbeddingposition_embedding SinePositionEmbedding +0: RTDetrEncoderLayer0 EncoderLayer +lateral_convs: 2× RTDetrConvNormLayerlateral_convs 2× RTDetrConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× RTDetrConvNormLayerdownsample_convs 2× RTDetrConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +conv1: RTDetrConvNormLayerconv1 ConvNormLayer +conv2: RTDetrConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +attn: MultiScaleDeformableAttentionattn MultiScaleDeformableAttention +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear + +model id +PekingU/rtdetr_r50vd +model_type +rt_detr +config +RTDetrConfig +decoder +dense +layers +6 +hidden +256 +intermediate +— +heads / kv +8 / 8 +attention +MHA +norm +LayerNorm +positional +n/a +vocab +— +max_pos +— +tie_embeddings +None +legend + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/rt_detr_v2.diff.svg b/rt_detr_v2.diff.svg index 401f48304746d45328a48ca9913e86ae5ee72556..187cffbe2298d0eef0697dda7d296aaee7ce122e 100644 --- a/rt_detr_v2.diff.svg +++ b/rt_detr_v2.diff.svg @@ -1,4 +1,4 @@ - + - + rt_detr_v2 diff vs rt_detr · 5 overridden · 63 added · 0 deleted · 2 new · 1 inherited-as-is - -RTDetrV2Model · base model -6 × RTDetrV2DecoderLayerRTDetrV2DecoderLayer× 6 -layers (idx) -Self-Attention · RTDetrV2MultiscaleDeformableAttention (3 layer types — same modules, mask differs) -MLP · RTDetrMLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -bottleneck attention mask (q↓ × k→)bottleneck mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 - -model id -PekingU/rtdetr_r18vd -parent -rt_detr -classes -8 -overridden -5 -added -63 -new classes -2 -inherited as-is -1 -legend - -new submodule (vs parent) - -changed / redefined - -deleted - -inherited / copy-pasted -changes by class - -RTDetrV2Decoder -ovr __init__ - -RTDetrV2DecoderLayer -ovr __init__ - -RTDetrV2Model -ovr __init__ - -RTDetrV2PreTrainedModel -ovr _init_weights - -RTDetrV2Config -add __post_init__; 59 attr - -RTDetrV2ForObjectDetection -ovr __init__; 1 attr - -RTDetrV2MultiscaleDeformableAttention -add __init__,forward +encoder · HybridEncoder +decoder · Decoder +layers · 6× RTDetrV2DecoderLayer +backbone · ConvEncoder +model · RTDetrResNetBackbone +aifi · ModuleList +fpn_blocks · 2× RTDetrCSPRepLayer ↩ inherited +pan_blocks · 2× RTDetrCSPRepLayer ↩ inherited +embedder · RTDetrResNetEmbeddings +0 · RTDetrAIFILayer ↩ inherited +encoder · RTDetrResNetEncoder +self_attn · RTDetrSelfAttention ↩ inherited +encoder_attn · RTDetrV2MultiscaleDeformableAttention +embedder · 3× RTDetrResNetConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +decoder_input_proj · 3× Sequential +query_pos_head · RTDetrMLPPredictionHead ↩ inherited +bottlenecks · 3× RTDetrRepVggBlock ↩ inherited +bottlenecks · 3× RTDetrRepVggBlock ↩ inherited +mlp · RTDetrMLP ↩ inherited +stages · 4× RTDetrResNetStage +layers · ModuleList + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: RTDetrV2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +pooler: MaxPool2dpooler MaxPool2d +layers: Sequential [3]layers Sequential [3] +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: RTDetrV2SinePositionEmbeddingposition_embedding SinePositionEmbedding +0: RTDetrV2EncoderLayer0 EncoderLayer +lateral_convs: 2× RTDetrV2ConvNormLayerlateral_convs 2× RTDetrV2ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× RTDetrV2ConvNormLayerdownsample_convs 2× RTDetrV2ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear + +model id +PekingU/rtdetr_r18vd +parent +rt_detr +classes +8 +overridden +5 +added +63 +new classes +2 +inherited as-is +1 +legend + +new submodule (vs parent) + +changed / redefined + +deleted + +inherited / copy-pasted +changes by class + +RTDetrV2Decoder +ovr __init__ + +RTDetrV2DecoderLayer +ovr __init__ + +RTDetrV2Model +ovr __init__ + +RTDetrV2PreTrainedModel +ovr _init_weights + +RTDetrV2Config +add __post_init__; 59 attr + +RTDetrV2ForObjectDetection +ovr __init__; 1 attr + +RTDetrV2MultiscaleDeformableAttention +add __init__,forward \ No newline at end of file diff --git a/rt_detr_v2.svg b/rt_detr_v2.svg index e20c7f027d914d98c263c06a9cb8be4b2cec500d..fcdb717ffca65c5c00d378a4b6b9af5c9931cdc3 100644 --- a/rt_detr_v2.svg +++ b/rt_detr_v2.svg @@ -1,4 +1,4 @@ - + - + rt_detr_v2 -dense · 2× MHA - -RTDetrV2Model · base model -6 × RTDetrV2DecoderLayerRTDetrV2DecoderLayer× 6 -layers (idx) -Self-Attention · RTDetrV2MultiscaleDeformableAttention (3 layer types — same modules, mask differs) -MLP · RTDetrV2MLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -o_proj: Linear [256→256]o_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -basic attention mask (q↓ × k→)basic mask -bottleneck attention mask (q↓ × k→)bottleneck mask -residual add+ -LayerNormpre-FFN [1, 6, 256] -fc1: Linear [256→1024]fc1 [256→1024] -fc2: Linear [1024→256]fc2 [1024→256] -activation_fn: ReLUactivation_fn ReLU -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] · tied -Softmax -logits[1, 6, ?] -layer 0: basic0 -layer 1: bottleneck1 - -model id -PekingU/rtdetr_r18vd -model_type -rt_detr_v2 -config -RTDetrV2Config -decoder -dense -layers -6 -hidden -256 -intermediate -— -heads / kv -8 / 8 -attention -MHA -norm -LayerNorm -positional -n/a -vocab -— -max_pos -— -tie_embeddings -True -legend - -self-attention - -basic - -bottleneck - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip +RTDetrV2Model · staged data flow (structure) +encoder · HybridEncoder +decoder · Decoder +layers · 6× RTDetrV2DecoderLayer +backbone · ConvEncoder +model · RTDetrResNetBackbone +aifi · ModuleList +fpn_blocks · 2× RTDetrV2CSPRepLayer +pan_blocks · 2× RTDetrV2CSPRepLayer +embedder · RTDetrResNetEmbeddings +0 · RTDetrV2AIFILayer +encoder · RTDetrResNetEncoder +self_attn · RTDetrV2SelfAttention +encoder_attn · RTDetrV2MultiscaleDeformableAttention +embedder · 3× RTDetrResNetConvLayer +encoder_input_proj · 3× Sequential +enc_output · Sequential [2] +enc_bbox_head · MLPPredictionHead +decoder_input_proj · 3× Sequential +query_pos_head · RTDetrV2MLPPredictionHead +bottlenecks · 3× RTDetrV2RepVggBlock +bottlenecks · 3× RTDetrV2RepVggBlock +mlp · RTDetrV2MLP +stages · 4× RTDetrResNetStage +layers · ModuleList + + + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k3×3convolution Conv2d 3→32 k3×3 +normalization: RTDetrV2FrozenBatchNorm2d 32normalization FrozenBatchNorm2d 32 +activation: ReLUactivation ReLU +pooler: MaxPool2dpooler MaxPool2d +layers: Sequential [3]layers Sequential [3] +0: Conv2d 512→256 k1×10 Conv2d 512→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +position_embedding: RTDetrV2SinePositionEmbeddingposition_embedding SinePositionEmbedding +0: RTDetrV2EncoderLayer0 EncoderLayer +lateral_convs: 2× RTDetrV2ConvNormLayerlateral_convs 2× RTDetrV2ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +downsample_convs: 2× RTDetrV2ConvNormLayerdownsample_convs 2× RTDetrV2ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +conv1: RTDetrV2ConvNormLayerconv1 ConvNormLayer +conv2: RTDetrV2ConvNormLayerconv2 ConvNormLayer +activation: SiLUActivationactivation SiLU +conv3: Identityconv3 Identity +denoising_class_embed · Embedding +0: Linear [256→256]0 [256→256] +1: LayerNorm 2561 LayerNorm 256 +enc_score_head · Linear +layers: 3× Linearlayers 3× Linear +0: Conv2d 256→256 k1×10 Conv2d 256→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +sampling_offsets: Linear [256→192]sampling_offsets [256→192] +attention_weights: Linear [256→96]attention_weights [256→96] +value_proj: Linear [256→256]value_proj [256→256] +output_proj: Linear [256→256]output_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→1024]fc1 [256→1024] +fc2: Linear [1024→256]fc2 [1024→256] +activation_fn: ReLUactivation_fn ReLU +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layers: 2× Linearlayers 2× Linear + +model id +PekingU/rtdetr_r18vd +model_type +rt_detr_v2 +config +RTDetrV2Config +decoder +dense +layers +6 +hidden +256 +intermediate +— +heads / kv +8 / 8 +attention +MHA +norm +LayerNorm +positional +n/a +vocab +— +max_pos +— +tie_embeddings +True +legend + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/sam3_video.svg b/sam3_video.svg index 4b8a5816bcf13bed7926279ecc894ab2c8aec026..15915f9958c868fe63679a64508c1e695bc8f973 100644 --- a/sam3_video.svg +++ b/sam3_video.svg @@ -1,4 +1,4 @@ - + - + sam3_video -dense · 32× Attention - -Sam3VideoModel · base model -32 × Sam3ViTLayerSam3ViTLayer× 32 -Self-Attention · Sam3ViTRoPEAttention -MLP · Sam3MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × ?] → [1, 6, ?] -LayerNormpre-attention [1, 6, ?] -q_proj: Linear [1024→1024]q_proj [1024→1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -o_proj: Linear [1024→1024]o_proj [1024→1024] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -RoPErotary positions → Q, K -residual add+ -LayerNormpre-FFN [1, 6, ?] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [1024→4736]fc1 [1024→4736] -fc2: Linear [4736→1024]fc2 [4736→1024] -dropout: Dropoutdropout Dropout -residual add+ -Final LayerNorm[1, 6, ?] -LM HeadLinear [?→?] -Softmax -logits[1, 6, ?] +Sam3VideoModel · staged data flow (structure) +detector_model · Sam3Model +tracker_model · Sam3TrackerVideoModel +detr_decoder · Sam3DetrDecoder +mask_decoder · Sam3TrackerVideoMaskDecoder +geometry_encoder · Sam3GeometryEncoder +layers · 6× Sam3DetrDecoderLayer +memory_encoder · Sam3TrackerVideoMemoryEncoder +vision_encoder · Sam3VisionModel +detr_encoder · Sam3DetrEncoder +memory_attention · Sam3TrackerVideoMemoryAttention +layers · 3× Sam3GeometryEncoderLayer +layers · 6× Sam3DetrEncoderLayer +transformer · Sam3TrackerVideoTwoWayTransformer +layers · 4× Sam3TrackerVideoMemoryAttentionLayer +mask_decoder · Sam3MaskDecoder +prompt_encoder · Sam3TrackerVideoPromptEncoder +text_encoder · CLIPTextModelWithProjection +backbone · Sam3ViTModel +layers · 2× Sam3TrackerVideoTwoWayAttentionBlock +text_model · CLIPTextModel +memory_fuser · Sam3TrackerVideoMemoryFuser +tracker_neck · Sam3VisionNeck +mask_embed · Sam3TrackerVideoMaskEmbedding +mask_downsampler · Sam3TrackerVideoMaskDownSampler +layers · 2× Sam3TrackerVideoMemoryFuserCXBlock +dot_product_scoring · Sam3DotProductScoring +neck · Sam3VisionNeck +object_pointer_proj · Sam3TrackerVideoFeedForward +fpn_layers · 4× Sam3FPNLayer +output_hypernetworks_mlps · 4× Sam3TrackerVideoFeedForward +iou_prediction_head · Sam3TrackerVideoFeedForward +pred_obj_score_head · Sam3TrackerVideoFeedForward +layers · 32× Sam3ViTLayer +layers · 4× Sam3TrackerVideoMaskDownSamplerLayer +prompt_cross_attn · Sam3Attention +embeddings · Sam3ViTEmbeddings +fpn_layers · 4× Sam3FPNLayer +embeddings · CLIPTextEmbeddings +self_attn · Sam3Attention +cross_attn · Sam3Attention +mlp · Sam3MLP +self_attn · Sam3Attention +cross_attn · Sam3Attention +mlp · Sam3MLP +self_attn · Sam3Attention +text_cross_attn · Sam3Attention +vision_cross_attn · Sam3Attention +mlp · Sam3MLP +final_attn_token_to_image · Sam3TrackerVideoAttention +self_attn · Sam3TrackerVideoRoPEAttention +cross_attn_image · Sam3TrackerVideoRoPEAttention +box_head · Sam3DecoderMLP +presence_head · Sam3DecoderMLP +ref_point_head · Sam3DecoderMLP +box_rpb_embed_x · Sam3DecoderMLP +box_rpb_embed_y · Sam3DecoderMLP +pixel_decoder · Sam3PixelDecoder +mask_embedder · Sam3MaskEmbedder +text_mlp · Sam3DecoderMLP +layers · ModuleList +scale_layers · ModuleList [3] +encoder · CLIPEncoder +layers · ModuleList +layers · ModuleList +layers · ModuleList + + + +inputsinput_ids / pixel_values / input_values +patch_embeddings: Sam3ViTPatchEmbeddingspatch_embeddings Sam3ViTPatchEmbeddings +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +layer_norm1: LayerNorm 1024layer_norm1 LayerNorm 1024 +rotary_emb: Sam3ViTRotaryEmbeddingrotary_emb Sam3ViTRotaryEmbedding +attention: Sam3ViTRoPEAttentionattention Sam3ViTRoPEAttention +layer_norm2: LayerNorm 1024layer_norm2 LayerNorm 1024 +mlp: Sam3MLPmlp Sam3MLP +dropout: Dropoutdropout Dropout +position_encoding: Sam3SinePositionEmbeddingposition_encoding Sam3SinePositionEmbedding +scale_layers: ModuleList [3]scale_layers ModuleList [3] +proj1: Conv2d 256→256 k1×1proj1 Conv2d 256→256 k1×1 +proj2: Conv2d 256→256 k3×3proj2 Conv2d 256→256 k3×3 +token_embedding: Embedding [49408×1024]token_embedding Embedding [49408×1024] +position_embedding: Embedding [32×1024]position_embedding Embedding [32×1024] +layers: ModuleList [24]layers ModuleList [24] +final_layer_norm: LayerNorm 1024final_layer_norm LayerNorm 1024 +text_projection: Linear [1024→512]text_projection [1024→512] +text_projection: Linear [1024→256]text_projection [1024→256] +position_encoding: Sam3SinePositionEmbeddingposition_encoding Sam3SinePositionEmbedding +label_embed: Embedding [2×256]label_embed Embedding [2×256] +cls_embed: Embedding [1×256]cls_embed Embedding [1×256] +boxes_direct_project: Linear [4→256]boxes_direct_project [4→256] +boxes_pool_project: Conv2d 256→256 k7×7boxes_pool_project Conv2d 256→256 k7×7 +boxes_pos_enc_project: Linear [258→256]boxes_pos_enc_project [258→256] +vision_layer_norm: LayerNorm 256vision_layer_norm LayerNorm 256 +final_proj: Linear [256→256]final_proj [256→256] +prompt_layer_norm: LayerNorm 256prompt_layer_norm LayerNorm 256 +layer_norm1: LayerNorm 256layer_norm1 LayerNorm 256 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +dropout: Dropoutdropout Dropout +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +layer_norm2: LayerNorm 256layer_norm2 LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +dropout: Dropoutdropout Dropout +layer_norm3: LayerNorm 256layer_norm3 LayerNorm 256 +output_layer_norm: LayerNorm 256output_layer_norm LayerNorm 256 +layer_norm1: LayerNorm 256layer_norm1 LayerNorm 256 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +dropout: Dropoutdropout Dropout +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +layer_norm2: LayerNorm 256layer_norm2 LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +dropout: Dropoutdropout Dropout +layer_norm3: LayerNorm 256layer_norm3 LayerNorm 256 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +self_attn_dropout: Dropoutself_attn_dropout Dropout +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +text_cross_attn_dropout: Dropouttext_cross_attn_dropout Dropout +text_cross_attn_layer_norm: LayerNorm 256text_cross_attn_layer_norm LayerNorm 256 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +vision_cross_attn_dropout: Dropoutvision_cross_attn_dropout Dropout +vision_cross_attn_layer_norm: LayerNorm 256vision_cross_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +dropout: Dropoutdropout Dropout +mlp_layer_norm: LayerNorm 256mlp_layer_norm LayerNorm 256 +mlp_dropout: Dropoutmlp_dropout Dropout +output_layer_norm: LayerNorm 256output_layer_norm LayerNorm 256 +layer1: Linear [256→256]layer1 [256→256] +layer2: Linear [256→256]layer2 [256→256] +layer3: Linear [256→4]layer3 [256→4] +query_embed: Embedding [200×256]query_embed Embedding [200×256] +reference_points: Embedding [200×4]reference_points Embedding [200×4] +presence_token: Embedding [1×256]presence_token Embedding [1×256] +layer1: Linear [256→256]layer1 [256→256] +layer2: Linear [256→256]layer2 [256→256] +layer3: Linear [256→1]layer3 [256→1] +presence_layer_norm: LayerNorm 256presence_layer_norm LayerNorm 256 +layer1: Linear [512→256]layer1 [512→256] +layer2: Linear [256→256]layer2 [256→256] +layer1: Linear [2→256]layer1 [2→256] +layer2: Linear [256→8]layer2 [256→8] +layer1: Linear [2→256]layer1 [2→256] +layer2: Linear [256→8]layer2 [256→8] +position_encoding: Sam3SinePositionEmbeddingposition_encoding Sam3SinePositionEmbedding +conv_layers: 3× Conv2dconv_layers 3× Conv2d +norms: 3× GroupNormnorms 3× GroupNorm +layers: 3× Linearlayers 3× Linear +activation: ReLUactivation ReLU +instance_projection: Conv2d 256→256 k1×1instance_projection Conv2d 256→256 k1×1 +semantic_projection: Conv2d 256→1 k1×1semantic_projection Conv2d 256→1 k1×1 +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +prompt_cross_attn_norm: LayerNorm 256prompt_cross_attn_norm LayerNorm 256 +prompt_cross_attn_dropout: Dropoutprompt_cross_attn_dropout Dropout +layer1: Linear [256→2048]layer1 [256→2048] +layer2: Linear [2048→256]layer2 [2048→256] +text_mlp_dropout: Dropouttext_mlp_dropout Dropout +text_mlp_out_norm: LayerNorm 256text_mlp_out_norm LayerNorm 256 +text_proj: Linear [256→256]text_proj [256→256] +query_proj: Linear [256→256]query_proj [256→256] +shared_image_embedding: Sam3TrackerVideoPositionalEmbeddingshared_image_embedding Sam3TrackerVideoPositionalEmbedding +shared_embedding: Sam3TrackerVideoPositionalEmbeddingshared_embedding Sam3TrackerVideoPositionalEmbedding +activation: GELUActivationactivation GELU +conv1: Conv2d 1→4 k2×2conv1 Conv2d 1→4 k2×2 +conv2: Conv2d 4→16 k2×2conv2 Conv2d 4→16 k2×2 +conv3: Conv2d 16→256 k1×1conv3 Conv2d 16→256 k1×1 +layer_norm1: Sam3TrackerVideoLayerNorm 4layer_norm1 Sam3TrackerVideoLayerNorm 4 +layer_norm2: Sam3TrackerVideoLayerNorm 16layer_norm2 Sam3TrackerVideoLayerNorm 16 +no_mask_embed: Embedding [1×256]no_mask_embed Embedding [1×256] +point_embed: Embedding [4×256]point_embed Embedding [4×256] +not_a_point_embed: Embedding [1×256]not_a_point_embed Embedding [1×256] +iou_token: Embedding [1×256]iou_token Embedding [1×256] +mask_tokens: Embedding [4×256]mask_tokens Embedding [4×256] +self_attn: Sam3TrackerVideoAttentionself_attn Sam3TrackerVideoAttention +layer_norm1: LayerNorm 256layer_norm1 LayerNorm 256 +cross_attn_token_to_image: Sam3TrackerVideoAttentioncross_attn_token_to_image Sam3TrackerVideoAttention +layer_norm2: LayerNorm 256layer_norm2 LayerNorm 256 +mlp: Sam3TrackerVideoFeedForwardmlp Sam3TrackerVideoFeedForward +layer_norm3: LayerNorm 256layer_norm3 LayerNorm 256 +layer_norm4: LayerNorm 256layer_norm4 LayerNorm 256 +cross_attn_image_to_token: Sam3TrackerVideoAttentioncross_attn_image_to_token Sam3TrackerVideoAttention +q_proj: Linear [256→128]q_proj [256→128] +k_proj: Linear [256→128]k_proj [256→128] +v_proj: Linear [256→128]v_proj [256→128] +o_proj: Linear [128→256]o_proj [128→256] +layer_norm_final_attn: LayerNorm 256layer_norm_final_attn LayerNorm 256 +upscale_conv1: ConvTranspose2dupscale_conv1 ConvTranspose2d +upscale_conv2: ConvTranspose2dupscale_conv2 ConvTranspose2d +upscale_layer_norm: Sam3TrackerVideoLayerNorm 64upscale_layer_norm Sam3TrackerVideoLayerNorm 64 +activation: GELUactivation GELU +activation: ReLUactivation ReLU +proj_in: Linear [256→256]proj_in [256→256] +proj_out: Linear [256→32]proj_out [256→32] +0: Linear [256→256]0 [256→256] +activation: ReLUactivation ReLU +proj_in: Linear [256→256]proj_in [256→256] +proj_out: Linear [256→4]proj_out [256→4] +0: Linear [256→256]0 [256→256] +conv_s0: Conv2d 256→32 k1×1conv_s0 Conv2d 256→32 k1×1 +conv_s1: Conv2d 256→64 k1×1conv_s1 Conv2d 256→64 k1×1 +obj_score_token: Embedding [1×256]obj_score_token Embedding [1×256] +activation: ReLUactivation ReLU +proj_in: Linear [256→256]proj_in [256→256] +proj_out: Linear [256→1]proj_out [256→1] +0: Linear [256→256]0 [256→256] +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +o_proj: Linear [256→256]o_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +k_proj: Linear [64→256]k_proj [64→256] +v_proj: Linear [64→256]v_proj [64→256] +o_proj: Linear [256→256]o_proj [256→256] +linear1: Linear [256→2048]linear1 [256→2048] +dropout: Dropoutdropout Dropout +linear2: Linear [2048→256]linear2 [2048→256] +layer_norm1: LayerNorm 256layer_norm1 LayerNorm 256 +layer_norm2: LayerNorm 256layer_norm2 LayerNorm 256 +layer_norm3: LayerNorm 256layer_norm3 LayerNorm 256 +dropout1: Dropoutdropout1 Dropout +dropout2: Dropoutdropout2 Dropout +dropout3: Dropoutdropout3 Dropout +activation: ReLUactivation ReLU +layer_norm: LayerNorm 256layer_norm LayerNorm 256 +rotary_emb: Sam3TrackerVideoVisionRotaryEmbeddingrotary_emb Sam3TrackerVideoVisionRotaryEmbedding +conv: Conv2d 1→4 k3×3conv Conv2d 1→4 k3×3 +layer_norm: Sam3TrackerVideoLayerNorm 4layer_norm Sam3TrackerVideoLayerNorm 4 +activation: GELUActivationactivation GELU +activation: GELUActivationactivation GELU +final_conv: Conv2d 256→256 k1×1final_conv Conv2d 256→256 k1×1 +feature_projection: Conv2d 256→256 k1×1feature_projection Conv2d 256→256 k1×1 +depthwise_conv: Conv2d 256→256 k7×7 g256depthwise_conv Conv2d 256→256 k7×7 g256 +layer_norm: Sam3TrackerVideoLayerNorm 256layer_norm Sam3TrackerVideoLayerNorm 256 +activation: GELUActivationactivation GELU +pointwise_conv1: Linear [256→1024]pointwise_conv1 [256→1024] +pointwise_conv2: Linear [1024→256]pointwise_conv2 [1024→256] +position_encoding: Sam3TrackerVideoPositionEmbeddingSineposition_encoding Sam3TrackerVideoPositionEmbeddingSine +projection: Conv2d 256→64 k1×1projection Conv2d 256→64 k1×1 +mask_downsample: Conv2d 1→1 k4×4mask_downsample Conv2d 1→1 k4×4 +activation: ReLUactivation ReLU +proj_in: Linear [256→256]proj_in [256→256] +proj_out: Linear [256→256]proj_out [256→256] +0: Linear [256→256]0 [256→256] +temporal_positional_encoding_projection_layer: Linear [256→64]temporal_positional_encoding_projection_layer [256→64] +position_encoding: Sam3SinePositionEmbeddingposition_encoding Sam3SinePositionEmbedding +0: ConvTranspose2d0 ConvTranspose2d +1: GELU1 GELU +2: ConvTranspose2d2 ConvTranspose2d +proj1: Conv2d 256→256 k1×1proj1 Conv2d 256→256 k1×1 +proj2: Conv2d 256→256 k3×3proj2 Conv2d 256→256 k3×3 model id facebook/sam3 @@ -174,16 +419,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/seamless_m4t.svg b/seamless_m4t.svg index 9d7ee46087ba3ea1f4b13fd9e3cbd93598c6122f..7934c132c94d3ae898f511a8dd4be7ef83dccb12 100644 --- a/seamless_m4t.svg +++ b/seamless_m4t.svg @@ -1,4 +1,4 @@ - + - + seamless_m4t -ssm · 24× Mamba - -SeamlessM4TModel · base model -24 × SeamlessM4TEncoderLayerSeamlessM4TEncoderLayer× 24 -SeamlessM4TForTextToText · task head -Self-Attention · SeamlessM4TAttention -MLP · SeamlessM4TFeedForwardNetwork - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [256102 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -out_proj: Linear [1024→1024]out_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -fc1: Linear [1024→8192]fc1 [1024→8192] -fc2: Linear [8192→1024]fc2 [8192→1024] -dropout: Dropoutdropout Dropout -act: ReLUact ReLU -residual add+ -Final LayerNorm[1, 6, 1024] -SeamlessM4TForTextToTextLM HeadLinear [1024→256102] · tied -Softmax -logits[1, 6, 256102] +SeamlessM4TModel · staged data flow (structure) +speech_encoder · SpeechEncoder +encoder · SeamlessM4TConformerEncoder +t2u_model · TextToUnitForConditionalGeneration +layers · 24× SeamlessM4TConformerEncoderLayer +model · SeamlessM4TTextToUnitModel +text_decoder · Decoder +layers · 24× SeamlessM4TDecoderLayer +text_encoder · Encoder +vocoder · CodeHifiGan +decoder · SeamlessM4TDecoder +layers · 24× SeamlessM4TEncoderLayer +layers · 6× SeamlessM4TDecoderLayer +adapter · SeamlessM4TConformerAdapter +conv_module · SeamlessM4TConformerConvolutionModule +layers · ModuleList +encoder · SeamlessM4TEncoder +0 · SeamlessM4TConformerAdapterLayer +hifi_gan · SeamlessM4THifiGan +dur_predictor · SeamlessM4TVariancePredictor +intermediate_ffn · SeamlessM4TConformerFeedForward +ffn1 · SeamlessM4TConformerFeedForward +ffn2 · SeamlessM4TConformerFeedForward +layers · 6× SeamlessM4TEncoderLayer +feature_projection · SeamlessM4TConformerFeatureProjection +self_attn · SeamlessM4TAttention +ffn · SeamlessM4TFeedForwardNetwork +self_attn · SeamlessM4TAttention +cross_attention · SeamlessM4TAttention +ffn · SeamlessM4TFeedForwardNetwork +self_attn · SeamlessM4TConformerSelfAttention +resblocks · 15× HifiGanResidualBlock + + + + + + + +inputsinput_ids / pixel_values / input_values +shared · Embedding +embed_tokens: SeamlessM4TScaledWordEmbedding [256102×1024]embed_tokens ScaledWordEmbedding [256102×1024] +embed_positions: SeamlessM4TSinusoidalPositionalEmbeddingembed_positions SinusoidalPositionalEmbedding +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +fc1: Linear [1024→8192]fc1 [1024→8192] +fc2: Linear [8192→1024]fc2 [8192→1024] +dropout: Dropoutdropout Dropout +act: ReLUact ReLU +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +layer_norm: LayerNorm 160layer_norm LayerNorm 160 +projection: Linear [160→1024]projection [160→1024] +dropout: Dropoutdropout Dropout +embed_positions: SeamlessM4TConformerRelPositionalEmbeddingembed_positions ConformerRelPositionalEmbedding +dropout: Dropoutdropout Dropout +ffn1_layer_norm: LayerNorm 1024ffn1_layer_norm LayerNorm 1024 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [1024→4096]intermediate_dense [1024→4096] +intermediate_act_fn: SiLUintermediate_act_fn SiLU +output_dense: Linear [4096→1024]output_dense [4096→1024] +output_dropout: Dropoutoutput_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +self_attn_dropout: Dropoutself_attn_dropout Dropout +linear_q: Linear [1024→1024]linear_q [1024→1024] +linear_k: Linear [1024→1024]linear_k [1024→1024] +linear_v: Linear [1024→1024]linear_v [1024→1024] +linear_out: Linear [1024→1024]linear_out [1024→1024] +dropout: Dropoutdropout Dropout +linear_pos: Linear [1024→1024]linear_pos [1024→1024] +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +pointwise_conv1: Conv1d 1024→2048 k1pointwise_conv1 Conv1d 1024→2048 k1 +glu: GLUglu GLU +depthwise_conv: Conv1d 1024→1024 k31 g1024depthwise_conv Conv1d 1024→1024 k31 g1024 +batch_norm: BatchNorm1d 1024batch_norm BatchNorm1d 1024 +activation: SiLUactivation SiLU +pointwise_conv2: Conv1d 1024→1024 k1pointwise_conv2 Conv1d 1024→1024 k1 +dropout: Dropoutdropout Dropout +ffn2_layer_norm: LayerNorm 1024ffn2_layer_norm LayerNorm 1024 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [1024→4096]intermediate_dense [1024→4096] +intermediate_act_fn: SiLUintermediate_act_fn SiLU +output_dense: Linear [4096→1024]output_dense [4096→1024] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 1024final_layer_norm LayerNorm 1024 +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [1024→4096]intermediate_dense [1024→4096] +intermediate_act_fn: ReLUintermediate_act_fn ReLU +output_dense: Linear [4096→1024]output_dense [4096→1024] +output_dropout: Dropoutoutput_dropout Dropout +residual_layer_norm: LayerNorm 1024residual_layer_norm LayerNorm 1024 +residual_conv: Conv1d 1024→2048 k8residual_conv Conv1d 1024→2048 k8 +activation: GLUactivation GLU +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +self_attn_conv: Conv1d 1024→2048 k8self_attn_conv Conv1d 1024→2048 k8 +self_attn: SeamlessM4TConformerSelfAttentionself_attn ConformerSelfAttention +self_attn_dropout: Dropoutself_attn_dropout Dropout +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn: SeamlessM4TConformerFeedForwardffn ConformerFeedForward +inner_layer_norm: LayerNorm 1024inner_layer_norm LayerNorm 1024 +embed_tokens: SeamlessM4TScaledWordEmbedding [256102×1024]embed_tokens ScaledWordEmbedding [256102×1024] +embed_positions: SeamlessM4TSinusoidalPositionalEmbeddingembed_positions SinusoidalPositionalEmbedding +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +activation_fn: ReLUactivation_fn ReLU +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +cross_attention_layer_norm: LayerNorm 1024cross_attention_layer_norm LayerNorm 1024 +fc1: Linear [1024→8192]fc1 [1024→8192] +fc2: Linear [8192→1024]fc2 [8192→1024] +dropout: Dropoutdropout Dropout +act: ReLUact ReLU +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +lm_head · Linear +self_attn: SeamlessM4TAttentionself_attn Attention +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +ffn: SeamlessM4TFeedForwardNetworkffn FeedForwardNetwork +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +embed_tokens: SeamlessM4TScaledWordEmbedding [10082×1024]embed_tokens ScaledWordEmbedding [10082×1024] +embed_positions: SeamlessM4TSinusoidalPositionalEmbeddingembed_positions SinusoidalPositionalEmbedding +self_attn: SeamlessM4TAttentionself_attn Attention +activation_fn: ReLUactivation_fn ReLU +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +cross_attention: SeamlessM4TAttentioncross_attention Attention +cross_attention_layer_norm: LayerNorm 1024cross_attention_layer_norm LayerNorm 1024 +ffn: SeamlessM4TFeedForwardNetworkffn FeedForwardNetwork +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +lm_head: Linear [1024→10082]lm_head [1024→10082] +conv1: Conv1d 1280→1280 k3conv1 Conv1d 1280→1280 k3 +activation_function: ReLUactivation_function ReLU +ln1: LayerNorm 1280ln1 LayerNorm 1280 +dropout_module: Dropoutdropout_module Dropout +conv2: Conv1d 1280→1280 k3conv2 Conv1d 1280→1280 k3 +ln2: LayerNorm 1280ln2 LayerNorm 1280 +proj: Linear [1280→1]proj [1280→1] +unit_embedding: Embedding [10000×1280]unit_embedding Embedding [10000×1280] +speaker_embedding: Embedding [200×256]speaker_embedding Embedding [200×256] +language_embedding: Embedding [36×256]language_embedding Embedding [36×256] +conv_pre: Conv1d 1792→512 k7conv_pre Conv1d 1792→512 k7 +upsampler: 5× ConvTranspose1dupsampler 5× ConvTranspose1d +convs1: 3× Conv1dconvs1 3× Conv1d +convs2: 3× Conv1dconvs2 3× Conv1d +conv_post: Conv1d 16→1 k7conv_post Conv1d 16→1 k7 model id facebook/hf-seamless-m4t-medi… @@ -173,16 +301,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/seamless_m4t_v2.svg b/seamless_m4t_v2.svg index b7b95b9746ee499d8f6c3be095342b6256d072cb..57a6ba4ad43f5af09d3f16bba752daf8c140866c 100644 --- a/seamless_m4t_v2.svg +++ b/seamless_m4t_v2.svg @@ -1,4 +1,4 @@ - + - + seamless_m4t_v2 -ssm · 24× Mamba - -SeamlessM4Tv2Model · base model -24 × SeamlessM4Tv2EncoderLayerSeamlessM4Tv2EncoderLayer× 24 -SeamlessM4Tv2ForTextToText · task head -Self-Attention · SeamlessM4Tv2Attention -MLP · SeamlessM4Tv2FeedForwardNetwork - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [256102 × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -out_proj: Linear [1024→1024]out_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -fc1: Linear [1024→8192]fc1 [1024→8192] -fc2: Linear [8192→1024]fc2 [8192→1024] -dropout: Dropoutdropout Dropout -act: ReLUact ReLU -residual add+ -Final LayerNorm[1, 6, 1024] -SeamlessM4Tv2ForTextToTextLM HeadLinear [1024→256102] · tied -Softmax -logits[1, 6, 256102] +SeamlessM4Tv2Model · staged data flow (structure) +speech_encoder · SpeechEncoder +encoder · SeamlessM4Tv2ConformerEncoder +t2u_model · TextToUnitForConditionalGeneration +layers · 24× SeamlessM4Tv2ConformerEncoderLayer +model · SeamlessM4Tv2TextToUnitModel +text_decoder · Decoder +decoder · SeamlessM4Tv2TextToUnitDecoder +layers · 24× SeamlessM4Tv2DecoderLayer +text_encoder · Encoder +vocoder · CodeHifiGan +layers · 24× SeamlessM4Tv2EncoderLayer +adapter · SeamlessM4Tv2ConformerAdapter +conv_module · SeamlessM4Tv2ConformerConvolutionModule +layers · ModuleList +encoder · SeamlessM4Tv2Encoder +0 · SeamlessM4Tv2ConformerAdapterLayer +hifi_gan · SeamlessM4Tv2HifiGan +dur_predictor · SeamlessM4Tv2VariancePredictor +duration_predictor · SeamlessM4Tv2VariancePredictor +layers · 6× SeamlessM4Tv2TextToUnitDecoderLayer +intermediate_ffn · SeamlessM4Tv2ConformerFeedForward +ffn1 · SeamlessM4Tv2ConformerFeedForward +self_attn · SeamlessM4Tv2ConformerSelfAttention +ffn2 · SeamlessM4Tv2ConformerFeedForward +layers · 6× SeamlessM4Tv2EncoderLayer +feature_projection · SeamlessM4Tv2ConformerFeatureProjection +self_attn · SeamlessM4Tv2Attention +ffn · SeamlessM4Tv2FeedForwardNetwork +self_attn · SeamlessM4Tv2Attention +cross_attention · SeamlessM4Tv2Attention +ffn · SeamlessM4Tv2FeedForwardNetwork +resblocks · 15× HifiGanResidualBlock + + + + + + + +inputsinput_ids / pixel_values / input_values +shared · Embedding +embed_tokens: SeamlessM4Tv2ScaledWordEmbedding [256102×1024]embed_tokens ScaledWordEmbedding [256102×1024] +embed_positions: SeamlessM4Tv2SinusoidalPositionalEmbeddingembed_positions SinusoidalPositionalEmbedding +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +fc1: Linear [1024→8192]fc1 [1024→8192] +fc2: Linear [8192→1024]fc2 [8192→1024] +dropout: Dropoutdropout Dropout +act: ReLUact ReLU +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +layer_norm: LayerNorm 160layer_norm LayerNorm 160 +projection: Linear [160→1024]projection [160→1024] +dropout: Dropoutdropout Dropout +dropout: Dropoutdropout Dropout +ffn1_layer_norm: LayerNorm 1024ffn1_layer_norm LayerNorm 1024 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [1024→4096]intermediate_dense [1024→4096] +intermediate_act_fn: SiLUintermediate_act_fn SiLU +output_dense: Linear [4096→1024]output_dense [4096→1024] +output_dropout: Dropoutoutput_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +self_attn_dropout: Dropoutself_attn_dropout Dropout +linear_q: Linear [1024→1024]linear_q [1024→1024] +linear_k: Linear [1024→1024]linear_k [1024→1024] +linear_v: Linear [1024→1024]linear_v [1024→1024] +linear_out: Linear [1024→1024]linear_out [1024→1024] +dropout: Dropoutdropout Dropout +distance_embedding: Embedding [73×64]distance_embedding Embedding [73×64] +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +pointwise_conv1: Conv1d 1024→2048 k1pointwise_conv1 Conv1d 1024→2048 k1 +glu: GLUglu GLU +depthwise_conv: Conv1d 1024→1024 k31 g1024depthwise_conv Conv1d 1024→1024 k31 g1024 +depthwise_layer_norm: LayerNorm 1024depthwise_layer_norm LayerNorm 1024 +activation: SiLUactivation SiLU +pointwise_conv2: Conv1d 1024→1024 k1pointwise_conv2 Conv1d 1024→1024 k1 +dropout: Dropoutdropout Dropout +ffn2_layer_norm: LayerNorm 1024ffn2_layer_norm LayerNorm 1024 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [1024→4096]intermediate_dense [1024→4096] +intermediate_act_fn: SiLUintermediate_act_fn SiLU +output_dense: Linear [4096→1024]output_dense [4096→1024] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 1024final_layer_norm LayerNorm 1024 +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [1024→4096]intermediate_dense [1024→4096] +intermediate_act_fn: ReLUintermediate_act_fn ReLU +output_dense: Linear [4096→1024]output_dense [4096→1024] +output_dropout: Dropoutoutput_dropout Dropout +residual_layer_norm: LayerNorm 1024residual_layer_norm LayerNorm 1024 +residual_conv: Conv1d 1024→2048 k8residual_conv Conv1d 1024→2048 k8 +activation: GLUactivation GLU +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +self_attn_conv: Conv1d 1024→2048 k8self_attn_conv Conv1d 1024→2048 k8 +self_attn: SeamlessM4Tv2ConformerSelfAttentionself_attn ConformerSelfAttention +self_attn_dropout: Dropoutself_attn_dropout Dropout +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn: SeamlessM4Tv2ConformerFeedForwardffn ConformerFeedForward +inner_layer_norm: LayerNorm 1024inner_layer_norm LayerNorm 1024 +embed_tokens: SeamlessM4Tv2ScaledWordEmbedding [256102×1024]embed_tokens ScaledWordEmbedding [256102×1024] +embed_positions: SeamlessM4Tv2SinusoidalPositionalEmbeddingembed_positions SinusoidalPositionalEmbedding +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +activation_fn: ReLUactivation_fn ReLU +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +cross_attention_layer_norm: LayerNorm 1024cross_attention_layer_norm LayerNorm 1024 +fc1: Linear [1024→8192]fc1 [1024→8192] +fc2: Linear [8192→1024]fc2 [8192→1024] +dropout: Dropoutdropout Dropout +act: ReLUact ReLU +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +lm_head · Linear +self_attn: SeamlessM4Tv2Attentionself_attn Attention +attn_dropout: Dropoutattn_dropout Dropout +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +ffn: SeamlessM4Tv2FeedForwardNetworkffn FeedForwardNetwork +ffn_layer_norm: LayerNorm 1024ffn_layer_norm LayerNorm 1024 +ffn_dropout: Dropoutffn_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +embed_tokens: Embedding [10082×1024]embed_tokens Embedding [10082×1024] +embed_char: Embedding [10943×1024]embed_char Embedding [10943×1024] +embed_char_positions: SeamlessM4Tv2SinusoidalPositionalEmbeddingembed_char_positions SinusoidalPositionalEmbedding +conv1: Conv1d 1024→256 k3conv1 Conv1d 1024→256 k3 +activation_function: ReLUactivation_function ReLU +ln1: LayerNorm 256ln1 LayerNorm 256 +dropout_module: Dropoutdropout_module Dropout +conv2: Conv1d 256→256 k3conv2 Conv1d 256→256 k3 +ln2: LayerNorm 256ln2 LayerNorm 256 +proj: Linear [256→1]proj [256→1] +embed_positions: SeamlessM4Tv2SinusoidalPositionalEmbeddingembed_positions SinusoidalPositionalEmbedding +self_attn: SeamlessM4Tv2Attentionself_attn Attention +self_attn_layer_norm: LayerNorm 1024self_attn_layer_norm LayerNorm 1024 +conv1: Conv1d 1024→1024 k7conv1 Conv1d 1024→1024 k7 +activation_fn: ReLUactivation_fn ReLU +conv2: Conv1d 1024→1024 k7conv2 Conv1d 1024→1024 k7 +conv_layer_norm: LayerNorm 1024conv_layer_norm LayerNorm 1024 +conv_dropout: Dropoutconv_dropout Dropout +layer_norm: LayerNorm 1024layer_norm LayerNorm 1024 +lm_head: Linear [1024→10082]lm_head [1024→10082] +conv1: Conv1d 1280→1280 k3conv1 Conv1d 1280→1280 k3 +activation_function: ReLUactivation_function ReLU +ln1: LayerNorm 1280ln1 LayerNorm 1280 +dropout_module: Dropoutdropout_module Dropout +conv2: Conv1d 1280→1280 k3conv2 Conv1d 1280→1280 k3 +ln2: LayerNorm 1280ln2 LayerNorm 1280 +proj: Linear [1280→1]proj [1280→1] +unit_embedding: Embedding [10000×1280]unit_embedding Embedding [10000×1280] +speaker_embedding: Embedding [200×256]speaker_embedding Embedding [200×256] +language_embedding: Embedding [36×256]language_embedding Embedding [36×256] +conv_pre: Conv1d 1792→512 k7conv_pre Conv1d 1792→512 k7 +upsampler: 5× ConvTranspose1dupsampler 5× ConvTranspose1d +convs1: 3× Conv1dconvs1 3× Conv1d +convs2: 3× Conv1dconvs2 3× Conv1d +conv_post: Conv1d 16→1 k7conv_post Conv1d 16→1 k7 model id facebook/hf-seamless-m4t-medi… @@ -173,16 +308,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/squeezebert.svg b/squeezebert.svg index aff6c92fccc8fb20b332dffc9427640fbcf08a66..7a4565e7bb79f3971a3d88d90db6e90489689a95 100644 --- a/squeezebert.svg +++ b/squeezebert.svg @@ -1,4 +1,4 @@ - + - + squeezebert -dense · 12× MHA - -SqueezeBertModel · base model -12 × SqueezeBertModuleSqueezeBertModule× 12 -SqueezeBertForMaskedLM · task head -Self-Attention · SqueezeBertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -ConvDropoutLayerNormpre-attention [1, 6, 768] -query: Conv1d 768×192×1query Conv1d 768×192×1 -key: Conv1d 768×192×1key Conv1d 768×192×1 -value: Conv1d 768×192×1value Conv1d 768×192×1 -dropout: Dropoutdropout Dropout -softmax: Softmaxsoftmax Softmax -matmul_qk: MatMulWrappermatmul_qk MatMulWrapper -matmul_qkv: MatMulWrappermatmul_qkv MatMulWrapper -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -SqueezeBertForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -SqueezeBertForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +SqueezeBertModel · staged data flow (structure) +encoder · Encoder +layers · 12× SqueezeBertModule +attention · SqueezeBertSelfAttention +embeddings · Embeddings +pooler · Pooler +intermediate · ConvActivation + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Conv1d 768→768 k1 g4query Conv1d 768→768 k1 g4 +key: Conv1d 768→768 k1 g4key Conv1d 768→768 k1 g4 +value: Conv1d 768→768 k1 g4value Conv1d 768→768 k1 g4 +dropout: Dropoutdropout Dropout +softmax: Softmaxsoftmax Softmax +matmul_qk: MatMulWrappermatmul_qk MatMulWrapper +matmul_qkv: MatMulWrappermatmul_qkv MatMulWrapper +post_attention: ConvDropoutLayerNormpost_attention ConvDropoutLayerNorm +conv1d: Conv1d 768→3072 k1 g4conv1d Conv1d 768→3072 k1 g4 +act: GELUActivationact GELU +output: ConvDropoutLayerNormoutput ConvDropoutLayerNorm +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id squeezebert/squeezebert-uncas… @@ -169,16 +167,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/superglue.svg b/superglue.svg index 1bc1012454d068f45ecb8e9bbe17f3ace9ad20a8..af7f1f83a7ee0e8776005efcd82becb34c3961c9 100644 --- a/superglue.svg +++ b/superglue.svg @@ -1,4 +1,4 @@ - + - + superglue -dense · 18× MHA - -SuperGlueForKeypointMatching · base model -18 × SuperGlueAttentionalPropagationSuperGlueAttentionalPropagation× 18 -Self-Attention · SuperGlueAttention -MLP · ModuleList -0 · SuperGlueMultiLayerPerceptron -self · SuperGlueSelfAttention -output · SuperGlueSelfOutput - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -Normpre-attention [1, 6, 256] -query: Linear [256→256]query [256→256] -key: Linear [256→256]key [256→256] -value: Linear [256→256]value [256→256] -dropout: Dropoutdropout Dropout -dense: Linear [256→256]dense [256→256] -scaled dot-product attention4 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Normpre-FFN [1, 6, 256] -linear: Linear [512→512]linear [512→512] -batch_norm: BatchNorm1d 512batch_norm BatchNorm1d 512 -activation: ReLUactivation ReLU -1: Linear [512→256]1 [512→256] -residual add+ -Final BatchNorm1d[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +SuperGlueForKeypointMatching · staged data flow (structure) +gnn · AttentionalGNN +layers · 18× SuperGlueAttentionalPropagation +keypoint_detector · SuperPointForKeypointDetection +keypoint_encoder · KeypointEncoder +attention · SuperGlueAttention +encoder · ModuleList [5] +mlp · ModuleList [2] +encoder · SuperPointEncoder +keypoint_decoder · SuperPointInterestPointDecoder +descriptor_decoder · SuperPointDescriptorDecoder +conv_blocks · 4× SuperPointConvBlock +[0:4] · 4× SuperGlueMultiLayerPerceptron +self · SuperGlueSelfAttention +0 · SuperGlueMultiLayerPerceptron +final_projection · FinalProjection +output · SuperGlueSelfOutput + + + + +inputsinput_ids / pixel_values / input_values +conv_a: Conv2d 1→64 k3×3conv_a Conv2d 1→64 k3×3 +conv_b: Conv2d 64→64 k3×3conv_b Conv2d 64→64 k3×3 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_score_a: Conv2d 128→256 k3×3conv_score_a Conv2d 128→256 k3×3 +conv_score_b: Conv2d 256→65 k1×1conv_score_b Conv2d 256→65 k1×1 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_descriptor_a: Conv2d 128→256 k3×3conv_descriptor_a Conv2d 128→256 k3×3 +conv_descriptor_b: Conv2d 256→256 k1×1conv_descriptor_b Conv2d 256→256 k1×1 +linear: Linear [3→32]linear [3→32] +batch_norm: BatchNorm1d 32batch_norm BatchNorm1d 32 +activation: ReLUactivation ReLU +4: Linear [256→256]4 [256→256] +query: Linear [256→256]query [256→256] +key: Linear [256→256]key [256→256] +value: Linear [256→256]value [256→256] +dropout: Dropoutdropout Dropout +dense: Linear [256→256]dense [256→256] +linear: Linear [512→512]linear [512→512] +batch_norm: BatchNorm1d 512batch_norm BatchNorm1d 512 +activation: ReLUactivation ReLU +1: Linear [512→256]1 [512→256] +final_proj: Linear [256→256]final_proj [256→256] model id magic-leap-community/superglu… @@ -176,16 +186,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/superpoint.svg b/superpoint.svg index 4a8315ec466242d6bd97003e962e431e0539498a..36c315c37bfe7e47348a9e9f72e21851f3279bc9 100644 --- a/superpoint.svg +++ b/superpoint.svg @@ -1,4 +1,4 @@ - + - + superpoint -SuperPointForKeypointDetection · forward data flow (shapes from a dummy input pass) -encoder · Encoder → [1×128×8×8] -keypoint_decoder · InterestPointDecoder → [3600×2] -descriptor_decoder · DescriptorDecoder → [3600×256] -conv_blocks · 4× SuperPointConvBlock - - - -pixel_values [1, 3, 64, 64] -conv_a: Conv2d 1→64 k3×3conv_a Conv2d 1→64 k3×3 -conv_b: Conv2d 64→64 k3×3conv_b Conv2d 64→64 k3×3 -relu: ReLUrelu ReLU -pool: MaxPool2dpool MaxPool2d -relu: ReLUrelu ReLU -pool: MaxPool2dpool MaxPool2d -conv_score_a: Conv2d 128→256 k3×3conv_score_a Conv2d 128→256 k3×3 -conv_score_b: Conv2d 256→65 k1×1conv_score_b Conv2d 256→65 k1×1 -relu: ReLUrelu ReLU -pool: MaxPool2dpool MaxPool2d -conv_descriptor_a: Conv2d 128→256 k3×3conv_descriptor_a Conv2d 128→256 k3×3 -conv_descriptor_b: Conv2d 256→256 k1×1conv_descriptor_b Conv2d 256→256 k1×1 +SuperPointForKeypointDetection · staged data flow (structure) +encoder · Encoder +keypoint_decoder · InterestPointDecoder +descriptor_decoder · DescriptorDecoder +conv_blocks · 4× SuperPointConvBlock + + + +inputsinput_ids / pixel_values / input_values +conv_a: Conv2d 1→64 k3×3conv_a Conv2d 1→64 k3×3 +conv_b: Conv2d 64→64 k3×3conv_b Conv2d 64→64 k3×3 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_score_a: Conv2d 128→256 k3×3conv_score_a Conv2d 128→256 k3×3 +conv_score_b: Conv2d 256→65 k1×1conv_score_b Conv2d 256→65 k1×1 +relu: ReLUrelu ReLU +pool: MaxPool2dpool MaxPool2d +conv_descriptor_a: Conv2d 128→256 k3×3conv_descriptor_a Conv2d 128→256 k3×3 +conv_descriptor_b: Conv2d 256→256 k1×1conv_descriptor_b Conv2d 256→256 k1×1 model id magic-leap-community/superpoi… diff --git a/table_transformer.svg b/table_transformer.svg index 6048ebafc01e3a2bccba272db0aee4bda4dc34cc..2bea4f525655fee2e0ce87e9c758faa983b0ec41 100644 --- a/table_transformer.svg +++ b/table_transformer.svg @@ -1,4 +1,4 @@ - + - + table_transformer -dense · 6× MHA - -TableTransformerModel · base model -6 × TableTransformerEncoderLayerTableTransformerEncoderLayer× 6 -Self-Attention · TableTransformerAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 256] → [1, 6, 256] -LayerNormpre-attention [1, 6, 256] -k_proj: Linear [256→256]k_proj [256→256] -v_proj: Linear [256→256]v_proj [256→256] -q_proj: Linear [256→256]q_proj [256→256] -out_proj: Linear [256→256]out_proj [256→256] -scaled dot-product attention8 heads · head_dim 32 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 256] -LM HeadLinear [256→?] -Softmax -logits[1, 6, ?] +TableTransformerModel · staged data flow (structure) +backbone · ConvModel +conv_encoder · TableTransformerConvEncoder +model · FeatureListNet +decoder · Decoder +layers · 6× TableTransformerDecoderLayer +encoder · Encoder +layers · 6× TableTransformerEncoderLayer +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +self_attn · TableTransformerAttention +self_attn · TableTransformerAttention +encoder_attn · TableTransformerAttention + + + + + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: TableTransformerFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: TableTransformerFrozenBatchNorm2d 64bn1 FrozenBatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: TableTransformerFrozenBatchNorm2d 64bn2 FrozenBatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: TableTransformerFrozenBatchNorm2d 256bn3 FrozenBatchNorm2d 256 +act3: ReLUact3 ReLU +downsample: Sequential [2]downsample Sequential [2] +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: TableTransformerFrozenBatchNorm2d 128bn1 FrozenBatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: TableTransformerFrozenBatchNorm2d 128bn2 FrozenBatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: TableTransformerFrozenBatchNorm2d 512bn3 FrozenBatchNorm2d 512 +act3: ReLUact3 ReLU +downsample: Sequential [2]downsample Sequential [2] +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: TableTransformerFrozenBatchNorm2d 256bn1 FrozenBatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: TableTransformerFrozenBatchNorm2d 256bn2 FrozenBatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: TableTransformerFrozenBatchNorm2d 1024bn3 FrozenBatchNorm2d 1024 +act3: ReLUact3 ReLU +downsample: Sequential [2]downsample Sequential [2] +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: TableTransformerFrozenBatchNorm2d 512bn1 FrozenBatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: TableTransformerFrozenBatchNorm2d 512bn2 FrozenBatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: TableTransformerFrozenBatchNorm2d 2048bn3 FrozenBatchNorm2d 2048 +act3: ReLUact3 ReLU +downsample: Sequential [2]downsample Sequential [2] +position_embedding: TableTransformerSinePositionEmbeddingposition_embedding SinePositionEmbedding +input_projection · Conv2d +query_position_embeddings · Embedding +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +out_proj: Linear [256→256]out_proj [256→256] +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +activation_fn: ReLUactivation_fn ReLU +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +out_proj: Linear [256→256]out_proj [256→256] +activation_fn: ReLUactivation_fn ReLU +self_attn_layer_norm: LayerNorm 256self_attn_layer_norm LayerNorm 256 +k_proj: Linear [256→256]k_proj [256→256] +v_proj: Linear [256→256]v_proj [256→256] +q_proj: Linear [256→256]q_proj [256→256] +out_proj: Linear [256→256]out_proj [256→256] +encoder_attn_layer_norm: LayerNorm 256encoder_attn_layer_norm LayerNorm 256 +fc1: Linear [256→2048]fc1 [256→2048] +fc2: Linear [2048→256]fc2 [2048→256] +final_layer_norm: LayerNorm 256final_layer_norm LayerNorm 256 +layernorm: LayerNorm 256layernorm LayerNorm 256 model id microsoft/table-transformer-d… @@ -164,16 +239,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/tapas.svg b/tapas.svg index 260fab23bb5e0142f6db6a9fca5f124f06dab149..9fd5fbfe7d477a79b2bd3de1c8179c598bf72f00 100644 --- a/tapas.svg +++ b/tapas.svg @@ -1,4 +1,4 @@ - + - + tapas -dense · 12× MHA - -TapasModel · base model -12 × TapasLayerTapasLayer× 12 -TapasForMaskedLM · task head -Self-Attention · TapasAttention -output · TapasSelfOutput -self · TapasSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -Final LayerNorm[1, 6, 768] -TapasForMaskedLMPool (CLS / mean)[1, 6, 768] → [1, 768] -TapasForMaskedLMClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +TapasModel · staged data flow (structure) +encoder · Encoder +layer · 12× TapasLayer +embeddings · Embeddings +attention · TapasAttention +output · TapasOutput +self · TapasSelfAttention +output · TapasSelfOutput +pooler · Pooler +intermediate · TapasIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [1024×768]position_embeddings Embedding [1024×768] +token_type_embeddings_0: Embedding [3×768]token_type_embeddings_0 Embedding [3×768] +token_type_embeddings_1: Embedding [256×768]token_type_embeddings_1 Embedding [256×768] +token_type_embeddings_2: Embedding [256×768]token_type_embeddings_2 Embedding [256×768] +token_type_embeddings_3: Embedding [2×768]token_type_embeddings_3 Embedding [2×768] +token_type_embeddings_4: Embedding [256×768]token_type_embeddings_4 Embedding [256×768] +token_type_embeddings_5: Embedding [256×768]token_type_embeddings_5 Embedding [256×768] +token_type_embeddings_6: Embedding [10×768]token_type_embeddings_6 Embedding [10×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id google/tapas-base-finetuned-s… @@ -171,16 +177,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/timm_backbone.svg b/timm_backbone.svg index 3ef9ecc6988c10b9392da36e57d8b54bab588e57..a9516afb7f9c28e77252aa32b74831345e03c646 100644 --- a/timm_backbone.svg +++ b/timm_backbone.svg @@ -1,4 +1,4 @@ - + - + timm_backbone -TimmBackbone · forward data flow (shapes from a dummy input pass) -_backbone · FeatureListNet → [1×2048×2×2] -layer1 · 3× Bottleneck -layer2 · 4× Bottleneck -layer3 · 6× Bottleneck -layer4 · 3× Bottleneck -downsample · Sequential [2] -downsample · Sequential [2] -downsample · Sequential [2] -downsample · Sequential [2] - -pixel_values [1, 3, 64, 64] -conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 -bn1: BatchNorm2d 64bn1 BatchNorm2d 64 -act1: ReLUact1 ReLU -maxpool: MaxPool2dmaxpool MaxPool2d -conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 -bn1: BatchNorm2d 64bn1 BatchNorm2d 64 -act1: ReLUact1 ReLU -conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 -bn2: BatchNorm2d 64bn2 BatchNorm2d 64 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 -bn3: BatchNorm2d 256bn3 BatchNorm2d 256 -act3: ReLUact3 ReLU -0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 -1: BatchNorm2d 2561 BatchNorm2d 256 -conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 -bn1: BatchNorm2d 128bn1 BatchNorm2d 128 -act1: ReLUact1 ReLU -conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 -bn2: BatchNorm2d 128bn2 BatchNorm2d 128 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 -bn3: BatchNorm2d 512bn3 BatchNorm2d 512 -act3: ReLUact3 ReLU -0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 -1: BatchNorm2d 5121 BatchNorm2d 512 -conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 -bn1: BatchNorm2d 256bn1 BatchNorm2d 256 -act1: ReLUact1 ReLU -conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 -bn2: BatchNorm2d 256bn2 BatchNorm2d 256 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 -bn3: BatchNorm2d 1024bn3 BatchNorm2d 1024 -act3: ReLUact3 ReLU -0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 -1: BatchNorm2d 10241 BatchNorm2d 1024 -conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 -bn1: BatchNorm2d 512bn1 BatchNorm2d 512 -act1: ReLUact1 ReLU -conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 -bn2: BatchNorm2d 512bn2 BatchNorm2d 512 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 -bn3: BatchNorm2d 2048bn3 BatchNorm2d 2048 -act3: ReLUact3 ReLU -0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 -1: BatchNorm2d 20481 BatchNorm2d 2048 +TimmBackbone · staged data flow (structure) +_backbone · FeatureListNet +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + +inputsinput_ids / pixel_values / input_values +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: BatchNorm2d 64bn1 BatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: BatchNorm2d 64bn1 BatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: BatchNorm2d 64bn2 BatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: BatchNorm2d 256bn3 BatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: BatchNorm2d 128bn1 BatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: BatchNorm2d 128bn2 BatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: BatchNorm2d 512bn3 BatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: BatchNorm2d 5121 BatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: BatchNorm2d 256bn1 BatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: BatchNorm2d 256bn2 BatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: BatchNorm2d 1024bn3 BatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: BatchNorm2d 10241 BatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: BatchNorm2d 512bn1 BatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: BatchNorm2d 512bn2 BatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: BatchNorm2d 2048bn3 BatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: BatchNorm2d 20481 BatchNorm2d 2048 model id timm_backbone diff --git a/timm_wrapper.svg b/timm_wrapper.svg index 9b9e70d8d4486209db1de6d8ec298a06b0295c83..e9efdec59d380b2fb14ffaeb74d04bc957f4e11e 100644 --- a/timm_wrapper.svg +++ b/timm_wrapper.svg @@ -1,4 +1,4 @@ - + - + timm_wrapper -TimmWrapperModel · full module tree (no attention — shown structurally) -timm_model · ResNet -layer1 · 3× Bottleneck -layer2 · 4× Bottleneck -layer3 · 6× Bottleneck -layer4 · 3× Bottleneck -global_pool · SelectAdaptivePool2d -downsample · Sequential [2] -downsample · Sequential [2] -downsample · Sequential [2] -downsample · Sequential [2] -input imagepixel_values [1, 3, H, W] -conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 -bn1: BatchNorm2d 64bn1 BatchNorm2d 64 -act1: ReLUact1 ReLU -maxpool: MaxPool2dmaxpool MaxPool2d -conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 -bn1: BatchNorm2d 64bn1 BatchNorm2d 64 -act1: ReLUact1 ReLU -conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 -bn2: BatchNorm2d 64bn2 BatchNorm2d 64 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 -bn3: BatchNorm2d 256bn3 BatchNorm2d 256 -act3: ReLUact3 ReLU -0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 -1: BatchNorm2d 2561 BatchNorm2d 256 -conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 -bn1: BatchNorm2d 128bn1 BatchNorm2d 128 -act1: ReLUact1 ReLU -conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 -bn2: BatchNorm2d 128bn2 BatchNorm2d 128 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 -bn3: BatchNorm2d 512bn3 BatchNorm2d 512 -act3: ReLUact3 ReLU -0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 -1: BatchNorm2d 5121 BatchNorm2d 512 -conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 -bn1: BatchNorm2d 256bn1 BatchNorm2d 256 -act1: ReLUact1 ReLU -conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 -bn2: BatchNorm2d 256bn2 BatchNorm2d 256 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 -bn3: BatchNorm2d 1024bn3 BatchNorm2d 1024 -act3: ReLUact3 ReLU -0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 -1: BatchNorm2d 10241 BatchNorm2d 1024 -conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 -bn1: BatchNorm2d 512bn1 BatchNorm2d 512 -act1: ReLUact1 ReLU -conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 -bn2: BatchNorm2d 512bn2 BatchNorm2d 512 -drop_block: Identitydrop_block Identity -act2: ReLUact2 ReLU -aa: Identityaa Identity -conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 -bn3: BatchNorm2d 2048bn3 BatchNorm2d 2048 -act3: ReLUact3 ReLU -0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 -1: BatchNorm2d 20481 BatchNorm2d 2048 -pool: AdaptiveAvgPool2dpool AdaptiveAvgPool2d -flatten: Flattenflatten Flatten -fc: Identityfc Identity +TimmWrapperModel · staged data flow (structure) +timm_model · ResNet +layer1 · 3× Bottleneck +layer2 · 4× Bottleneck +layer3 · 6× Bottleneck +layer4 · 3× Bottleneck +global_pool · SelectAdaptivePool2d +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] +downsample · Sequential [2] + +input imagepixel_values [1, 3, H, W] +conv1: Conv2d 3→64 k7×7conv1 Conv2d 3→64 k7×7 +bn1: BatchNorm2d 64bn1 BatchNorm2d 64 +act1: ReLUact1 ReLU +maxpool: MaxPool2dmaxpool MaxPool2d +conv1: Conv2d 64→64 k1×1conv1 Conv2d 64→64 k1×1 +bn1: BatchNorm2d 64bn1 BatchNorm2d 64 +act1: ReLUact1 ReLU +conv2: Conv2d 64→64 k3×3conv2 Conv2d 64→64 k3×3 +bn2: BatchNorm2d 64bn2 BatchNorm2d 64 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 64→256 k1×1conv3 Conv2d 64→256 k1×1 +bn3: BatchNorm2d 256bn3 BatchNorm2d 256 +act3: ReLUact3 ReLU +0: Conv2d 64→256 k1×10 Conv2d 64→256 k1×1 +1: BatchNorm2d 2561 BatchNorm2d 256 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +bn1: BatchNorm2d 128bn1 BatchNorm2d 128 +act1: ReLUact1 ReLU +conv2: Conv2d 128→128 k3×3conv2 Conv2d 128→128 k3×3 +bn2: BatchNorm2d 128bn2 BatchNorm2d 128 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 128→512 k1×1conv3 Conv2d 128→512 k1×1 +bn3: BatchNorm2d 512bn3 BatchNorm2d 512 +act3: ReLUact3 ReLU +0: Conv2d 256→512 k1×10 Conv2d 256→512 k1×1 +1: BatchNorm2d 5121 BatchNorm2d 512 +conv1: Conv2d 512→256 k1×1conv1 Conv2d 512→256 k1×1 +bn1: BatchNorm2d 256bn1 BatchNorm2d 256 +act1: ReLUact1 ReLU +conv2: Conv2d 256→256 k3×3conv2 Conv2d 256→256 k3×3 +bn2: BatchNorm2d 256bn2 BatchNorm2d 256 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 256→1024 k1×1conv3 Conv2d 256→1024 k1×1 +bn3: BatchNorm2d 1024bn3 BatchNorm2d 1024 +act3: ReLUact3 ReLU +0: Conv2d 512→1024 k1×10 Conv2d 512→1024 k1×1 +1: BatchNorm2d 10241 BatchNorm2d 1024 +conv1: Conv2d 1024→512 k1×1conv1 Conv2d 1024→512 k1×1 +bn1: BatchNorm2d 512bn1 BatchNorm2d 512 +act1: ReLUact1 ReLU +conv2: Conv2d 512→512 k3×3conv2 Conv2d 512→512 k3×3 +bn2: BatchNorm2d 512bn2 BatchNorm2d 512 +drop_block: Identitydrop_block Identity +act2: ReLUact2 ReLU +aa: Identityaa Identity +conv3: Conv2d 512→2048 k1×1conv3 Conv2d 512→2048 k1×1 +bn3: BatchNorm2d 2048bn3 BatchNorm2d 2048 +act3: ReLUact3 ReLU +0: Conv2d 1024→2048 k1×10 Conv2d 1024→2048 k1×1 +1: BatchNorm2d 20481 BatchNorm2d 2048 +pool: AdaptiveAvgPool2dpool AdaptiveAvgPool2d +flatten: Flattenflatten Flatten +fc: Identityfc Identity model id timm/resnet50.a1_in1k diff --git a/tvp.svg b/tvp.svg index fdc9d6dc617682fd61359f3b67c73977ad5f93fc..5e72cabdf10d875dc0457e3154640964a68d36ec 100644 --- a/tvp.svg +++ b/tvp.svg @@ -1,4 +1,4 @@ - + - + tvp -dense · 12× MHA - -TvpModel · base model -12 × TvpEncodeLayerTvpEncodeLayer× 12 -Self-Attention · TvpAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -attn_dropout: Dropoutattn_dropout Dropout -dense: Linear [768→768]dense [768→768] -layer_norm: LayerNorm 768layer_norm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→30522] -Softmax -logits[1, 6, 30522] +TvpModel · staged data flow (structure) +encoder · Encoder +vision_model · VisionModel +layer · 12× TvpEncodeLayer +backbone · ResNetBackbone +visual_embeddings · VisualInputEmbedding +embedder · ResNetEmbeddings +attention · TvpAttention +embeddings · TextInputEmbeddings +encoder · ResNetEncoder +output · TvpOutputLayer +embedder · ResNetConvLayer +pooler · Pooler +intermediate · TvpIntermediate +stages · 4× ResNetStage + + + + + + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→64 k7×7convolution Conv2d 3→64 k7×7 +normalization: BatchNorm2d 64normalization BatchNorm2d 64 +activation: ReLUactivation ReLU +pooler: MaxPool2dpooler MaxPool2d +layers: Sequential [3]layers Sequential [3] +grid_encoder_conv: Conv2d 2048→768 k3×3grid_encoder_conv Conv2d 2048→768 k3×3 +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +row_position_embeddings: Embedding [100×768]row_position_embeddings Embedding [100×768] +col_position_embeddings: Embedding [100×768]col_position_embeddings Embedding [100×768] +token_type_embeddings: Embedding [1×768]token_type_embeddings Embedding [1×768] +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +attn_dropout: Dropoutattn_dropout Dropout +dense: Linear [768→768]dense [768→768] +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +dropout · Dropout +visual_prompter · FramePadPrompter model id Intel/tvp-base @@ -167,16 +194,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/unispeech.diff.svg b/unispeech.diff.svg index 7af931d9e4a62c5691f1e74fc14c69f1cd889151..615067a1e69549fecec063e25e904966741a19ae 100644 --- a/unispeech.diff.svg +++ b/unispeech.diff.svg @@ -1,4 +1,4 @@ - + - + unispeech diff vs wav2vec2 · 4 overridden · 22 added · 1 deleted · 3 new · 7 inherited-as-is - -UniSpeechModel · base model -12 × UniSpeechEncoderLayerUniSpeechEncoderLayer× 12 -UniSpeechForSequenceClassification · task head -Self-Attention · Wav2Vec2Attention ↩ inherited -MLP · Wav2Vec2FeedForward ↩ inherited - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -UniSpeechForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -UniSpeechForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +encoder · Encoder +layers · 12× Wav2Vec2EncoderLayer ↩ inherited +pos_conv_embed · Wav2Vec2PositionalConvEmbedding ↩ inherited +feed_forward · Wav2Vec2FeedForward ↩ inherited +feature_extractor · FeatureEncoder +attention · Wav2Vec2Attention ↩ inherited +feature_projection · FeatureProjection +conv_layers · ModuleList [7] + + + +input audioinput_values / input_features +0: UniSpeechGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× UniSpeechNoLayerNormConvLayer[1:7] 6× UniSpeechNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: UniSpeechSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id microsoft/unispeech-large-1500 diff --git a/unispeech.svg b/unispeech.svg index 7a0dcb6c2f8256511e533d0a7f9b51dccb9dc12a..cdbea1a26d535cbdc7ac5db493a1dbd47a132da7 100644 --- a/unispeech.svg +++ b/unispeech.svg @@ -1,4 +1,4 @@ - + - + unispeech -dense · 12× MHA - -UniSpeechModel · base model -12 × UniSpeechEncoderLayerUniSpeechEncoderLayer× 12 -UniSpeechForSequenceClassification · task head -Self-Attention · UniSpeechAttention -MLP · UniSpeechFeedForward - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -UniSpeechForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -UniSpeechForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +UniSpeechModel · staged data flow (structure) +encoder · Encoder +layers · 12× UniSpeechEncoderLayer +pos_conv_embed · UniSpeechPositionalConvEmbedding +feed_forward · UniSpeechFeedForward +feature_extractor · FeatureEncoder +attention · UniSpeechAttention +feature_projection · FeatureProjection +conv_layers · ModuleList [7] + + + +input audioinput_values / input_features +0: UniSpeechGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× UniSpeechNoLayerNormConvLayer[1:7] 6× UniSpeechNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: UniSpeechSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id microsoft/unispeech-large-150… @@ -169,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/unispeech_sat.diff.svg b/unispeech_sat.diff.svg index b15580274231ae440c75c39f15c37a95fc969248..278de53e6d32788b62cc903cf67c59147a862cfe 100644 --- a/unispeech_sat.diff.svg +++ b/unispeech_sat.diff.svg @@ -1,4 +1,4 @@ - + - + unispeech_sat diff vs wav2vec2 · 5 overridden · 23 added · 1 deleted · 3 new · 9 inherited-as-is - -UniSpeechSatModel · base model -12 × UniSpeechSatEncoderLayerUniSpeechSatEncoderLayer× 12 -UniSpeechSatForSequenceClassification · task head -Self-Attention · Wav2Vec2Attention ↩ inherited -MLP · Wav2Vec2FeedForward ↩ inherited - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -UniSpeechSatForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -UniSpeechSatForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +encoder · Encoder +layers · 12× Wav2Vec2EncoderLayer ↩ inherited +feature_extractor · FeatureEncoder +pos_conv_embed · Wav2Vec2PositionalConvEmbedding ↩ inherited +feed_forward · Wav2Vec2FeedForward ↩ inherited +conv_layers · ModuleList [7] +attention · Wav2Vec2Attention ↩ inherited +feature_projection · FeatureProjection + + + +input audioinput_values / input_features +0: UniSpeechSatGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× UniSpeechSatNoLayerNormConvLayer[1:7] 6× UniSpeechSatNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: UniSpeechSatSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id microsoft/unispeech-sat-base-1 diff --git a/unispeech_sat.svg b/unispeech_sat.svg index 5e157c3551c0d9b50d13bfe5fcc5f511b297464e..2fd3b6fd5f2b3c56174fe75e993fe4939ab131a6 100644 --- a/unispeech_sat.svg +++ b/unispeech_sat.svg @@ -1,4 +1,4 @@ - + - + unispeech_sat -dense · 12× MHA - -UniSpeechSatModel · base model -12 × UniSpeechSatEncoderLayerUniSpeechSatEncoderLayer× 12 -UniSpeechSatForSequenceClassification · task head -Self-Attention · UniSpeechSatAttention -MLP · UniSpeechSatFeedForward - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -UniSpeechSatForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -UniSpeechSatForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +UniSpeechSatModel · staged data flow (structure) +encoder · Encoder +layers · 12× UniSpeechSatEncoderLayer +feature_extractor · FeatureEncoder +pos_conv_embed · UniSpeechSatPositionalConvEmbedding +feed_forward · UniSpeechSatFeedForward +conv_layers · ModuleList [7] +attention · UniSpeechSatAttention +feature_projection · FeatureProjection + + + +input audioinput_values / input_features +0: UniSpeechSatGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× UniSpeechSatNoLayerNormConvLayer[1:7] 6× UniSpeechSatNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: UniSpeechSatSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id microsoft/unispeech-sat-base-… @@ -169,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/univnet.svg b/univnet.svg index 879f5f3e8ba5bc63fc7fea5e5662f0018e5be50f..191280ce928318a234a7a9277060fa5e0db50724 100644 --- a/univnet.svg +++ b/univnet.svg @@ -1,4 +1,4 @@ - + - + univnet -UnivNetModel · full module tree (no attention — shown structurally) -resblocks · 3× UnivNetLvcBlock -kernel_predictor · UnivNetKernelPredictor -resblocks · 4× UnivNetLvcResidualBlock -resblocks · 3× UnivNetKernelPredictorResidualBlock -inputsinput_ids / pixel_values / input_values -conv_pre: Conv1d 64→32 k7conv_pre Conv1d 64→32 k7 -convt_pre: ConvTranspose1dconvt_pre ConvTranspose1d -input_conv: Conv1d 100→64 k5input_conv Conv1d 100→64 k5 -dropout: Dropoutdropout Dropout -conv1: Conv1d 64→64 k3conv1 Conv1d 64→64 k3 -conv2: Conv1d 64→64 k3conv2 Conv1d 64→64 k3 -kernel_conv: Conv1d 64→24576 k3kernel_conv Conv1d 64→24576 k3 -bias_conv: Conv1d 64→256 k3bias_conv Conv1d 64→256 k3 -conv: Conv1d 32→32 k3conv Conv1d 32→32 k3 -conv_post: Conv1d 32→1 k7conv_post Conv1d 32→1 k7 +UnivNetModel · staged data flow (structure) +resblocks · 3× UnivNetLvcBlock +kernel_predictor · UnivNetKernelPredictor +resblocks · 4× UnivNetLvcResidualBlock +resblocks · 3× UnivNetKernelPredictorResidualBlock + + + +inputsinput_ids / pixel_values / input_values +conv_pre · Conv1d +convt_pre: ConvTranspose1dconvt_pre ConvTranspose1d +input_conv: Conv1d 100→64 k5input_conv Conv1d 100→64 k5 +dropout: Dropoutdropout Dropout +conv1: Conv1d 64→64 k3conv1 Conv1d 64→64 k3 +conv2: Conv1d 64→64 k3conv2 Conv1d 64→64 k3 +kernel_conv: Conv1d 64→24576 k3kernel_conv Conv1d 64→24576 k3 +bias_conv: Conv1d 64→256 k3bias_conv Conv1d 64→256 k3 +conv: Conv1d 32→32 k3conv Conv1d 32→32 k3 +conv_post · Conv1d model id dg845/univnet-dev diff --git a/uvdoc.diff.svg b/uvdoc.diff.svg index 6ef6dd982581284e6a58163a6616a7bdd6081602..25f4ae3fe160ec97fc46bd244933eeabeaa50692 100644 --- a/uvdoc.diff.svg +++ b/uvdoc.diff.svg @@ -1,4 +1,4 @@ - + - + uvdoc diff vs pp_lcnet (+pp_ocrv5_server_det) · 1 overridden · 46 added · 0 deleted · 12 new · 0 inherited-as-is -backbone · UVDocBackbone -head · UVDocHead -resnet · UVDocResNet -bridge · UVDocBridge -out_point_positions2D · UVDocPointPositions2D -resnet_down · 3× UVDocResNetStage -bridge · 6× UVDocBridgeBlock -layers · 3× UVDocResidualBlock -bridge_connector · UVDocConvLayer -resnet_head · 2× UVDocConvLayer -conv_down · UVDocConvLayer -blocks · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→32 k5×5convolution Conv2d 3→32 k5×5 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -conv_down: Identityconv_down Identity -conv_start: UVDocConvLayerconv_start ConvLayer -conv_final: UVDocConvLayerconv_final ConvLayer -act_fn: ReLUact_fn ReLU -0: UVDocConvLayer0 ConvLayer -convolution: Conv2d 768→128 k1×1convolution Conv2d 768→128 k1×1 -normalization: BatchNorm2d 128normalization BatchNorm2d 128 -activation: ReLUactivation ReLU -convolution: Conv2d 128→32 k5×5convolution Conv2d 128→32 k5×5 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: PReLU 1activation PReLU 1 -conv_up: Conv2d 32→2 k5×5conv_up Conv2d 32→2 k5×5 +backbone · Backbone +head · Head +resnet · UVDocResNet +out_point_positions2D · UVDocPointPositions2D +bridge · UVDocBridge +resnet_down · 3× UVDocResNetStage +bridge · 6× UVDocBridgeBlock +bridge_connector · UVDocConvLayer +resnet_head · 2× UVDocConvLayer +conv_down · UVDocConvLayer +layers · 3× UVDocResidualBlock +blocks · ModuleList + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k5×5convolution Conv2d 3→32 k5×5 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +conv_down: Identityconv_down Identity +conv_start: UVDocConvLayerconv_start ConvLayer +conv_final: UVDocConvLayerconv_final ConvLayer +act_fn: ReLUact_fn ReLU +0: UVDocConvLayer0 ConvLayer +convolution: Conv2d 768→128 k1×1convolution Conv2d 768→128 k1×1 +normalization: BatchNorm2d 128normalization BatchNorm2d 128 +activation: ReLUactivation ReLU +convolution: Conv2d 128→32 k5×5convolution Conv2d 128→32 k5×5 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: PReLU 1activation PReLU 1 +conv_up: Conv2d 32→2 k5×5conv_up Conv2d 32→2 k5×5 model id PaddlePaddle/UVDoc_safetensors diff --git a/uvdoc.svg b/uvdoc.svg index 4a12e21df5897974be7c3252a821ba6d299775d1..6bba4d27b3461742560f4d3c6656a741ee667716 100644 --- a/uvdoc.svg +++ b/uvdoc.svg @@ -1,4 +1,4 @@ - + - + uvdoc -UVDocModel · full module tree (no attention — shown structurally) -backbone · UVDocBackbone -head · UVDocHead -resnet · UVDocResNet -bridge · UVDocBridge -out_point_positions2D · UVDocPointPositions2D -resnet_down · 3× UVDocResNetStage -bridge · 6× UVDocBridgeBlock -layers · 3× UVDocResidualBlock -bridge_connector · UVDocConvLayer -resnet_head · 2× UVDocConvLayer -conv_down · UVDocConvLayer -blocks · ModuleList -inputsinput_ids / pixel_values / input_values -convolution: Conv2d 3→32 k5×5convolution Conv2d 3→32 k5×5 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: ReLUactivation ReLU -conv_down: Identityconv_down Identity -conv_start: UVDocConvLayerconv_start ConvLayer -conv_final: UVDocConvLayerconv_final ConvLayer -act_fn: ReLUact_fn ReLU -0: UVDocConvLayer0 ConvLayer -convolution: Conv2d 768→128 k1×1convolution Conv2d 768→128 k1×1 -normalization: BatchNorm2d 128normalization BatchNorm2d 128 -activation: ReLUactivation ReLU -convolution: Conv2d 128→32 k5×5convolution Conv2d 128→32 k5×5 -normalization: BatchNorm2d 32normalization BatchNorm2d 32 -activation: PReLU 1activation PReLU 1 -conv_up: Conv2d 32→2 k5×5conv_up Conv2d 32→2 k5×5 +UVDocModel · staged data flow (structure) +backbone · Backbone +head · Head +resnet · UVDocResNet +out_point_positions2D · UVDocPointPositions2D +bridge · UVDocBridge +resnet_down · 3× UVDocResNetStage +bridge · 6× UVDocBridgeBlock +bridge_connector · UVDocConvLayer +resnet_head · 2× UVDocConvLayer +conv_down · UVDocConvLayer +layers · 3× UVDocResidualBlock +blocks · ModuleList + + +inputsinput_ids / pixel_values / input_values +convolution: Conv2d 3→32 k5×5convolution Conv2d 3→32 k5×5 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: ReLUactivation ReLU +conv_down: Identityconv_down Identity +conv_start: UVDocConvLayerconv_start ConvLayer +conv_final: UVDocConvLayerconv_final ConvLayer +act_fn: ReLUact_fn ReLU +0: UVDocConvLayer0 ConvLayer +convolution: Conv2d 768→128 k1×1convolution Conv2d 768→128 k1×1 +normalization: BatchNorm2d 128normalization BatchNorm2d 128 +activation: ReLUactivation ReLU +convolution: Conv2d 128→32 k5×5convolution Conv2d 128→32 k5×5 +normalization: BatchNorm2d 32normalization BatchNorm2d 32 +activation: PReLU 1activation PReLU 1 +conv_up: Conv2d 32→2 k5×5conv_up Conv2d 32→2 k5×5 model id PaddlePaddle/UVDoc_safetensors diff --git a/vibevoice_asr.diff.svg b/vibevoice_asr.diff.svg index cdff8206b8735578b18800096a833b7dbea43346..02adf4a1d1661ed13f2d1fa9cca36e1db07dbfb9 100644 --- a/vibevoice_asr.diff.svg +++ b/vibevoice_asr.diff.svg @@ -1,4 +1,4 @@ - + - + vibevoice_asr diff vs qwen2 (+vibevoice_acoustic_tokenizer) · 4 overridden · 36 added · 0 deleted · 6 new · 1 inherited-as-is - -VibeVoiceAsrModel · base model -32 × Qwen2DecoderLayerQwen2DecoderLayer× 32 -VibeVoiceAsrForConditionalGeneration · task head -Self-Attention · Qwen2Attention -MLP · Qwen2MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [151936 × 4096] → [1, 6, 4096] -Qwen2RMSNormpre-attention [1, 6, 4096] -q_proj: Linear [4096→4096]q_proj [4096→4096] -k_proj: Linear [4096→4096]k_proj [4096→4096] -v_proj: Linear [4096→4096]v_proj [4096→4096] -o_proj: Linear [4096→4096]o_proj [4096→4096] -scaled dot-product attention32 heads · head_dim 128 -full_attention attention mask (q↓ × k→)full mask -RoPErotary positions → Q, K -residual add+ -Qwen2RMSNormpre-FFN [1, 6, 4096] -gate_proj: Linear [4096→22016]gate_proj [4096→22016] -up_proj: Linear [4096→22016]up_proj [4096→22016] -down_proj: Linear [22016→4096]down_proj [22016→4096] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 4096] -VibeVoiceAsrForConditionalGenerationLM HeadLinear [4096→151936] · tied -Softmax -logits[1, 6, 151936] +acoustic_tokenizer_encoder · VibeVoiceAcousticTokenizerEncoderModel +semantic_tokenizer_encoder · VibeVoiceAcousticTokenizerEncoderModel +language_model · Qwen2Model +stem · VibeVoiceAcousticTokenizerEncoderStem +conv_layers · 6× VibeVoiceAcousticTokenizerEncoderLayer +stem · VibeVoiceAcousticTokenizerEncoderStem +conv_layers · 6× VibeVoiceAcousticTokenizerEncoderLayer +layers · 32× Qwen2DecoderLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +multi_modal_projector · MultiModalProjector +self_attn · Qwen2Attention +mlp · Qwen2MLP +head · VibeVoiceAcousticTokenizerCausalConv1d +head · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d + + + + +inputsinput_ids / pixel_values / input_values +conv: Conv1d 1→32 k7conv Conv1d 1→32 k7 +norm: VibeVoiceAcousticTokenizerRMSNorm 32norm VibeVoiceAcousticTokenizerRMSNorm 32 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 32ffn_norm VibeVoiceAcousticTokenizerRMSNorm 32 +linear1: Linear [32→128]linear1 [32→128] +activation: GELUActivationactivation GELU +linear2: Linear [128→32]linear2 [128→32] +conv: Conv1d 32→32 k7 g32conv Conv1d 32→32 k7 g32 +conv: Conv1d 32→64 k4conv Conv1d 32→64 k4 +norm: VibeVoiceAcousticTokenizerRMSNorm 64norm VibeVoiceAcousticTokenizerRMSNorm 64 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 64ffn_norm VibeVoiceAcousticTokenizerRMSNorm 64 +linear1: Linear [64→256]linear1 [64→256] +activation: GELUActivationactivation GELU +linear2: Linear [256→64]linear2 [256→64] +conv: Conv1d 64→64 k7 g64conv Conv1d 64→64 k7 g64 +conv: Conv1d 2048→64 k7conv Conv1d 2048→64 k7 +conv: Conv1d 1→32 k7conv Conv1d 1→32 k7 +norm: VibeVoiceAcousticTokenizerRMSNorm 32norm VibeVoiceAcousticTokenizerRMSNorm 32 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 32ffn_norm VibeVoiceAcousticTokenizerRMSNorm 32 +linear1: Linear [32→128]linear1 [32→128] +activation: GELUActivationactivation GELU +linear2: Linear [128→32]linear2 [128→32] +conv: Conv1d 32→32 k7 g32conv Conv1d 32→32 k7 g32 +conv: Conv1d 32→64 k4conv Conv1d 32→64 k4 +norm: VibeVoiceAcousticTokenizerRMSNorm 64norm VibeVoiceAcousticTokenizerRMSNorm 64 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 64ffn_norm VibeVoiceAcousticTokenizerRMSNorm 64 +linear1: Linear [64→256]linear1 [64→256] +activation: GELUActivationactivation GELU +linear2: Linear [256→64]linear2 [256→64] +conv: Conv1d 64→64 k7 g64conv Conv1d 64→64 k7 g64 +conv: Conv1d 2048→128 k7conv Conv1d 2048→128 k7 +acoustic_linear_1: Linear [64→4096]acoustic_linear_1 [64→4096] +acoustic_norm: VibeVoiceAsrRMSNorm 4096acoustic_norm RMSNorm 4096 +acoustic_linear_2: Linear [4096→4096]acoustic_linear_2 [4096→4096] +semantic_linear_1: Linear [128→4096]semantic_linear_1 [128→4096] +semantic_norm: VibeVoiceAsrRMSNorm 4096semantic_norm RMSNorm 4096 +semantic_linear_2: Linear [4096→4096]semantic_linear_2 [4096→4096] +embed_tokens: Embedding [151936×4096]embed_tokens Embedding [151936×4096] +q_proj: Linear [4096→4096]q_proj [4096→4096] +k_proj: Linear [4096→4096]k_proj [4096→4096] +v_proj: Linear [4096→4096]v_proj [4096→4096] +o_proj: Linear [4096→4096]o_proj [4096→4096] +gate_proj: Linear [4096→22016]gate_proj [4096→22016] +up_proj: Linear [4096→22016]up_proj [4096→22016] +down_proj: Linear [22016→4096]down_proj [22016→4096] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: Qwen2RMSNorm 4096input_layernorm Qwen2RMSNorm 4096 +post_attention_layernorm: Qwen2RMSNorm 4096post_attention_layernorm Qwen2RMSNorm 4096 +norm: Qwen2RMSNorm 4096norm Qwen2RMSNorm 4096 +rotary_emb: Qwen2RotaryEmbeddingrotary_emb Qwen2RotaryEmbedding model id microsoft/VibeVoice-ASR-HF diff --git a/vibevoice_asr.svg b/vibevoice_asr.svg index e53e32ddfde600beb800721ed89b25bc626882ec..8fb52fc5c78c6c090d127323768260acfea42e00 100644 --- a/vibevoice_asr.svg +++ b/vibevoice_asr.svg @@ -1,4 +1,4 @@ - + - + vibevoice_asr -dense · 32× full - -VibeVoiceAsrModel · base model -32 × Qwen2DecoderLayerQwen2DecoderLayer× 32 -VibeVoiceAsrForConditionalGeneration · task head -Self-Attention · Qwen2Attention -MLP · Qwen2MLP - - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [151936 × 4096] → [1, 6, 4096] -Qwen2RMSNormpre-attention [1, 6, 4096] -q_proj: Linear [4096→4096]q_proj [4096→4096] -k_proj: Linear [4096→4096]k_proj [4096→4096] -v_proj: Linear [4096→4096]v_proj [4096→4096] -o_proj: Linear [4096→4096]o_proj [4096→4096] -scaled dot-product attention32 heads · head_dim 128 -full_attention attention mask (q↓ × k→)full mask -RoPErotary positions → Q, K -residual add+ -Qwen2RMSNormpre-FFN [1, 6, 4096] -gate_proj: Linear [4096→22016]gate_proj [4096→22016] -up_proj: Linear [4096→22016]up_proj [4096→22016] -down_proj: Linear [22016→4096]down_proj [22016→4096] -act_fn: SiLUActivationact_fn SiLU -residual add+ -Final RMSNorm[1, 6, 4096] -VibeVoiceAsrForConditionalGenerationLM HeadLinear [4096→151936] · tied -Softmax -logits[1, 6, 151936] +VibeVoiceAsrModel · staged data flow (structure) +acoustic_tokenizer_encoder · VibeVoiceAcousticTokenizerEncoderModel +semantic_tokenizer_encoder · VibeVoiceAcousticTokenizerEncoderModel +language_model · Qwen2Model +stem · VibeVoiceAcousticTokenizerEncoderStem +conv_layers · 6× VibeVoiceAcousticTokenizerEncoderLayer +stem · VibeVoiceAcousticTokenizerEncoderStem +conv_layers · 6× VibeVoiceAcousticTokenizerEncoderLayer +layers · 32× Qwen2DecoderLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +stage · 3× VibeVoiceAcousticTokenizerConvNext1dLayer +multi_modal_projector · MultiModalProjector +self_attn · Qwen2Attention +mlp · Qwen2MLP +head · VibeVoiceAcousticTokenizerCausalConv1d +head · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +conv · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d +ffn · VibeVoiceAcousticTokenizerFeedForward +mixer · VibeVoiceAcousticTokenizerCausalConv1d + + + + +inputsinput_ids / pixel_values / input_values +conv: Conv1d 1→32 k7conv Conv1d 1→32 k7 +norm: VibeVoiceAcousticTokenizerRMSNorm 32norm VibeVoiceAcousticTokenizerRMSNorm 32 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 32ffn_norm VibeVoiceAcousticTokenizerRMSNorm 32 +linear1: Linear [32→128]linear1 [32→128] +activation: GELUActivationactivation GELU +linear2: Linear [128→32]linear2 [128→32] +conv: Conv1d 32→32 k7 g32conv Conv1d 32→32 k7 g32 +conv: Conv1d 32→64 k4conv Conv1d 32→64 k4 +norm: VibeVoiceAcousticTokenizerRMSNorm 64norm VibeVoiceAcousticTokenizerRMSNorm 64 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 64ffn_norm VibeVoiceAcousticTokenizerRMSNorm 64 +linear1: Linear [64→256]linear1 [64→256] +activation: GELUActivationactivation GELU +linear2: Linear [256→64]linear2 [256→64] +conv: Conv1d 64→64 k7 g64conv Conv1d 64→64 k7 g64 +conv: Conv1d 2048→64 k7conv Conv1d 2048→64 k7 +conv: Conv1d 1→32 k7conv Conv1d 1→32 k7 +norm: VibeVoiceAcousticTokenizerRMSNorm 32norm VibeVoiceAcousticTokenizerRMSNorm 32 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 32ffn_norm VibeVoiceAcousticTokenizerRMSNorm 32 +linear1: Linear [32→128]linear1 [32→128] +activation: GELUActivationactivation GELU +linear2: Linear [128→32]linear2 [128→32] +conv: Conv1d 32→32 k7 g32conv Conv1d 32→32 k7 g32 +conv: Conv1d 32→64 k4conv Conv1d 32→64 k4 +norm: VibeVoiceAcousticTokenizerRMSNorm 64norm VibeVoiceAcousticTokenizerRMSNorm 64 +ffn_norm: VibeVoiceAcousticTokenizerRMSNorm 64ffn_norm VibeVoiceAcousticTokenizerRMSNorm 64 +linear1: Linear [64→256]linear1 [64→256] +activation: GELUActivationactivation GELU +linear2: Linear [256→64]linear2 [256→64] +conv: Conv1d 64→64 k7 g64conv Conv1d 64→64 k7 g64 +conv: Conv1d 2048→128 k7conv Conv1d 2048→128 k7 +acoustic_linear_1: Linear [64→4096]acoustic_linear_1 [64→4096] +acoustic_norm: VibeVoiceAsrRMSNorm 4096acoustic_norm RMSNorm 4096 +acoustic_linear_2: Linear [4096→4096]acoustic_linear_2 [4096→4096] +semantic_linear_1: Linear [128→4096]semantic_linear_1 [128→4096] +semantic_norm: VibeVoiceAsrRMSNorm 4096semantic_norm RMSNorm 4096 +semantic_linear_2: Linear [4096→4096]semantic_linear_2 [4096→4096] +embed_tokens: Embedding [151936×4096]embed_tokens Embedding [151936×4096] +q_proj: Linear [4096→4096]q_proj [4096→4096] +k_proj: Linear [4096→4096]k_proj [4096→4096] +v_proj: Linear [4096→4096]v_proj [4096→4096] +o_proj: Linear [4096→4096]o_proj [4096→4096] +gate_proj: Linear [4096→22016]gate_proj [4096→22016] +up_proj: Linear [4096→22016]up_proj [4096→22016] +down_proj: Linear [22016→4096]down_proj [22016→4096] +act_fn: SiLUActivationact_fn SiLU +input_layernorm: Qwen2RMSNorm 4096input_layernorm Qwen2RMSNorm 4096 +post_attention_layernorm: Qwen2RMSNorm 4096post_attention_layernorm Qwen2RMSNorm 4096 +norm: Qwen2RMSNorm 4096norm Qwen2RMSNorm 4096 +rotary_emb: Qwen2RotaryEmbeddingrotary_emb Qwen2RotaryEmbedding model id microsoft/VibeVoice-ASR-HF @@ -175,16 +222,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/videomt.diff.svg b/videomt.diff.svg index b1587e2f30af0f110f9c7ddd021ce0e202eaed1b..2d97a3a05fd058458c30f9369cf9ee88dce1a88d 100644 --- a/videomt.diff.svg +++ b/videomt.diff.svg @@ -1,4 +1,4 @@ - + - + videomt diff vs eomt · 9 overridden · 7 added · 1 deleted · 2 new · 7 inherited-as-is - -VideomtForUniversalSegmentation · base model -24 × VideomtLayerVideomtLayer× 24 -Self-Attention · EomtAttention ↩ inherited -MLP · EomtMLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -out_proj: Linear [1024→1024]out_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -fc1: Linear [1024→4096]fc1 [1024→4096] -activation: GELUActivationactivation GELU -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +layers · 24× EomtLayer ↩ inherited +embeddings · Embeddings +upscale_block · ScaleBlock +mask_head · MaskHead +attention · EomtAttention ↩ inherited +block · 2× EomtScaleLayer ↩ inherited +criterion · Loss +patch_embeddings · VideomtPatchEmbeddings +mlp · EomtMLP ↩ inherited + + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→1024 k16×16projection Conv2d 3→1024 k16×16 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [1600×1024]position_embeddings Embedding [1600×1024] +layernorm · LayerNorm +query · Embedding +norm1: LayerNorm 1024norm1 LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +layer_scale1: VideomtLayerScalelayer_scale1 LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 1024norm2 LayerNorm 1024 +fc1: Linear [1024→4096]fc1 [1024→4096] +activation: GELUActivationactivation GELU +fc2: Linear [4096→1024]fc2 [4096→1024] +layer_scale2: VideomtLayerScalelayer_scale2 LayerScale +conv1: ConvTranspose2dconv1 ConvTranspose2d +activation: GELUActivationactivation GELU +conv2: Conv2d 1024→1024 k3×3 g1024conv2 Conv2d 1024→1024 k3×3 g1024 +layernorm2d: VideomtLayerNorm2d 1024layernorm2d LayerNorm2d 1024 +fc1: Linear [1024→1024]fc1 [1024→1024] +fc2: Linear [1024→1024]fc2 [1024→1024] +fc3: Linear [1024→1024]fc3 [1024→1024] +activation: GELUActivationactivation GELU +class_predictor · Linear +matcher: VideomtHungarianMatchermatcher HungarianMatcher +query_updater · Linear model id tue-mps/videomt-dinov2-small-y diff --git a/videomt.svg b/videomt.svg index e7b7b64eddfc4ae65a003eba6789886a65283e96..22f5ce938b74be9acede67b2815962cf0e352a53 100644 --- a/videomt.svg +++ b/videomt.svg @@ -1,4 +1,4 @@ - + - + videomt -dense · 24× MHA - -VideomtForUniversalSegmentation · base model -24 × VideomtLayerVideomtLayer× 24 -Self-Attention · VideomtAttention -MLP · VideomtMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -q_proj: Linear [1024→1024]q_proj [1024→1024] -out_proj: Linear [1024→1024]out_proj [1024→1024] -scaled dot-product attention16 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -fc1: Linear [1024→4096]fc1 [1024→4096] -activation: GELUActivationactivation GELU -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +VideomtForUniversalSegmentation · staged data flow (structure) +layers · 24× VideomtLayer +embeddings · Embeddings +upscale_block · ScaleBlock +mask_head · MaskHead +attention · VideomtAttention +block · 2× VideomtScaleLayer +criterion · Loss +patch_embeddings · VideomtPatchEmbeddings +mlp · VideomtMLP + + + + + + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv2d 3→1024 k16×16projection Conv2d 3→1024 k16×16 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [1600×1024]position_embeddings Embedding [1600×1024] +layernorm · LayerNorm +query · Embedding +norm1: LayerNorm 1024norm1 LayerNorm 1024 +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +q_proj: Linear [1024→1024]q_proj [1024→1024] +out_proj: Linear [1024→1024]out_proj [1024→1024] +layer_scale1: VideomtLayerScalelayer_scale1 LayerScale +drop_path: Identitydrop_path Identity +norm2: LayerNorm 1024norm2 LayerNorm 1024 +fc1: Linear [1024→4096]fc1 [1024→4096] +activation: GELUActivationactivation GELU +fc2: Linear [4096→1024]fc2 [4096→1024] +layer_scale2: VideomtLayerScalelayer_scale2 LayerScale +conv1: ConvTranspose2dconv1 ConvTranspose2d +activation: GELUActivationactivation GELU +conv2: Conv2d 1024→1024 k3×3 g1024conv2 Conv2d 1024→1024 k3×3 g1024 +layernorm2d: VideomtLayerNorm2d 1024layernorm2d LayerNorm2d 1024 +fc1: Linear [1024→1024]fc1 [1024→1024] +fc2: Linear [1024→1024]fc2 [1024→1024] +fc3: Linear [1024→1024]fc3 [1024→1024] +activation: GELUActivationactivation GELU +class_predictor · Linear +matcher: VideomtHungarianMatchermatcher HungarianMatcher +query_updater · Linear model id tue-mps/videomt-dinov2-small-… @@ -171,16 +186,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/vilt.svg b/vilt.svg index 62f741913f09ca214a431fb56627071731954882..9ed0b3567eca10d941da74f78be361cda253c49a 100644 --- a/vilt.svg +++ b/vilt.svg @@ -1,4 +1,4 @@ - + - + vilt -dense · 12× MHA - -ViltModel · base model -12 × ViltLayerViltLayer× 12 -Self-Attention · ViltAttention -attention · ViltSelfAttention -output · ViltSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +ViltModel · staged data flow (structure) +encoder · Encoder +layer · 12× ViltLayer +embeddings · Embeddings +attention · ViltAttention +text_embeddings · TextEmbeddings +attention · ViltSelfAttention +pooler · Pooler +patch_embeddings · ViltPatchEmbeddings +intermediate · ViltIntermediate +output · ViltOutput +output · ViltSelfOutput + + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [40×768]position_embeddings Embedding [40×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +projection: Conv2d 3→768 k32×32projection Conv2d 3→768 k32×32 +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +dropout: Dropoutdropout Dropout +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +layernorm · LayerNorm +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id dandelin/vilt-b32-mlm @@ -168,16 +178,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/visual_bert.svg b/visual_bert.svg index 89a3722eaab6cd51ff8b9ba8b5b36bca97e168e5..43cec0770890e9ca644cbd111f2ede155de720b0 100644 --- a/visual_bert.svg +++ b/visual_bert.svg @@ -1,4 +1,4 @@ - + - + visual_bert -dense · 12× MHA - -VisualBertModel · base model -12 × VisualBertLayerVisualBertLayer× 12 -VisualBertForPreTraining · task head -Self-Attention · VisualBertAttention -output · VisualBertSelfOutput -self · VisualBertSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -VisualBertForPreTrainingLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +VisualBertModel · staged data flow (structure) +encoder · Encoder +layer · 12× VisualBertLayer +embeddings · Embeddings +attention · VisualBertAttention +output · VisualBertOutput +self · VisualBertSelfAttention +output · VisualBertSelfOutput +pooler · Pooler +intermediate · VisualBertIntermediate + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +visual_token_type_embeddings: Embedding [2×768]visual_token_type_embeddings Embedding [2×768] +visual_position_embeddings: Embedding [512×768]visual_position_embeddings Embedding [512×768] +visual_projection: Linear [512→768]visual_projection [512→768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id uclanlp/visualbert-vqa-coco-p… @@ -170,16 +174,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/vit.svg b/vit.svg index ace38119f7453ef5f57da113e0d6e6e02192927f..fb1292fe72301ead9bf2e9dfb88d5065253f511a 100644 --- a/vit.svg +++ b/vit.svg @@ -1,4 +1,4 @@ - + - + vit -dense · 12× MHA - -ViTModel · base model -12 × ViTLayerViTLayer× 12 -ViTForImageClassification · task head -Self-Attention · ViTAttention -MLP · ViTMLP - - -input imagepixel_values [1, 3, H, W] -Patch Embeddingconv patches → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -q_proj: Linear [768→768]q_proj [768→768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -o_proj: Linear [768→768]o_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [768→3072]fc1 [768→3072] -fc2: Linear [3072→768]fc2 [3072→768] -residual add+ -Final LayerNorm[1, 6, 768] -ViTForImageClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -ViTForImageClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +ViTModel · forward data flow (shapes from a dummy input pass) +embeddings · Embeddings → [1×197×768] +pooler · Pooler → [1×768] +patch_embeddings · ViTPatchEmbeddings + + + + +pixel_values [1, 3, 224, 224] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +layernorm · LayerNorm → [1×197×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×197×768] model id google/vit-base-patch16-224 @@ -167,16 +153,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/vits.svg b/vits.svg index 82db63844cc80c96d3371c63159eab363142b080..3da68447bb7b98aee8ae309fcf5906a25a05f64d 100644 --- a/vits.svg +++ b/vits.svg @@ -1,4 +1,4 @@ - + - + vits -dense · 6× MHA - -VitsModel · base model -6 × VitsEncoderLayerVitsEncoderLayer× 6 -Self-Attention · VitsAttention -MLP · VitsFeedForward - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [38 × 192] → [1, 6, 192] -LayerNormpre-attention [1, 6, 192] -k_proj: Linear [192→192]k_proj [192→192] -v_proj: Linear [192→192]v_proj [192→192] -q_proj: Linear [192→192]q_proj [192→192] -out_proj: Linear [192→192]out_proj [192→192] -scaled dot-product attention2 heads · head_dim 96 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 192] -conv_1: Conv1d 768×192×3conv_1 Conv1d 768×192×3 -conv_2: Conv1d 192×768×3conv_2 Conv1d 192×768×3 -dropout: Dropoutdropout Dropout -act_fn: ReLUact_fn ReLU -residual add+ -Final LayerNorm[1, 6, 192] -LM HeadLinear [192→38] -Softmax -logits[1, 6, 38] +VitsModel · staged data flow (structure) +duration_predictor · StochasticDurationPredictor +text_encoder · TextEncoder +encoder · VitsEncoder +flows · ModuleList [5] +post_flows · ModuleList [5] +layers · 6× VitsEncoderLayer +flow · ResidualCouplingBlock +[1:5] · 4× VitsConvFlow +[1:5] · 4× VitsConvFlow +posterior_encoder · PosteriorEncoder +flows · 4× VitsResidualCouplingLayer +decoder · HifiGan +conv_dds · VitsDilatedDepthSeparableConv +conv_dds · VitsDilatedDepthSeparableConv +conv_dds · VitsDilatedDepthSeparableConv +post_conv_dds · VitsDilatedDepthSeparableConv +wavenet · VitsWaveNet +wavenet · VitsWaveNet +attention · VitsAttention +feed_forward · VitsFeedForward +resblocks · 12× HifiGanResidualBlock + + + + + +inputsinput_ids / pixel_values / input_values +embed_tokens: Embedding [38×192]embed_tokens Embedding [38×192] +k_proj: Linear [192→192]k_proj [192→192] +v_proj: Linear [192→192]v_proj [192→192] +q_proj: Linear [192→192]q_proj [192→192] +out_proj: Linear [192→192]out_proj [192→192] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 192layer_norm LayerNorm 192 +conv_1: Conv1d 192→768 k3conv_1 Conv1d 192→768 k3 +conv_2: Conv1d 768→192 k3conv_2 Conv1d 768→192 k3 +dropout: Dropoutdropout Dropout +act_fn: ReLUact_fn ReLU +final_layer_norm: LayerNorm 192final_layer_norm LayerNorm 192 +project: Conv1d 192→384 k1project Conv1d 192→384 k1 +conv_pre: Conv1d 96→192 k1conv_pre Conv1d 96→192 k1 +in_layers: 4× ParametrizedConv1din_layers 4× ParametrizedConv1d +res_skip_layers: 4× ParametrizedConv1dres_skip_layers 4× ParametrizedConv1d +dropout: Dropoutdropout Dropout +conv_post: Conv1d 192→96 k1conv_post Conv1d 192→96 k1 +conv_pre: Conv1d 192→512 k7conv_pre Conv1d 192→512 k7 +upsampler: 4× ConvTranspose1dupsampler 4× ConvTranspose1d +convs1: 3× Conv1dconvs1 3× Conv1d +convs2: 3× Conv1dconvs2 3× Conv1d +conv_post: Conv1d 32→1 k7conv_post Conv1d 32→1 k7 +conv_pre: Conv1d 192→192 k1conv_pre Conv1d 192→192 k1 +conv_proj: Conv1d 192→192 k1conv_proj Conv1d 192→192 k1 +dropout: Dropoutdropout Dropout +convs_dilated: 3× Conv1dconvs_dilated 3× Conv1d +convs_pointwise: 3× Conv1dconvs_pointwise 3× Conv1d +norms_1: 3× LayerNormnorms_1 3× LayerNorm +norms_2: 3× LayerNormnorms_2 3× LayerNorm +0: VitsElementwiseAffine0 ElementwiseAffine +conv_pre: Conv1d 1→192 k1conv_pre Conv1d 1→192 k1 +dropout: Dropoutdropout Dropout +convs_dilated: 3× Conv1dconvs_dilated 3× Conv1d +convs_pointwise: 3× Conv1dconvs_pointwise 3× Conv1d +norms_1: 3× LayerNormnorms_1 3× LayerNorm +norms_2: 3× LayerNormnorms_2 3× LayerNorm +conv_proj: Conv1d 192→29 k1conv_proj Conv1d 192→29 k1 +post_conv_pre: Conv1d 1→192 k1post_conv_pre Conv1d 1→192 k1 +post_conv_proj: Conv1d 192→192 k1post_conv_proj Conv1d 192→192 k1 +dropout: Dropoutdropout Dropout +convs_dilated: 3× Conv1dconvs_dilated 3× Conv1d +convs_pointwise: 3× Conv1dconvs_pointwise 3× Conv1d +norms_1: 3× LayerNormnorms_1 3× LayerNorm +norms_2: 3× LayerNormnorms_2 3× LayerNorm +0: VitsElementwiseAffine0 ElementwiseAffine +conv_pre: Conv1d 1→192 k1conv_pre Conv1d 1→192 k1 +dropout: Dropoutdropout Dropout +convs_dilated: 3× Conv1dconvs_dilated 3× Conv1d +convs_pointwise: 3× Conv1dconvs_pointwise 3× Conv1d +norms_1: 3× LayerNormnorms_1 3× LayerNorm +norms_2: 3× LayerNormnorms_2 3× LayerNorm +conv_proj: Conv1d 192→29 k1conv_proj Conv1d 192→29 k1 +conv_pre: Conv1d 513→192 k1conv_pre Conv1d 513→192 k1 +in_layers: 16× ParametrizedConv1din_layers 16× ParametrizedConv1d +res_skip_layers: 16× ParametrizedConv1dres_skip_layers 16× ParametrizedConv1d +dropout: Dropoutdropout Dropout +conv_proj: Conv1d 192→384 k1conv_proj Conv1d 192→384 k1 model id facebook/mms-tts-eng @@ -172,16 +224,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/vivit.diff.svg b/vivit.diff.svg index cb5f317eba9a795b6b6f4914dc58676c07e0c5bf..57ae6e6b93be68f02d397251a0acc2a593bd25b5 100644 --- a/vivit.diff.svg +++ b/vivit.diff.svg @@ -1,4 +1,4 @@ - + - + vivit diff vs vit · 10 overridden · 4 added · 0 deleted · 2 new · 4 inherited-as-is - -VivitModel · base model -12 × VivitLayerVivitLayer× 12 -Self-Attention · ViTAttention ↩ inherited -MLP · ViTMLP ↩ inherited - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -q_proj: Linear [768→768]q_proj [768→768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -o_proj: Linear [768→768]o_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -activation_fn: FastGELUActivationactivation_fn FastGELU -fc1: Linear [768→3072]fc1 [768→3072] -fc2: Linear [3072→768]fc2 [3072→768] -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→?] -Softmax -logits[1, 6, ?] +layers · 12× ViTLayer ↩ inherited +embeddings · Embeddings +attention · ViTAttention ↩ inherited +pooler · Pooler +patch_embeddings · VivitTubeletEmbeddings +mlp · ViTMLP ↩ inherited + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv3d 3→768 k2×16×16projection Conv3d 3→768 k2×16×16 +dropout: Dropoutdropout Dropout +q_proj: Linear [768→768]q_proj [768→768] +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +o_proj: Linear [768→768]o_proj [768→768] +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +activation_fn: FastGELUActivationactivation_fn FastGELU +fc1: Linear [768→3072]fc1 [768→3072] +fc2: Linear [3072→768]fc2 [3072→768] +dropout: Dropoutdropout Dropout +layernorm · LayerNorm +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id google/vivit-b-16x2-kinetics40 diff --git a/vivit.svg b/vivit.svg index 3ccd74b418819d893d9eb32fce533e37884c9ad1..6d5929015e979f9ad21e648b925edbbc6f7e16f5 100644 --- a/vivit.svg +++ b/vivit.svg @@ -1,4 +1,4 @@ - + - + vivit -dense · 12× MHA - -VivitModel · base model -12 × VivitLayerVivitLayer× 12 -Self-Attention · VivitAttention -MLP · VivitMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -q_proj: Linear [768→768]q_proj [768→768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -o_proj: Linear [768→768]o_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -activation_fn: FastGELUActivationactivation_fn FastGELU -fc1: Linear [768→3072]fc1 [768→3072] -fc2: Linear [3072→768]fc2 [3072→768] -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→?] -Softmax -logits[1, 6, ?] +VivitModel · staged data flow (structure) +layers · 12× VivitLayer +embeddings · Embeddings +attention · VivitAttention +pooler · Pooler +patch_embeddings · VivitTubeletEmbeddings +mlp · VivitMLP + + + + +inputsinput_ids / pixel_values / input_values +projection: Conv3d 3→768 k2×16×16projection Conv3d 3→768 k2×16×16 +dropout: Dropoutdropout Dropout +q_proj: Linear [768→768]q_proj [768→768] +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +o_proj: Linear [768→768]o_proj [768→768] +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +activation_fn: FastGELUActivationactivation_fn FastGELU +fc1: Linear [768→3072]fc1 [768→3072] +fc2: Linear [3072→768]fc2 [3072→768] +dropout: Dropoutdropout Dropout +layernorm · LayerNorm +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id google/vivit-b-16x2-kinetics4… @@ -171,16 +165,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/wav2vec2.svg b/wav2vec2.svg index b307ddc132529aa6dc56c1b4639adba750216f69..9dabf3277c2e6d9be936df31a573ac19e1058f94 100644 --- a/wav2vec2.svg +++ b/wav2vec2.svg @@ -1,4 +1,4 @@ - + - + wav2vec2 -dense · 12× MHA - -Wav2Vec2Model · base model -12 × Wav2Vec2EncoderLayerWav2Vec2EncoderLayer× 12 -Wav2Vec2ForSequenceClassification · task head -Self-Attention · Wav2Vec2Attention -MLP · Wav2Vec2FeedForward - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 10, 768]+ position embeddings -LayerNormpre-attention [1, 10, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 10, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 10, 768] -Wav2Vec2ForSequenceClassificationPool (CLS / mean)[1, 10, 768] → [1, 768] -Wav2Vec2ForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +Wav2Vec2Model · staged data flow (structure) +encoder · Encoder +layers · 12× Wav2Vec2EncoderLayer +feature_extractor · FeatureEncoder +pos_conv_embed · Wav2Vec2PositionalConvEmbedding +feed_forward · Wav2Vec2FeedForward +conv_layers · ModuleList [7] +attention · Wav2Vec2Attention +feature_projection · FeatureProjection + + + +input audioinput_values / input_features +0: Wav2Vec2GroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× Wav2Vec2NoLayerNormConvLayer[1:7] 6× Wav2Vec2NoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: Wav2Vec2SamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id facebook/wav2vec2-base-960h @@ -169,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/wav2vec2_conformer.diff.svg b/wav2vec2_conformer.diff.svg index ea7b7a971dacafbeb37af2419e81da8017b2550a..c2ee19c3b963a0f56e790b2f4f6e93b971b89fee 100644 --- a/wav2vec2_conformer.diff.svg +++ b/wav2vec2_conformer.diff.svg @@ -1,4 +1,4 @@ - + - + wav2vec2_conformer diff vs wav2vec2 · 6 overridden · 31 added · 2 deleted · 8 new · 7 inherited-as-is - -Wav2Vec2ConformerModel · base model -12 × Wav2Vec2ConformerEncoderLayerWav2Vec2ConformerEncoderLayer× 12 -Wav2Vec2ConformerForSequenceClassification · task head -Self-Attention · Wav2Vec2ConformerSelfAttention -MLP · Wav2Vec2FeedForward ↩ inherited - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -linear_q: Linear [768→768]linear_q [768→768] -linear_k: Linear [768→768]linear_k [768→768] -linear_v: Linear [768→768]linear_v [768→768] -linear_out: Linear [768→768]linear_out [768→768] -dropout: Dropoutdropout Dropout -linear_pos: Linear [768→768]linear_pos [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -gelu -down_proj -residual add+ -Final LayerNorm[1, 6, 768] -Wav2Vec2ConformerForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -Wav2Vec2ConformerForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +encoder · Encoder +layers · 12× Wav2Vec2ConformerEncoderLayer +conv_module · Wav2Vec2ConformerConvolutionModule +feature_extractor · FeatureEncoder +pos_conv_embed · Wav2Vec2PositionalConvEmbedding ↩ inherited +ffn1 · Wav2Vec2FeedForward ↩ inherited +ffn2 · Wav2Vec2FeedForward ↩ inherited +conv_layers · ModuleList [7] +self_attn · Wav2Vec2ConformerSelfAttention +feature_projection · FeatureProjection + + + +input audioinput_values / input_features +0: Wav2Vec2ConformerGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× Wav2Vec2ConformerNoLayerNormConvLayer[1:7] 6× Wav2Vec2ConformerNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +embed_positions: Wav2Vec2ConformerRelPositionalEmbeddingembed_positions RelPositionalEmbedding +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: Wav2Vec2ConformerSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +ffn1_layer_norm: LayerNorm 768ffn1_layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +self_attn_layer_norm: LayerNorm 768self_attn_layer_norm LayerNorm 768 +self_attn_dropout: Dropoutself_attn_dropout Dropout +linear_q: Linear [768→768]linear_q [768→768] +linear_k: Linear [768→768]linear_k [768→768] +linear_v: Linear [768→768]linear_v [768→768] +linear_out: Linear [768→768]linear_out [768→768] +dropout: Dropoutdropout Dropout +linear_pos: Linear [768→768]linear_pos [768→768] +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +pointwise_conv1: Conv1d 768→1536 k1pointwise_conv1 Conv1d 768→1536 k1 +glu: GLUglu GLU +depthwise_conv: Conv1d 768→768 k31 g768depthwise_conv Conv1d 768→768 k31 g768 +batch_norm: BatchNorm1d 768batch_norm BatchNorm1d 768 +activation: GELUActivationactivation GELU +pointwise_conv2: Conv1d 768→768 k1pointwise_conv2 Conv1d 768→768 k1 +dropout: Dropoutdropout Dropout +ffn2_layer_norm: LayerNorm 768ffn2_layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id facebook/wav2vec2-conformer-re diff --git a/wav2vec2_conformer.svg b/wav2vec2_conformer.svg index 91b69866a6d7b043bdc04cf5a901e87cfeff16fd..7532f80013dffa5a72a5cb47d8563a4647e4fbee 100644 --- a/wav2vec2_conformer.svg +++ b/wav2vec2_conformer.svg @@ -1,4 +1,4 @@ - + - + wav2vec2_conformer -dense · 12× MHA - -Wav2Vec2ConformerModel · base model -12 × Wav2Vec2ConformerEncoderLayerWav2Vec2ConformerEncoderLayer× 12 -Wav2Vec2ConformerForSequenceClassification · task head -Self-Attention · Wav2Vec2ConformerSelfAttention -MLP · Wav2Vec2ConformerFeedForward - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -linear_q: Linear [768→768]linear_q [768→768] -linear_k: Linear [768→768]linear_k [768→768] -linear_v: Linear [768→768]linear_v [768→768] -linear_out: Linear [768→768]linear_out [768→768] -dropout: Dropoutdropout Dropout -linear_pos: Linear [768→768]linear_pos [768→768] -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -gelu -down_proj -residual add+ -Final LayerNorm[1, 6, 768] -Wav2Vec2ConformerForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -Wav2Vec2ConformerForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +Wav2Vec2ConformerModel · staged data flow (structure) +encoder · Encoder +layers · 12× Wav2Vec2ConformerEncoderLayer +conv_module · Wav2Vec2ConformerConvolutionModule +feature_extractor · FeatureEncoder +pos_conv_embed · Wav2Vec2ConformerPositionalConvEmbedding +ffn1 · Wav2Vec2ConformerFeedForward +ffn2 · Wav2Vec2ConformerFeedForward +conv_layers · ModuleList [7] +self_attn · Wav2Vec2ConformerSelfAttention +feature_projection · FeatureProjection + + + +input audioinput_values / input_features +0: Wav2Vec2ConformerGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× Wav2Vec2ConformerNoLayerNormConvLayer[1:7] 6× Wav2Vec2ConformerNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +embed_positions: Wav2Vec2ConformerRelPositionalEmbeddingembed_positions RelPositionalEmbedding +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: Wav2Vec2ConformerSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +ffn1_layer_norm: LayerNorm 768ffn1_layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +self_attn_layer_norm: LayerNorm 768self_attn_layer_norm LayerNorm 768 +self_attn_dropout: Dropoutself_attn_dropout Dropout +linear_q: Linear [768→768]linear_q [768→768] +linear_k: Linear [768→768]linear_k [768→768] +linear_v: Linear [768→768]linear_v [768→768] +linear_out: Linear [768→768]linear_out [768→768] +dropout: Dropoutdropout Dropout +linear_pos: Linear [768→768]linear_pos [768→768] +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +pointwise_conv1: Conv1d 768→1536 k1pointwise_conv1 Conv1d 768→1536 k1 +glu: GLUglu GLU +depthwise_conv: Conv1d 768→768 k31 g768depthwise_conv Conv1d 768→768 k31 g768 +batch_norm: BatchNorm1d 768batch_norm BatchNorm1d 768 +activation: GELUActivationactivation GELU +pointwise_conv2: Conv1d 768→768 k1pointwise_conv2 Conv1d 768→768 k1 +dropout: Dropoutdropout Dropout +ffn2_layer_norm: LayerNorm 768ffn2_layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id facebook/wav2vec2-conformer-r… @@ -168,16 +193,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/wavlm.diff.svg b/wavlm.diff.svg index 734271012ad048d9a76ff4f15704ea3405ad92f0..98dd09b4b6b29086a6721bae774eee1be960d136 100644 --- a/wavlm.diff.svg +++ b/wavlm.diff.svg @@ -1,4 +1,4 @@ - + - + wavlm diff vs wav2vec2 · 9 overridden · 16 added · 3 deleted · 6 new · 8 inherited-as-is - -WavLMModel · base model -12 × WavLMEncoderLayerWavLMEncoderLayer× 12 -WavLMForSequenceClassification · task head -Self-Attention · WavLMAttention -MLP · Wav2Vec2FeedForward ↩ inherited - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -gru_rel_pos_linear: Linear [64→8]gru_rel_pos_linear [64→8] -rel_attn_embed: Embedding 320×12rel_attn_embed Embedding 320×12 -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -WavLMForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -WavLMForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +encoder · Encoder +layers · 12× WavLMEncoderLayer +pos_conv_embed · Wav2Vec2PositionalConvEmbedding ↩ inherited +attention · WavLMAttention +feed_forward · Wav2Vec2FeedForward ↩ inherited +feature_extractor · FeatureEncoder +feature_projection · FeatureProjection +conv_layers · ModuleList [7] + + + +input audioinput_values / input_features +0: WavLMGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× WavLMNoLayerNormConvLayer[1:7] 6× WavLMNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: WavLMSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +gru_rel_pos_linear: Linear [64→8]gru_rel_pos_linear [64→8] +rel_attn_embed: Embedding [320×12]rel_attn_embed Embedding [320×12] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id microsoft/wavlm-base diff --git a/wavlm.svg b/wavlm.svg index 102e749c231a2dcad8b2c8d714707a8cfeb7a952..2b8e7fe8ec7a6f0cb5ae450bbd9256fb91ecb082 100644 --- a/wavlm.svg +++ b/wavlm.svg @@ -1,4 +1,4 @@ - + - + wavlm -dense · 12× MHA - -WavLMModel · base model -12 × WavLMEncoderLayerWavLMEncoderLayer× 12 -WavLMForSequenceClassification · task head -Self-Attention · WavLMAttention -MLP · WavLMFeedForward - - -input audioinput_features [1, n_mels, T] -Feature Projectionconv/linear → [1, 6, 768]+ position embeddings -LayerNormpre-attention [1, 6, 768] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -gru_rel_pos_linear: Linear [64→8]gru_rel_pos_linear [64→8] -rel_attn_embed: Embedding 320×12rel_attn_embed Embedding 320×12 -scaled dot-product attention12 heads · head_dim 64 -bidirectional attention mask (q↓ × k→)bidirectional mask -residual add+ -LayerNormpre-FFN [1, 6, 768] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 768] -WavLMForSequenceClassificationPool (CLS / mean)[1, 6, 768] → [1, 768] -WavLMForSequenceClassificationClassifier headLinear [768→2] -Softmax -class logits[1, 2] (2 classes) +WavLMModel · staged data flow (structure) +encoder · Encoder +layers · 12× WavLMEncoderLayer +pos_conv_embed · WavLMPositionalConvEmbedding +attention · WavLMAttention +feed_forward · WavLMFeedForward +feature_extractor · FeatureEncoder +feature_projection · FeatureProjection +conv_layers · ModuleList [7] + + + +input audioinput_values / input_features +0: WavLMGroupNormConvLayer0 GroupNormConvLayer +[1:7]: 6× WavLMNoLayerNormConvLayer[1:7] 6× WavLMNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 51… +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: WavLMSamePadLayerpadding SamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +gru_rel_pos_linear: Linear [64→8]gru_rel_pos_linear [64→8] +rel_attn_embed: Embedding [320×12]rel_attn_embed Embedding [320×12] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 model id microsoft/wavlm-base @@ -171,16 +175,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/xcodec.svg b/xcodec.svg index b4cba0a1f437c505168e6f1c6ee913ae3e30ebc4..63c2dc1134a62d895939b51c43468a17222e0e88 100644 --- a/xcodec.svg +++ b/xcodec.svg @@ -1,4 +1,4 @@ - + - + xcodec -dense · 12× Attention - -XcodecModel · base model -12 × HubertEncoderLayerHubertEncoderLayer× 12 -Self-Attention · HubertAttention -MLP · HubertFeedForward - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 1024] → [1, 6, 1024] -LayerNormpre-attention [1, 6, 1024] -k_proj: Linear [768→768]k_proj [768→768] -v_proj: Linear [768→768]v_proj [768→768] -q_proj: Linear [768→768]q_proj [768→768] -out_proj: Linear [768→768]out_proj [768→768] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, 1024] -intermediate_dropout: Dropoutintermediate_dropout Dropout -intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] -intermediate_act_fn: GELUActivationintermediate_act_fn GELU -output_dense: Linear [3072→768]output_dense [3072→768] -output_dropout: Dropoutoutput_dropout Dropout -residual add+ -Final LayerNorm[1, 6, 1024] -LM HeadLinear [1024→?] -Softmax -logits[1, 6, ?] +XcodecModel · forward data flow (shapes from a dummy input pass) +semantic_model · HubertModel → [1×25×768] +encoder · HubertEncoder +acoustic_encoder · DacEncoder → [1×256×25] +acoustic_decoder · DacDecoder → [1×1×8000] +block · 4× DacEncoderBlock +block · 4× DacDecoderBlock +layers · 12× HubertEncoderLayer +encoder_semantic · SemanticEncoder → [1×768×25] +conv_blocks · 2× XcodecSemanticEncoderBlock +pos_conv_embed · HubertPositionalConvEmbedding +feed_forward · HubertFeedForward +feature_extractor · HubertFeatureEncoder +feature_projection · HubertFeatureProjection +res_units · 2× XcodecResidualUnit +res_unit1 · DacResidualUnit +res_unit2 · DacResidualUnit +res_unit3 · DacResidualUnit +res_unit1 · DacResidualUnit +res_unit2 · DacResidualUnit +res_unit3 · DacResidualUnit +attention · HubertAttention +conv_layers · ModuleList [7] + + + + + + + +input_values [1, 1, 8000] +0: HubertGroupNormConvLayer0 HubertGroupNormConvLayer +[1:7]: 6× HubertNoLayerNormConvLayer[1:7] 6× HubertNoLayerNormConvLayer +layer_norm: LayerNorm 512layer_norm LayerNorm 512 +projection: Linear [512→768]projection [512→768] +dropout: Dropoutdropout Dropout +conv: ParametrizedConv1d 768→768 k128 g16conv ParametrizedConv1d 768→768 k128 g16 +padding: HubertSamePadLayerpadding HubertSamePadLayer +activation: GELUActivationactivation GELU +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +dropout: Dropoutdropout Dropout +k_proj: Linear [768→768]k_proj [768→768] +v_proj: Linear [768→768]v_proj [768→768] +q_proj: Linear [768→768]q_proj [768→768] +out_proj: Linear [768→768]out_proj [768→768] +dropout: Dropoutdropout Dropout +layer_norm: LayerNorm 768layer_norm LayerNorm 768 +intermediate_dropout: Dropoutintermediate_dropout Dropout +intermediate_dense: Linear [768→3072]intermediate_dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +output_dense: Linear [3072→768]output_dense [3072→768] +output_dropout: Dropoutoutput_dropout Dropout +final_layer_norm: LayerNorm 768final_layer_norm LayerNorm 768 +conv: Conv1d 768→768 k3conv Conv1d 768→768 k3 +activation: ELUactivation ELU +conv1: Conv1d 768→768 k3conv1 Conv1d 768→768 k3 +conv2: Conv1d 768→768 k1conv2 Conv1d 768→768 k1 +conv: Conv1d 768→768 k3conv Conv1d 768→768 k3 +conv1: Conv1d 1→64 k7conv1 Conv1d 1→64 k7 +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 64→64 k7conv1 Conv1d 64→64 k7 +snake2: Snake1dsnake2 Snake1d +conv2: Conv1d 64→64 k1conv2 Conv1d 64→64 k1 +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 64→64 k7conv1 Conv1d 64→64 k7 +snake2: Snake1dsnake2 Snake1d +conv2: Conv1d 64→64 k1conv2 Conv1d 64→64 k1 +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 64→64 k7conv1 Conv1d 64→64 k7 +snake2: Snake1dsnake2 Snake1d +conv2: Conv1d 64→64 k1conv2 Conv1d 64→64 k1 +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 64→128 k16conv1 Conv1d 64→128 k16 +snake1: Snake1dsnake1 Snake1d +conv2: Conv1d 1024→256 k3conv2 Conv1d 1024→256 k3 +fc · Linear → [1×25×1024] +fc2 · Linear → [1×25×256] +conv1: Conv1d 256→1024 k7conv1 Conv1d 256→1024 k7 +snake1: Snake1dsnake1 Snake1d +conv_t1: ConvTranspose1dconv_t1 ConvTranspose1d +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 512→512 k7conv1 Conv1d 512→512 k7 +snake2: Snake1dsnake2 Snake1d +conv2: Conv1d 512→512 k1conv2 Conv1d 512→512 k1 +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 512→512 k7conv1 Conv1d 512→512 k7 +snake2: Snake1dsnake2 Snake1d +conv2: Conv1d 512→512 k1conv2 Conv1d 512→512 k1 +snake1: Snake1dsnake1 Snake1d +conv1: Conv1d 512→512 k7conv1 Conv1d 512→512 k7 +snake2: Snake1dsnake2 Snake1d +conv2: Conv1d 512→512 k1conv2 Conv1d 512→512 k1 +snake1: Snake1dsnake1 Snake1d +conv2: Conv1d 64→1 k7conv2 Conv1d 64→1 k7 +tanh: Identitytanh Identity +output [1×1×8000] model id Manel/X-Codec @@ -173,16 +234,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/xlm.svg b/xlm.svg index 7bf4aed7c845d484fec86af398ccd77f1a06c7dc..162492a6b14cab03f6f4e97ba379be6077a55404 100644 --- a/xlm.svg +++ b/xlm.svg @@ -1,4 +1,4 @@ - + - + xlm -dense · 12× MHA - -XLMModel · base model -12 × ModuleListModuleList× 12 -XLMWithLMHeadModel · task head -Self-Attention · MultiHeadAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey</w>'hey<…0 -token 1: ',</w>',</w>1 -token 2: 'how</w>'how<…2 -token 3: 'are</w>'are<…3 -token 4: 'you</w>'you<…4 -token 5: '?</w>'?</w>5 -Token Embeddingweight [30145 × 2048] → [1, 6, 2048] -Normpre-attention [1, 6, 2048] -q_lin: Linear [2048→2048]q_lin [2048→2048] -k_lin: Linear [2048→2048]k_lin [2048→2048] -v_lin: Linear [2048→2048]v_lin [2048→2048] -out_lin: Linear [2048→2048]out_lin [2048→2048] -scaled dot-product attention16 heads · head_dim 128 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 2048] -XLMWithLMHeadModelLM HeadLinear [2048→30145] · tied -Softmax -logits[1, 6, 30145] +XLMModel · staged data flow (structure) +attentions · 12× MultiHeadAttention +ffns · 12× TransformerFFN + + + + + + + +inputsinput_ids / pixel_values / input_values +position_embeddings · Embedding +embeddings · Embedding +layer_norm_emb · LayerNorm +q_lin: Linear [2048→2048]q_lin [2048→2048] +k_lin: Linear [2048→2048]k_lin [2048→2048] +v_lin: Linear [2048→2048]v_lin [2048→2048] +out_lin: Linear [2048→2048]out_lin [2048→2048] +layer_norm1 · 12× LayerNorm +lin1: Linear [2048→8192]lin1 [2048→8192] +lin2: Linear [8192→2048]lin2 [8192→2048] +act: GELUActivationact GELU +layer_norm2 · 12× LayerNorm model id FacebookAI/xlm-mlm-en-2048 @@ -165,16 +161,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/xlm_roberta.diff.svg b/xlm_roberta.diff.svg index bd593defd6f2a6ccdb274e162caec1a531061e38..d28c992263a9f31580d9b9b0887574c4907ffc06 100644 --- a/xlm_roberta.diff.svg +++ b/xlm_roberta.diff.svg @@ -1,4 +1,4 @@ - + - + xlm_roberta diff vs roberta · 15 overridden · 0 added · 0 deleted · 0 new · 1 inherited-as-is - -XLMRobertaModel · base model -12 × XLMRobertaLayerXLMRobertaLayer× 12 -XLMRobertaForCausalLM · task head -Self-Attention · RobertaAttention ↩ inherited -output · RobertaSelfOutput ↩ inherited -self · RobertaSelfAttention ↩ inherited - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey</w>'hey<…0 -token 1: ',</w>',</w>1 -token 2: 'how</w>'how<…2 -token 3: 'are</w>'are<…3 -token 4: 'you</w>'you<…4 -token 5: '?</w>'?</w>5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -XLMRobertaForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +encoder · Encoder → [1×8×768] +layer · 12× RobertaLayer ↩ inherited +attention · RobertaAttention ↩ inherited +embeddings · Embeddings → [1×8×768] +output · RobertaOutput ↩ inherited +self · RobertaSelfAttention ↩ inherited +output · RobertaSelfOutput ↩ inherited +pooler · Pooler → [1×768] +intermediate · RobertaIntermediate ↩ inherited + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id FacebookAI/xlm-mlm-en-2048 diff --git a/xlm_roberta.svg b/xlm_roberta.svg index cafa617f561c0581068b4aa1fb15a3b9d2782ac5..9385fe3db3fb9b8608680543f28552ae0eb85bb6 100644 --- a/xlm_roberta.svg +++ b/xlm_roberta.svg @@ -1,4 +1,4 @@ - + - + xlm_roberta -dense · 12× MHA - -XLMRobertaModel · base model -12 × XLMRobertaLayerXLMRobertaLayer× 12 -XLMRobertaForCausalLM · task head -Self-Attention · XLMRobertaAttention -output · XLMRobertaSelfOutput -self · XLMRobertaSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'hey</w>'hey<…0 -token 1: ',</w>',</w>1 -token 2: 'how</w>'how<…2 -token 3: 'are</w>'are<…3 -token 4: 'you</w>'you<…4 -token 5: '?</w>'?</w>5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -XLMRobertaForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +XLMRobertaModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×768] +layer · 12× XLMRobertaLayer +attention · XLMRobertaAttention +embeddings · Embeddings → [1×8×768] +output · XLMRobertaOutput +self · XLMRobertaSelfAttention +output · XLMRobertaSelfOutput +pooler · Pooler → [1×768] +intermediate · XLMRobertaIntermediate + + + + +input_ids [1, 8] +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×8×768] model id FacebookAI/xlm-mlm-en-2048 @@ -170,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/xlm_roberta_xl.diff.svg b/xlm_roberta_xl.diff.svg index 62e85927d280de3316f0da7187b22ac98c615f65..805aa2fae1ae4fd0812aa4cef1563e13a3bb3980 100644 --- a/xlm_roberta_xl.diff.svg +++ b/xlm_roberta_xl.diff.svg @@ -1,4 +1,4 @@ - + - + xlm_roberta_xl diff vs bert (+roberta) · 7 overridden · 26 added · 0 deleted · 10 new · 4 inherited-as-is - -XLMRobertaXLModel · base model -36 × XLMRobertaXLLayerXLMRobertaXLLayer× 36 -XLMRobertaXLForCausalLM · task head -Self-Attention · XLMRobertaXLAttention -self · BertSelfAttention ↩ inherited -output · XLMRobertaXLSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [250880 × 2560] → [1, 6, 2560] -LayerNormpre-attention [1, 6, 2560] -query: Linear [2560→2560]query [2560→2560] -key: Linear [2560→2560]key [2560→2560] -value: Linear [2560→2560]value [2560→2560] -dropout: Dropoutdropout Dropout -dense: Linear [2560→2560]dense [2560→2560] -dropout: Dropoutdropout Dropout -self_attn_layer_norm: LayerNorm 2560self_attn_layer_norm LayerNorm 2560 -scaled dot-product attention32 heads · head_dim 80 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 2560] -XLMRobertaXLForCausalLMLM HeadLinear [2560→250880] · tied -Softmax -logits[1, 6, 250880] +encoder · Encoder → [1×8×2560] +layer · 36× XLMRobertaXLLayer +attention · XLMRobertaXLAttention +embeddings · Embeddings → [1×8×2560] +self · BertSelfAttention ↩ inherited +pooler · Pooler → [1×2560] +intermediate · BertIntermediate ↩ inherited +output · XLMRobertaXLOutput +output · XLMRobertaXLSelfOutput + + + + +input_ids [1, 8] +word_embeddings: Embedding [250880×2560]word_embeddings Embedding [250880×2560] +token_type_embeddings: Embedding [1×2560]token_type_embeddings Embedding [1×2560] +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [514×2560]position_embeddings Embedding [514×2560] +query: Linear [2560→2560]query [2560→2560] +key: Linear [2560→2560]key [2560→2560] +value: Linear [2560→2560]value [2560→2560] +dropout: Dropoutdropout Dropout +dense: Linear [2560→2560]dense [2560→2560] +dropout: Dropoutdropout Dropout +self_attn_layer_norm: LayerNorm 2560self_attn_layer_norm LayerNorm 2560 +dense: Linear [2560→10240]dense [2560→10240] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [10240→2560]dense [10240→2560] +LayerNorm: LayerNorm 2560LayerNorm LayerNorm 2560 +LayerNorm: LayerNorm 2560LayerNorm LayerNorm 2560 +dense: Linear [2560→2560]dense [2560→2560] +activation: Tanhactivation Tanh +output [1×8×2560] model id FacebookAI/xlm-roberta-xl diff --git a/xlm_roberta_xl.svg b/xlm_roberta_xl.svg index 5b3ac34fd9e9922e45c0bb6966672a73a8a68732..8f9dff2fb587808b35f69f1ca01e34aaef28ec58 100644 --- a/xlm_roberta_xl.svg +++ b/xlm_roberta_xl.svg @@ -1,4 +1,4 @@ - + - + xlm_roberta_xl -dense · 36× MHA - -XLMRobertaXLModel · base model -36 × XLMRobertaXLLayerXLMRobertaXLLayer× 36 -XLMRobertaXLForCausalLM · task head -Self-Attention · XLMRobertaXLAttention -self · XLMRobertaXLSelfAttention -output · XLMRobertaXLSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [250880 × 2560] → [1, 6, 2560] -LayerNormpre-attention [1, 6, 2560] -query: Linear [2560→2560]query [2560→2560] -key: Linear [2560→2560]key [2560→2560] -value: Linear [2560→2560]value [2560→2560] -dropout: Dropoutdropout Dropout -dense: Linear [2560→2560]dense [2560→2560] -dropout: Dropoutdropout Dropout -self_attn_layer_norm: LayerNorm 2560self_attn_layer_norm LayerNorm 2560 -scaled dot-product attention32 heads · head_dim 80 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 2560] -XLMRobertaXLForCausalLMLM HeadLinear [2560→250880] · tied -Softmax -logits[1, 6, 250880] +XLMRobertaXLModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×8×2560] +layer · 36× XLMRobertaXLLayer +attention · XLMRobertaXLAttention +embeddings · Embeddings → [1×8×2560] +self · XLMRobertaXLSelfAttention +pooler · Pooler → [1×2560] +intermediate · XLMRobertaXLIntermediate +output · XLMRobertaXLOutput +output · XLMRobertaXLSelfOutput + + + + +input_ids [1, 8] +word_embeddings: Embedding [250880×2560]word_embeddings Embedding [250880×2560] +token_type_embeddings: Embedding [1×2560]token_type_embeddings Embedding [1×2560] +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [514×2560]position_embeddings Embedding [514×2560] +query: Linear [2560→2560]query [2560→2560] +key: Linear [2560→2560]key [2560→2560] +value: Linear [2560→2560]value [2560→2560] +dropout: Dropoutdropout Dropout +dense: Linear [2560→2560]dense [2560→2560] +dropout: Dropoutdropout Dropout +self_attn_layer_norm: LayerNorm 2560self_attn_layer_norm LayerNorm 2560 +dense: Linear [2560→10240]dense [2560→10240] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [10240→2560]dense [10240→2560] +LayerNorm: LayerNorm 2560LayerNorm LayerNorm 2560 +LayerNorm: LayerNorm 2560LayerNorm LayerNorm 2560 +dense: Linear [2560→2560]dense [2560→2560] +activation: Tanhactivation Tanh +output [1×8×2560] model id FacebookAI/xlm-roberta-xl @@ -170,16 +172,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/xmod.svg b/xmod.svg index 6e684da2d1c05f726403482c2ff9ee1eed65b4f4..7b9186b150328b482b447eb8d9525fb7274efd7f 100644 --- a/xmod.svg +++ b/xmod.svg @@ -1,4 +1,4 @@ - + - + xmod -dense · 12× MHA - -XmodModel · base model -12 × XmodLayerXmodLayer× 12 -XmodForCausalLM · task head -Self-Attention · XmodAttention -output · XmodSelfOutput -self · XmodSelfAttention - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: '␣Hey'␣Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [30522 × 768] → [1, 6, 768] -Normpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dropout: Dropoutdropout Dropout -dense: Linear [768→768]dense [768→768] -LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -XmodForCausalLMLM HeadLinear [768→30522] · tied -Softmax -logits[1, 6, 30522] +XmodModel · staged data flow (structure) +encoder · Encoder +layer · 12× XmodLayer +attention · XmodAttention +output · XmodOutput +embeddings · Embeddings +self · XmodSelfAttention +output · XmodSelfOutput +pooler · Pooler +intermediate · XmodIntermediate +adapter_modules · ModuleDict + + + +inputsinput_ids / pixel_values / input_values +word_embeddings: Embedding [30522×768]word_embeddings Embedding [30522×768] +token_type_embeddings: Embedding [2×768]token_type_embeddings Embedding [2×768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +position_embeddings: Embedding [512×768]position_embeddings Embedding [512×768] +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→768]dense [768→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +LayerNorm: LayerNorm 768LayerNorm LayerNorm 768 +dropout: Dropoutdropout Dropout +en_XX: XmodAdapteren_XX Adapter +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh model id facebook/xmod-base @@ -170,16 +173,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings True legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/yolos.diff.svg b/yolos.diff.svg index f3038f74e719c4b317d5bff83fa5a2450c433ca4..f8e78962330f6b28da1c24dd218ce838eb0f936c 100644 --- a/yolos.diff.svg +++ b/yolos.diff.svg @@ -1,4 +1,4 @@ - + - + yolos diff vs None · 0 overridden · 10 added · 0 deleted · 2 new · 0 inherited-as-is - -YolosModel · base model -12 × YolosLayerYolosLayer× 12 -Self-Attention · YolosAttention -attention · YolosSelfAttention -output · YolosSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→?] -Softmax -logits[1, 6, ?] +encoder · Encoder → [1×1125×768] +layer · 12× YolosLayer +embeddings · Embeddings → [1×1125×768] +attention · YolosAttention +pooler · Pooler → [1×768] +patch_embeddings · YolosPatchEmbeddings +intermediate · YolosIntermediate +output · YolosOutput +attention · YolosSelfAttention +output · YolosSelfOutput + + + + + +pixel_values [1, 3, 512, 512] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +interpolation: InterpolateInitialPositionEmbeddingsinterpolation InterpolateInitialPositionEmbeddings +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dense: Linear [768→768]dense [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +interpolation: InterpolateMidPositionEmbeddingsinterpolation InterpolateMidPositionEmbeddings +layernorm · LayerNorm → [1×1125×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×1125×768] model id hustvl/yolos-base diff --git a/yolos.svg b/yolos.svg index 99303ba8b7de530838835af0689a7204dc2b1426..7e932972030b337afa3c61d8c631bd22509fdd47 100644 --- a/yolos.svg +++ b/yolos.svg @@ -1,4 +1,4 @@ - + - + yolos -dense · 12× MHA - -YolosModel · base model -12 × YolosLayerYolosLayer× 12 -Self-Attention · YolosAttention -attention · YolosSelfAttention -output · YolosSelfOutput - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × 768] → [1, 6, 768] -LayerNormpre-attention [1, 6, 768] -query: Linear [768→768]query [768→768] -key: Linear [768→768]key [768→768] -value: Linear [768→768]value [768→768] -dense: Linear [768→768]dense [768→768] -dropout: Dropoutdropout Dropout -scaled dot-product attention12 heads · head_dim 64 -causal attention mask (q↓ × k→)causal mask -residual add+ -Final LayerNorm[1, 6, 768] -LM HeadLinear [768→?] -Softmax -logits[1, 6, ?] +YolosModel · forward data flow (shapes from a dummy input pass) +encoder · Encoder → [1×1125×768] +layer · 12× YolosLayer +embeddings · Embeddings → [1×1125×768] +attention · YolosAttention +pooler · Pooler → [1×768] +patch_embeddings · YolosPatchEmbeddings +intermediate · YolosIntermediate +output · YolosOutput +attention · YolosSelfAttention +output · YolosSelfOutput + + + + + +pixel_values [1, 3, 512, 512] +projection: Conv2d 3→768 k16×16projection Conv2d 3→768 k16×16 +dropout: Dropoutdropout Dropout +interpolation: InterpolateInitialPositionEmbeddingsinterpolation InterpolateInitialPositionEmbeddings +query: Linear [768→768]query [768→768] +key: Linear [768→768]key [768→768] +value: Linear [768→768]value [768→768] +dense: Linear [768→768]dense [768→768] +dropout: Dropoutdropout Dropout +dense: Linear [768→3072]dense [768→3072] +intermediate_act_fn: GELUActivationintermediate_act_fn GELU +dense: Linear [3072→768]dense [3072→768] +dropout: Dropoutdropout Dropout +layernorm_before: LayerNorm 768layernorm_before LayerNorm 768 +layernorm_after: LayerNorm 768layernorm_after LayerNorm 768 +interpolation: InterpolateMidPositionEmbeddingsinterpolation InterpolateMidPositionEmbeddings +layernorm · LayerNorm → [1×1125×768] +dense: Linear [768→768]dense [768→768] +activation: Tanhactivation Tanh +output [1×1125×768] model id hustvl/yolos-base @@ -167,16 +174,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file diff --git a/zoedepth.svg b/zoedepth.svg index 091e3edcce975c4b20b96bed8e09c183b1e5220c..bcdfc112a42fc3783a274d752ed5864cff0adb30 100644 --- a/zoedepth.svg +++ b/zoedepth.svg @@ -1,4 +1,4 @@ - + - + zoedepth -dense · 24× Attention - -ZoeDepthForDepthEstimation · base model -24 × BeitLayerBeitLayer× 24 -Self-Attention · BeitAttention -MLP · BeitMLP - - -input_idstokenize("Hey, how are you?") → [1, 6] -token 0: 'Hey'Hey0 -token 1: ',',1 -token 2: '␣how'␣how2 -token 3: '␣are'␣are3 -token 4: '␣you'␣you4 -token 5: '?'?5 -Token Embeddingweight [? × ?] → [1, 6, ?] -LayerNormpre-attention [1, 6, ?] -q_proj: Linear [1024→1024]q_proj [1024→1024] -k_proj: Linear [1024→1024]k_proj [1024→1024] -v_proj: Linear [1024→1024]v_proj [1024→1024] -o_proj: Linear [1024→1024]o_proj [1024→1024] -scaled dot-product attention? heads · head_dim ? -causal attention mask (q↓ × k→)causal mask -residual add+ -LayerNormpre-FFN [1, 6, ?] -activation_fn: GELUActivationactivation_fn GELU -fc1: Linear [1024→4096]fc1 [1024→4096] -fc2: Linear [4096→1024]fc2 [4096→1024] -residual add+ -Final LayerNorm[1, 6, ?] -LM HeadLinear [?→?] -Softmax -logits[1, 6, ?] +ZoeDepthForDepthEstimation · forward data flow (shapes from a dummy input pass) +backbone · BeitBackbone +metric_head · MetricDepthEstimationHead → [1×1×64×64] +neck · Neck → [1×256×4×4] +beit · BeitModel +layers · 24× BeitLayer +fusion_stage · ZoeDepthFeatureFusionStage +layers · 4× ZoeDepthFeatureFusionLayer +reassemble_stage · ZoeDepthReassembleStage +conditional_log_binomial · ZoeDepthConditionalLogBinomialSoftmax +embeddings · BeitEmbeddings +relative_head · RelativeDepthEstimationHead → [1×64×64] +seed_bin_regressor · ZoeDepthSeedBinRegressor +seed_projector · ZoeDepthProjector +projectors · 4× ZoeDepthProjector +mlp · Sequential [4] +attention · BeitAttention +residual_layer1 · ZoeDepthPreActResidualLayer +residual_layer2 · ZoeDepthPreActResidualLayer +layers · 4× ZoeDepthReassembleLayer +readout_projects · 4× Sequential +patch_embeddings · BeitPatchEmbeddings +mlp · BeitMLP + + + + +pixel_values [1, 3, 64, 64] +projection: Conv2d 3→1024 k16×16projection Conv2d 3→1024 k16×16 +dropout: Dropoutdropout Dropout +q_proj: Linear [1024→1024]q_proj [1024→1024] +k_proj: Linear [1024→1024]k_proj [1024→1024] +v_proj: Linear [1024→1024]v_proj [1024→1024] +o_proj: Linear [1024→1024]o_proj [1024→1024] +layernorm_before: LayerNorm 1024layernorm_before LayerNorm 1024 +layernorm_after: LayerNorm 1024layernorm_after LayerNorm 1024 +activation_fn: GELUActivationactivation_fn GELU +fc1: Linear [1024→4096]fc1 [1024→4096] +fc2: Linear [4096→1024]fc2 [4096→1024] +dropout: Dropoutdropout Dropout +drop_path: Identitydrop_path Identity +relative_position_bias: BeitRelativePositionBiasrelative_position_bias BeitRelativePositionBias +layernorm: Identitylayernorm Identity +fpn: Identityfpn Identity +projection: Conv2d 1024→96 k1×1projection Conv2d 1024→96 k1×1 +resize: ConvTranspose2dresize ConvTranspose2d +0: Linear [2048→1024]0 [2048→1024] +1: GELUActivation1 GELU +convs: 4× Conv2dconvs 4× Conv2d +projection: Conv2d 256→256 k1×1projection Conv2d 256→256 k1×1 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 256→256 k3×3convolution1 Conv2d 256→256 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 256→256 k3×3convolution2 Conv2d 256→256 k3×3 +activation1: ReLUactivation1 ReLU +convolution1: Conv2d 256→256 k3×3convolution1 Conv2d 256→256 k3×3 +activation2: ReLUactivation2 ReLU +convolution2: Conv2d 256→256 k3×3convolution2 Conv2d 256→256 k3×3 +conv1: Conv2d 256→128 k3×3conv1 Conv2d 256→128 k3×3 +upsample: Upsampleupsample Upsample +conv2: Conv2d 128→32 k3×3conv2 Conv2d 128→32 k3×3 +conv3: Conv2d 32→1 k1×1conv3 Conv2d 32→1 k1×1 +conv2: Conv2d 256→256 k1×1conv2 Conv2d 256→256 k1×1 +conv1: Conv2d 256→256 k1×1conv1 Conv2d 256→256 k1×1 +act1: ReLUact1 ReLU +conv2: Conv2d 256→64 k1×1conv2 Conv2d 256→64 k1×1 +act2: Softplusact2 Softplus +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +act: ReLUact ReLU +conv2: Conv2d 128→128 k1×1conv2 Conv2d 128→128 k1×1 +conv1: Conv2d 256→128 k1×1conv1 Conv2d 256→128 k1×1 +act: ReLUact ReLU +conv2: Conv2d 128→128 k1×1conv2 Conv2d 128→128 k1×1 +attractors: 4× ZoeDepthAttractorLayerUnnormedattractors 4× ZoeDepthAttractorLayerUnnormed +0: Conv2d 161→80 k1×10 Conv2d 161→80 k1×1 +1: GELU1 GELU +2: Conv2d 80→4 k1×12 Conv2d 80→4 k1×1 +3: Softplus3 Softplus +log_binomial_transform: LogBinomialSoftmaxlog_binomial_transform LogBinomialSoftmax model id Intel/zoedepth-nyu @@ -171,16 +217,24 @@ rect.b { rx: 9; stroke-width: 1.6; } tie_embeddings None legend - -self-attention - -linear / proj - -MLP / feed-forward - -RoPE - -normalization - -residual / skip + +embedding + +attention + +Mamba / SSM + +MoE / experts + +linear / proj + +convolution + +normalization + +activation + +pooling + +head \ No newline at end of file