| { |
| "architecture": { |
| "attention_variant": "MHA", |
| "family": "image_classification", |
| "is_moe": false, |
| "mixer": "attention", |
| "view": "encoder" |
| }, |
| "capabilities": { |
| "attention_backends": [ |
| "eager", |
| "sdpa", |
| "flash_attention", |
| "flex_attention" |
| ], |
| "attention_patterns": [ |
| "bidirectional" |
| ], |
| "attention_schedule": null, |
| "task_heads": [ |
| "backbone", |
| "image", |
| "image_classification" |
| ], |
| "tensor_parallel": false |
| }, |
| "components": [ |
| { |
| "children": [ |
| "embeddings", |
| "encoder", |
| "layernorm" |
| ], |
| "class_name": "Dinov2Model", |
| "id": "model", |
| "kind": "model", |
| "path_pattern": "model" |
| }, |
| { |
| "attributes": { |
| "embedding_dim": "config.hidden_size" |
| }, |
| "children": [ |
| "embeddings.patch_embeddings" |
| ], |
| "class_name": "Dinov2Embeddings", |
| "id": "embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings" |
| }, |
| { |
| "attributes": { |
| "embedding_dim": "config.hidden_size" |
| }, |
| "children": [ |
| "embeddings.patch_embeddings.projection" |
| ], |
| "class_name": "Dinov2PatchEmbeddings", |
| "id": "embeddings.patch_embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings.patch_embeddings" |
| }, |
| { |
| "class_name": "Conv2d", |
| "id": "embeddings.patch_embeddings.projection", |
| "kind": "convolution", |
| "path_pattern": "model.embeddings.patch_embeddings.projection" |
| }, |
| { |
| "children": [ |
| "encoder_layers" |
| ], |
| "class_name": "Dinov2Encoder", |
| "id": "encoder", |
| "kind": "encoder", |
| "path_pattern": "model.encoder" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "layernorm", |
| "kind": "normalization", |
| "path_pattern": "model.layernorm" |
| } |
| ], |
| "config": { |
| "class_name": "Dinov2Config", |
| "model_type": "dinov2", |
| "module": "transformers.models.dinov2.configuration_dinov2", |
| "referenced_fields": { |
| "num_hidden_layers": 12 |
| }, |
| "salient_fields": { |
| "hidden_act": "gelu", |
| "hidden_size": 768, |
| "is_encoder_decoder": false, |
| "num_attention_heads": 12, |
| "num_hidden_layers": 12 |
| } |
| }, |
| "dataflow": { |
| "input": { |
| "name": "pixel_values", |
| "shape": [ |
| "B", |
| 3, |
| 224, |
| 224 |
| ] |
| }, |
| "output": { |
| "shape": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "shapes": { |
| "embeddings": { |
| "in": [ |
| "B", |
| 3, |
| 224, |
| 224 |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "encoder": { |
| "in": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "encoder_layer.attention": { |
| "in": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "encoder_layer.mlp": { |
| "in": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "encoder_layer.norm1": { |
| "in": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "encoder_layer.norm2": { |
| "in": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| }, |
| "layernorm": { |
| "in": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ], |
| "out": [ |
| "B", |
| 257, |
| "config.hidden_size" |
| ] |
| } |
| }, |
| "source": "observed_forward_meta" |
| }, |
| "edges": [ |
| { |
| "kind": "data", |
| "source": "embeddings", |
| "target": "encoder" |
| }, |
| { |
| "kind": "data", |
| "source": "encoder", |
| "target": "layernorm" |
| }, |
| { |
| "kind": "mask", |
| "source": "input:attention_mask", |
| "target": "encoder_layer.attention" |
| }, |
| { |
| "kind": "mask", |
| "source": "input:attention_mask", |
| "target": "encoder_layer.attention.attention" |
| }, |
| { |
| "kind": "residual", |
| "source": "encoder_layer", |
| "target": "encoder_layer.attention" |
| }, |
| { |
| "kind": "residual", |
| "source": "encoder_layer", |
| "target": "encoder_layer.mlp" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.attention.attention", |
| "target": "encoder_layer.attention.attention.query" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.attention.attention", |
| "target": "encoder_layer.attention.attention.key" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.attention.attention", |
| "target": "encoder_layer.attention.attention.value" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.mlp", |
| "target": "encoder_layer.mlp.fc1" |
| }, |
| { |
| "kind": "data", |
| "provenance": "intra_module", |
| "source": "encoder_layer.mlp.fc1", |
| "target": "encoder_layer.mlp.fc2" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "encoder_layer.norm1", |
| "target": "encoder_layer.attention" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "encoder_layer.attention", |
| "target": "encoder_layer.norm2" |
| }, |
| { |
| "kind": "data", |
| "provenance": "observed_forward", |
| "source": "encoder_layer.norm2", |
| "target": "encoder_layer.mlp" |
| } |
| ], |
| "extends": null, |
| "model_type": "dinov2", |
| "provenance": { |
| "config_class": "Dinov2Config", |
| "config_module": "transformers.models.dinov2.configuration_dinov2", |
| "model_class": "Dinov2Model", |
| "model_module": "transformers.models.dinov2.modeling_dinov2" |
| }, |
| "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": "Dinov2Layer", |
| "container_path_pattern": "model.encoder.layer", |
| "item_path_pattern": "model.encoder.layer.{i}", |
| "source": "module_tree_repeat_collapse" |
| }, |
| "repeated_class_name": "Dinov2Layer" |
| } |
| ], |
| "schema_version": "architecture-template-v0", |
| "templates": [ |
| { |
| "children": [ |
| "encoder_layer.norm1", |
| "encoder_layer.attention", |
| "encoder_layer.norm2", |
| "encoder_layer.mlp" |
| ], |
| "class_name": "Dinov2Layer", |
| "id": "encoder_layer", |
| "kind": "transformer_block", |
| "path_pattern": "model.encoder.layer.{i}" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_layer.norm1", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.layer.{i}.norm1" |
| }, |
| { |
| "attributes": { |
| "head_dim": 64, |
| "n_heads": 12, |
| "n_kv_heads": 12, |
| "pattern": "bidirectional", |
| "rope": false, |
| "variant": "MHA" |
| }, |
| "children": [ |
| "encoder_layer.attention.attention" |
| ], |
| "class_name": "Dinov2Attention", |
| "id": "encoder_layer.attention", |
| "kind": "attention", |
| "path_pattern": "model.encoder.layer.{i}.attention" |
| }, |
| { |
| "attributes": { |
| "head_dim": 64, |
| "n_heads": 12, |
| "n_kv_heads": 12, |
| "pattern": "bidirectional", |
| "rope": false, |
| "variant": "MHA" |
| }, |
| "children": [ |
| "encoder_layer.attention.attention.query", |
| "encoder_layer.attention.attention.key", |
| "encoder_layer.attention.attention.value" |
| ], |
| "class_name": "Dinov2SelfAttention", |
| "id": "encoder_layer.attention.attention", |
| "kind": "attention", |
| "path_pattern": "model.encoder.layer.{i}.attention.attention" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.attention.attention.query", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.attention.attention.query" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.attention.attention.key", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.attention.attention.key" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.attention.attention.value", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.attention.attention.value" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_layer.norm2", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.layer.{i}.norm2" |
| }, |
| { |
| "attributes": { |
| "activation": "gelu", |
| "hidden_size": 768 |
| }, |
| "children": [ |
| "encoder_layer.mlp.fc1", |
| "encoder_layer.mlp.fc2" |
| ], |
| "class_name": "Dinov2MLP", |
| "id": "encoder_layer.mlp", |
| "kind": "feed_forward", |
| "path_pattern": "model.encoder.layer.{i}.mlp" |
| }, |
| { |
| "attributes": { |
| "in_features": "config.hidden_size", |
| "out_features": 3072 |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.mlp.fc1", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.mlp.fc1" |
| }, |
| { |
| "attributes": { |
| "in_features": 3072, |
| "out_features": "config.hidden_size" |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.mlp.fc2", |
| "kind": "projection", |
| "path_pattern": "model.encoder.layer.{i}.mlp.fc2" |
| } |
| ] |
| } |
|
|