| { |
| "architecture": { |
| "attention_variant": "MHA", |
| "family": "masked_lm", |
| "is_moe": false, |
| "mixer": "attention", |
| "positional": "learned", |
| "tie_word_embeddings": true, |
| "view": "encoder" |
| }, |
| "capabilities": { |
| "attention_backends": [ |
| "eager", |
| "sdpa", |
| "flash_attention", |
| "flex_attention" |
| ], |
| "attention_patterns": [ |
| "bidirectional" |
| ], |
| "attention_schedule": null, |
| "task_heads": [ |
| "masked_lm", |
| "multiple_choice", |
| "pretraining", |
| "question_answering", |
| "sequence_classification", |
| "text_encoding", |
| "token_classification" |
| ], |
| "tensor_parallel": false |
| }, |
| "components": [ |
| { |
| "children": [ |
| "embeddings", |
| "transformer" |
| ], |
| "class_name": "DistilBertModel", |
| "id": "model", |
| "kind": "model", |
| "path_pattern": "model" |
| }, |
| { |
| "attributes": { |
| "embedding_dim": "config.hidden_size", |
| "num_embeddings": "config.vocab_size" |
| }, |
| "children": [ |
| "embeddings.word_embeddings", |
| "embeddings.position_embeddings", |
| "embeddings.LayerNorm" |
| ], |
| "class_name": "Embeddings", |
| "id": "embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings" |
| }, |
| { |
| "attributes": { |
| "embedding_dim": "config.hidden_size", |
| "num_embeddings": "config.vocab_size", |
| "tied_lm_head": true |
| }, |
| "class_name": "Embedding", |
| "id": "embeddings.word_embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings.word_embeddings" |
| }, |
| { |
| "attributes": { |
| "max_position_embeddings": "config.max_position_embeddings", |
| "scheme": "learned" |
| }, |
| "class_name": "Embedding", |
| "id": "embeddings.position_embeddings", |
| "kind": "position", |
| "path_pattern": "model.embeddings.position_embeddings" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "embeddings.LayerNorm", |
| "kind": "normalization", |
| "path_pattern": "model.embeddings.LayerNorm" |
| }, |
| { |
| "children": [ |
| "blocks" |
| ], |
| "class_name": "Transformer", |
| "id": "transformer", |
| "kind": "module", |
| "path_pattern": "model.transformer" |
| } |
| ], |
| "config": { |
| "class_name": "DistilBertConfig", |
| "model_type": "distilbert", |
| "module": "transformers.models.distilbert.configuration_distilbert", |
| "referenced_fields": {}, |
| "salient_fields": { |
| "hidden_size": 768, |
| "is_encoder_decoder": false, |
| "max_position_embeddings": 512, |
| "num_attention_heads": 12, |
| "num_hidden_layers": 6, |
| "tie_word_embeddings": true, |
| "vocab_size": 30522 |
| } |
| }, |
| "dataflow": { |
| "input": { |
| "name": "input_ids", |
| "shape": [ |
| "B", |
| "S" |
| ] |
| }, |
| "output": { |
| "shape": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "shapes": { |
| "block.attention": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "block.ffn": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "block.output_layer_norm": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "block.sa_layer_norm": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "embeddings": { |
| "in": [ |
| "B", |
| "S" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "transformer": { |
| "in": null, |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| } |
| }, |
| "source": "observed_forward_meta" |
| }, |
| "edges": [ |
| { |
| "kind": "data", |
| "source": "embeddings.word_embeddings", |
| "target": "embeddings.LayerNorm" |
| }, |
| { |
| "kind": "mask", |
| "source": "input:attention_mask", |
| "target": "block.attention" |
| }, |
| { |
| "kind": "residual", |
| "source": "block", |
| "target": "block.attention" |
| }, |
| { |
| "kind": "residual", |
| "source": "block", |
| "target": "block.ffn" |
| }, |
| { |
| "kind": "position", |
| "source": "embeddings.position_embeddings", |
| "target": "embeddings" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "block.attention", |
| "target": "block.attention.q_lin" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "block.attention", |
| "target": "block.attention.k_lin" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "block.attention", |
| "target": "block.attention.v_lin" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "block.attention", |
| "target": "block.attention.out_lin" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "block.ffn", |
| "target": "block.ffn.lin1" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "block.ffn", |
| "target": "block.ffn.lin2" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "block.attention", |
| "target": "block.sa_layer_norm" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "block.sa_layer_norm", |
| "target": "block.ffn" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "block.ffn", |
| "target": "block.output_layer_norm" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "embeddings", |
| "target": "transformer" |
| } |
| ], |
| "extends": null, |
| "model_type": "distilbert", |
| "provenance": { |
| "config_class": "DistilBertConfig", |
| "config_module": "transformers.models.distilbert.configuration_distilbert", |
| "model_class": "DistilBertModel", |
| "model_module": "transformers.models.distilbert.modeling_distilbert" |
| }, |
| "repeats": [ |
| { |
| "body": "block", |
| "container_path_pattern": "model.transformer.layer", |
| "count": 6, |
| "count_expr": "config.num_hidden_layers", |
| "count_source": "config", |
| "id": "blocks", |
| "index_symbol": "i", |
| "item_path_pattern": "model.transformer.layer.{i}", |
| "kind": "symbolic_repeat", |
| "provenance": { |
| "class_name": "TransformerBlock", |
| "container_path_pattern": "model.transformer.layer", |
| "item_path_pattern": "model.transformer.layer.{i}", |
| "source": "module_tree_repeat_collapse" |
| }, |
| "repeated_class_name": "TransformerBlock" |
| } |
| ], |
| "schema_version": "architecture-template-v0", |
| "templates": [ |
| { |
| "children": [ |
| "block.attention", |
| "block.sa_layer_norm", |
| "block.ffn", |
| "block.output_layer_norm" |
| ], |
| "class_name": "TransformerBlock", |
| "id": "block", |
| "kind": "transformer_block", |
| "path_pattern": "model.transformer.layer.{i}" |
| }, |
| { |
| "attributes": { |
| "head_dim": 64, |
| "n_heads": 12, |
| "n_kv_heads": 12, |
| "pattern": "bidirectional", |
| "rope": false, |
| "variant": "MHA" |
| }, |
| "children": [ |
| "block.attention.q_lin", |
| "block.attention.k_lin", |
| "block.attention.v_lin", |
| "block.attention.out_lin" |
| ], |
| "class_name": "DistilBertSelfAttention", |
| "id": "block.attention", |
| "kind": "attention", |
| "path_pattern": "model.transformer.layer.{i}.attention" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "block.attention.q_lin", |
| "kind": "projection", |
| "path_pattern": "model.transformer.layer.{i}.attention.q_lin" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "block.attention.k_lin", |
| "kind": "projection", |
| "path_pattern": "model.transformer.layer.{i}.attention.k_lin" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "block.attention.v_lin", |
| "kind": "projection", |
| "path_pattern": "model.transformer.layer.{i}.attention.v_lin" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "block.attention.out_lin", |
| "kind": "projection", |
| "path_pattern": "model.transformer.layer.{i}.attention.out_lin" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "block.sa_layer_norm", |
| "kind": "normalization", |
| "path_pattern": "model.transformer.layer.{i}.sa_layer_norm" |
| }, |
| { |
| "attributes": { |
| "hidden_size": 768 |
| }, |
| "children": [ |
| "block.ffn.lin1", |
| "block.ffn.lin2" |
| ], |
| "class_name": "FFN", |
| "id": "block.ffn", |
| "kind": "feed_forward", |
| "path_pattern": "model.transformer.layer.{i}.ffn" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": 3072 |
| }, |
| "class_name": "Linear", |
| "id": "block.ffn.lin1", |
| "kind": "projection", |
| "path_pattern": "model.transformer.layer.{i}.ffn.lin1" |
| }, |
| { |
| "attributes": { |
| "in_features": 3072, |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "block.ffn.lin2", |
| "kind": "projection", |
| "path_pattern": "model.transformer.layer.{i}.ffn.lin2" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "block.output_layer_norm", |
| "kind": "normalization", |
| "path_pattern": "model.transformer.layer.{i}.output_layer_norm" |
| } |
| ] |
| } |
|
|