{ "architecture": { "family": "causal_lm", "is_moe": false, "layer_summary": { "mamba": 32 }, "positional": "rope", "tie_word_embeddings": false, "view": "decoder" }, "capabilities": { "kernels": { "RMSNorm": [ "kernels-community/liger-kernels", "kernels-community/rmsnorm", "kernels-community/mlx_rmsnorm" ] }, "task_heads": [ "causal_lm" ], "tensor_parallel": false }, "components": [ { "children": [ "embed_tokens", "decoder_layers", "final_layernorm", "rotary_emb" ], "class_name": "BambaModel", "id": "model", "kind": "model", "path_pattern": "model" }, { "attributes": { "embedding_dim": "config.hidden_size", "num_embeddings": "config.vocab_size", "tied_lm_head": false }, "class_name": "Embedding", "id": "embed_tokens", "kind": "embedding", "path_pattern": "model.embed_tokens" }, { "attributes": { "kernel": "RMSNorm", "norm_type": "rms" }, "class_name": "BambaRMSNorm", "id": "final_layernorm", "kind": "normalization", "path_pattern": "model.final_layernorm" }, { "attributes": { "rope_theta": 10000.0, "scheme": "rope" }, "class_name": "BambaRotaryEmbedding", "id": "rotary_emb", "kind": "position", "path_pattern": "model.rotary_emb" } ], "config": { "class_name": "BambaConfig", "model_type": "bamba", "module": "transformers.models.bamba.configuration_bamba", "referenced_fields": { "num_hidden_layers": 32 }, "salient_fields": { "hidden_act": "silu", "hidden_size": 4096, "intermediate_size": 14336, "is_encoder_decoder": false, "max_position_embeddings": 262144, "num_attention_heads": 32, "num_hidden_layers": 32, "num_key_value_heads": 8, "tie_word_embeddings": false, "vocab_size": 128000 } }, "edges": [ { "kind": "data", "source": "embed_tokens", "target": "decoder_layers" }, { "kind": "data", "source": "decoder_layers", "target": "final_layernorm" }, { "kind": "data", "source": "decoder_layer.feed_forward", "target": "decoder_layer.input_layernorm" }, { "kind": "data", "source": "decoder_layer.input_layernorm", "target": "decoder_layer.pre_ff_layernorm" }, { "kind": "residual", "source": "decoder_layer", "target": "decoder_layer.feed_forward" }, { "kind": "data", "provenance": "intra_module", "source": "decoder_layer.feed_forward", "target": "decoder_layer.feed_forward.gate_proj" }, { "kind": "data", "provenance": "intra_module", "source": "decoder_layer.feed_forward", "target": "decoder_layer.feed_forward.up_proj" }, { "kind": "data", "provenance": "intra_module", "source": "decoder_layer.feed_forward.gate_proj", "target": "decoder_layer.feed_forward.down_proj" }, { "kind": "data", "provenance": "intra_module", "source": "decoder_layer.feed_forward.up_proj", "target": "decoder_layer.feed_forward.down_proj" } ], "extends": "llama", "model_type": "bamba", "patches": [ { "added": { "attrs": [ "cu_seq_lens_k", "cu_seq_lens_q", "max_length_k", "max_length_q", "seq_idx" ] }, "component_kind": "attention", "parent_class": "TypedDict", "relation": "new", "target_class": "BambaFlashAttentionKwargs" }, { "added": { "methods": [ "__init__", "cuda_kernels_forward", "forward", "torch_forward" ] }, "component_kind": null, "parent_class": "Module", "relation": "new", "target_class": "BambaMixer" }, { "component_kind": "transformer_block", "overridden": { "methods": [ "__init__", "forward" ] }, "parent_class": "JambaAttentionDecoderLayer", "parent_model": "jamba", "relation": "inherits", "target_class": "BambaDecoderLayer" }, { "added": { "attrs": [ "_can_record_outputs", "_is_stateful", "_no_split_modules", "_skip_keys_device_placement", "_supports_flash_attn", "_supports_sdpa", "base_model_prefix", "config", "supports_gradient_checkpointing" ], "methods": [ "_init_weights" ] }, "component_kind": "model", "parent_class": "PreTrainedModel", "relation": "new", "target_class": "BambaPreTrainedModel" }, { "added": { "methods": [ "__init__", "_update_mamba_mask", "forward" ] }, "component_kind": "model", "parent_class": "BambaPreTrainedModel", "relation": "new", "target_class": "BambaModel" }, { "added": { "methods": [ "prepare_inputs_for_generation" ] }, "component_kind": "lm_head", "overridden": { "methods": [ "__init__", "forward" ] }, "parent_class": "LlamaForCausalLM", "relation": "inherits", "target_class": "BambaForCausalLM" } ], "provenance": { "config_class": "BambaConfig", "config_module": "transformers.models.bamba.configuration_bamba", "model_class": "BambaModel", "model_module": "transformers.models.bamba.modeling_bamba" }, "repeats": [ { "body": "decoder_layer", "container_path_pattern": "model.layers", "count": 32, "count_expr": "config.num_hidden_layers", "count_source": "config", "id": "decoder_layers", "index_symbol": "i", "item_path_pattern": "model.layers.{i}", "kind": "symbolic_repeat", "provenance": { "class_name": "BambaDecoderLayer", "container_path_pattern": "model.layers", "item_path_pattern": "model.layers.{i}", "source": "module_tree_repeat_collapse" }, "repeated_class_name": "BambaDecoderLayer" } ], "schema_version": "architecture-template-v0", "templates": [ { "children": [ "decoder_layer.feed_forward", "decoder_layer.input_layernorm", "decoder_layer.pre_ff_layernorm", "decoder_layer.mamba" ], "class_name": "BambaDecoderLayer", "id": "decoder_layer", "kind": "transformer_block", "path_pattern": "model.layers.{i}" }, { "attributes": { "activation": "silu", "hidden_size": 4096, "intermediate_size": 14336 }, "children": [ "decoder_layer.feed_forward.gate_proj", "decoder_layer.feed_forward.up_proj", "decoder_layer.feed_forward.down_proj" ], "class_name": "BambaMLP", "id": "decoder_layer.feed_forward", "kind": "feed_forward", "path_pattern": "model.layers.{i}.feed_forward" }, { "attributes": { "in_features": "config.hidden_size", "out_features": "config.intermediate_size" }, "class_name": "Linear", "id": "decoder_layer.feed_forward.gate_proj", "kind": "projection", "path_pattern": "model.layers.{i}.feed_forward.gate_proj" }, { "attributes": { "in_features": "config.hidden_size", "out_features": "config.intermediate_size" }, "class_name": "Linear", "id": "decoder_layer.feed_forward.up_proj", "kind": "projection", "path_pattern": "model.layers.{i}.feed_forward.up_proj" }, { "attributes": { "in_features": "config.intermediate_size", "out_features": "config.hidden_size" }, "class_name": "Linear", "id": "decoder_layer.feed_forward.down_proj", "kind": "projection", "path_pattern": "model.layers.{i}.feed_forward.down_proj" }, { "attributes": { "kernel": "RMSNorm", "norm_type": "rms" }, "class_name": "BambaRMSNorm", "id": "decoder_layer.input_layernorm", "kind": "normalization", "path_pattern": "model.layers.{i}.input_layernorm" }, { "attributes": { "kernel": "RMSNorm", "norm_type": "rms" }, "class_name": "BambaRMSNorm", "id": "decoder_layer.pre_ff_layernorm", "kind": "normalization", "path_pattern": "model.layers.{i}.pre_ff_layernorm" }, { "children": [ "decoder_layer.mamba.conv1d", "decoder_layer.mamba.norm" ], "class_name": "BambaMixer", "id": "decoder_layer.mamba", "kind": "module", "path_pattern": "model.layers.{i}.mamba" }, { "class_name": "Conv1d", "id": "decoder_layer.mamba.conv1d", "kind": "convolution", "path_pattern": "model.layers.{i}.mamba.conv1d" }, { "attributes": { "norm_type": "rms" }, "class_name": "BambaRMSNormGated", "id": "decoder_layer.mamba.norm", "kind": "normalization", "path_pattern": "model.layers.{i}.mamba.norm" } ] }