| { |
| "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": [ |
| "causal_lm", |
| "masked_lm", |
| "multiple_choice", |
| "pretraining", |
| "question_answering", |
| "sequence_classification", |
| "text_encoding", |
| "token_classification" |
| ], |
| "tensor_parallel": false |
| }, |
| "components": [ |
| { |
| "children": [ |
| "embeddings", |
| "embeddings_project", |
| "encoder" |
| ], |
| "class_name": "ElectraModel", |
| "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.token_type_embeddings", |
| "embeddings.LayerNorm" |
| ], |
| "class_name": "ElectraEmbeddings", |
| "id": "embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings" |
| }, |
| { |
| "attributes": { |
| "embedding_dim": 128, |
| "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": { |
| "embedding_dim": 128, |
| "num_embeddings": 2 |
| }, |
| "class_name": "Embedding", |
| "id": "embeddings.token_type_embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings.token_type_embeddings" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "embeddings.LayerNorm", |
| "kind": "normalization", |
| "path_pattern": "model.embeddings.LayerNorm" |
| }, |
| { |
| "attributes": { |
| "in_features": 128, |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "embeddings_project", |
| "kind": "projection", |
| "path_pattern": "model.embeddings_project" |
| }, |
| { |
| "children": [ |
| "encoder_layers" |
| ], |
| "class_name": "ElectraEncoder", |
| "id": "encoder", |
| "kind": "encoder", |
| "path_pattern": "model.encoder" |
| } |
| ], |
| "config": { |
| "class_name": "ElectraConfig", |
| "model_type": "electra", |
| "module": "transformers.models.electra.configuration_electra", |
| "referenced_fields": { |
| "num_hidden_layers": 12 |
| }, |
| "salient_fields": { |
| "hidden_act": "gelu", |
| "hidden_size": 256, |
| "intermediate_size": 1024, |
| "is_encoder_decoder": false, |
| "max_position_embeddings": 512, |
| "num_attention_heads": 4, |
| "num_hidden_layers": 12, |
| "tie_word_embeddings": true, |
| "vocab_size": 30522 |
| } |
| }, |
| "dataflow": { |
| "input": { |
| "name": "input_ids", |
| "shape": [ |
| "B", |
| "S" |
| ] |
| }, |
| "output": { |
| "shape": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "shapes": { |
| "embeddings": { |
| "in": null, |
| "out": [ |
| "B", |
| "S", |
| 128 |
| ] |
| }, |
| "embeddings_project": { |
| "in": [ |
| "B", |
| "S", |
| 128 |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "encoder": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "encoder_layer.attention": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| }, |
| "encoder_layer.intermediate": { |
| "in": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.intermediate_size" |
| ] |
| }, |
| "encoder_layer.output": { |
| "in": [ |
| "B", |
| "S", |
| "config.intermediate_size" |
| ], |
| "out": [ |
| "B", |
| "S", |
| "config.hidden_size" |
| ] |
| } |
| }, |
| "source": "observed_forward_meta" |
| }, |
| "edges": [ |
| { |
| "kind": "data", |
| "source": "embeddings.word_embeddings", |
| "target": "embeddings.token_type_embeddings" |
| }, |
| { |
| "kind": "data", |
| "source": "embeddings.token_type_embeddings", |
| "target": "embeddings.LayerNorm" |
| }, |
| { |
| "kind": "mask", |
| "source": "input:attention_mask", |
| "target": "encoder_layer.attention" |
| }, |
| { |
| "kind": "mask", |
| "source": "input:attention_mask", |
| "target": "encoder_layer.attention.self" |
| }, |
| { |
| "kind": "residual", |
| "source": "encoder_layer", |
| "target": "encoder_layer.attention" |
| }, |
| { |
| "kind": "residual", |
| "source": "encoder_layer", |
| "target": "encoder_layer.intermediate" |
| }, |
| { |
| "kind": "position", |
| "source": "embeddings.position_embeddings", |
| "target": "embeddings" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.attention.self", |
| "target": "encoder_layer.attention.self.query" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.attention.self", |
| "target": "encoder_layer.attention.self.key" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.attention.self", |
| "target": "encoder_layer.attention.self.value" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.intermediate", |
| "target": "encoder_layer.intermediate.dense" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.output", |
| "target": "encoder_layer.output.dense" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "encoder_layer.attention", |
| "target": "encoder_layer.intermediate" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "encoder_layer.intermediate", |
| "target": "encoder_layer.output" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "embeddings", |
| "target": "embeddings_project" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "embeddings_project", |
| "target": "encoder" |
| } |
| ], |
| "extends": null, |
| "model_type": "electra", |
| "provenance": { |
| "config_class": "ElectraConfig", |
| "config_module": "transformers.models.electra.configuration_electra", |
| "model_class": "ElectraModel", |
| "model_module": "transformers.models.electra.modeling_electra" |
| }, |
| "repeats": [ |
| { |
| "body": "encoder_layer", |
| "container_path_pattern": "model.encoder.layer", |
| "count": 12, |
| "count_expr": "config.num_hidden_layers", |
| "count_source": "config", |
| "id": "encoder_layers", |
| "index_symbol": "i", |
| "item_path_pattern": "model.encoder.layer.{i}", |
| "kind": "symbolic_repeat", |
| "provenance": { |
| "class_name": "ElectraLayer", |
| "container_path_pattern": "model.encoder.layer", |
| "item_path_pattern": "model.encoder.layer.{i}", |
| "source": "module_tree_repeat_collapse" |
| }, |
| "repeated_class_name": "ElectraLayer" |
| } |
| ], |
| "schema_version": "architecture-template-v0", |
| "templates": [ |
| { |
| "children": [ |
| "encoder_layer.attention", |
| "encoder_layer.intermediate", |
| "encoder_layer.output" |
| ], |
| "class_name": "ElectraLayer", |
| "id": "encoder_layer", |
| "kind": "transformer_block", |
| "path_pattern": "model.encoder.layer.{i}" |
| }, |
| { |
| "attributes": { |
| "head_dim": 64, |
| "n_heads": 4, |
| "n_kv_heads": 4, |
| "pattern": "bidirectional", |
| "rope": false, |
| "variant": "MHA" |
| }, |
| "children": [ |
| "encoder_layer.attention.self", |
| "encoder_layer.attention.output" |
| ], |
| "class_name": "ElectraAttention", |
| "id": "encoder_layer.attention", |
| "kind": "attention", |
| "path_pattern": "model.encoder.layer.{i}.attention" |
| }, |
| { |
| "attributes": { |
| "head_dim": 64, |
| "n_heads": 4, |
| "n_kv_heads": 4, |
| "pattern": "bidirectional", |
| "rope": false, |
| "variant": "MHA" |
| }, |
| "children": [ |
| "encoder_layer.attention.self.query", |
| "encoder_layer.attention.self.key", |
| "encoder_layer.attention.self.value" |
| ], |
| "class_name": "ElectraSelfAttention", |
| "id": "encoder_layer.attention.self", |
| "kind": "attention", |
| "path_pattern": "model.encoder.layer.{i}.attention.self" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.attention.self.query", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.attention.self.query" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.attention.self.key", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.attention.self.key" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.attention.self.value", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.attention.self.value" |
| }, |
| { |
| "children": [ |
| "encoder_layer.attention.output.LayerNorm" |
| ], |
| "class_name": "ElectraSelfOutput", |
| "id": "encoder_layer.attention.output", |
| "kind": "module", |
| "path_pattern": "model.encoder.layer.{i}.attention.output" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_layer.attention.output.LayerNorm", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.layer.{i}.attention.output.LayerNorm" |
| }, |
| { |
| "attributes": { |
| "activation": "gelu", |
| "hidden_size": 256, |
| "intermediate_size": 1024 |
| }, |
| "children": [ |
| "encoder_layer.intermediate.dense" |
| ], |
| "class_name": "ElectraIntermediate", |
| "id": "encoder_layer.intermediate", |
| "kind": "feed_forward", |
| "path_pattern": "model.encoder.layer.{i}.intermediate" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.intermediate_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.intermediate.dense", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.intermediate.dense" |
| }, |
| { |
| "attributes": { |
| "activation": "gelu", |
| "hidden_size": 256, |
| "intermediate_size": 1024 |
| }, |
| "children": [ |
| "encoder_layer.output.dense", |
| "encoder_layer.output.LayerNorm" |
| ], |
| "class_name": "ElectraOutput", |
| "id": "encoder_layer.output", |
| "kind": "feed_forward", |
| "path_pattern": "model.encoder.layer.{i}.output" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.intermediate_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.output.dense", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.output.dense" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_layer.output.LayerNorm", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.layer.{i}.output.LayerNorm" |
| } |
| ] |
| } |
|
|