{ "architecture": { "attention_variant": "MHA", "family": "image_text_to_text", "is_moe": false, "mixer": "attention", "positional": "learned", "tie_word_embeddings": true, "towers": [ { "attention_variant": "MHA", "config_class": "BlipTextConfig", "hidden_size": 768, "name": "text", "num_attention_heads": 8, "num_hidden_layers": 12, "positional": "learned" }, { "attention_variant": "MHA", "config_class": "BlipVisionConfig", "hidden_size": 768, "name": "vision", "num_attention_heads": 12, "num_hidden_layers": 12 } ], "view": "multimodal" }, "capabilities": { "attention_backends": [ "eager" ], "attention_patterns": [ "causal" ], "attention_schedule": null, "task_heads": [ "image_text_to_text", "multimodal_lm", "visual_question_answering", "zero_shot_image_classification" ], "tensor_parallel": false }, "components": [ { "children": [ "text_model", "vision_model", "visual_projection", "text_projection" ], "class_name": "BlipModel", "id": "model", "kind": "model", "path_pattern": "model" }, { "children": [ "text_model.embeddings", "text_model.encoder", "text_model.pooler" ], "class_name": "BlipTextModel", "id": "text_model", "kind": "model", "path_pattern": "model.text_model" }, { "attributes": { "embedding_dim": "config.hidden_size", "num_embeddings": "config.vocab_size" }, "children": [ "text_model.embeddings.word_embeddings", "text_model.embeddings.position_embeddings", "text_model.embeddings.LayerNorm" ], "class_name": "BlipTextEmbeddings", "id": "text_model.embeddings", "kind": "embedding", "path_pattern": "model.text_model.embeddings" }, { "attributes": { "embedding_dim": "config.hidden_size", "num_embeddings": "config.vocab_size", "tied_lm_head": true }, "class_name": "Embedding", "id": "text_model.embeddings.word_embeddings", "kind": "embedding", "path_pattern": "model.text_model.embeddings.word_embeddings" }, { "attributes": { "max_position_embeddings": "config.max_position_embeddings", "scheme": "learned" }, "class_name": "Embedding", "id": "text_model.embeddings.position_embeddings", "kind": "position", "path_pattern": "model.text_model.embeddings.position_embeddings" }, { "attributes": { "norm_type": "layer" }, "class_name": "LayerNorm", "id": "text_model.embeddings.LayerNorm", "kind": "normalization", "path_pattern": "model.text_model.embeddings.LayerNorm" }, { "children": [ "encoder_layers" ], "class_name": "BlipTextEncoder", "id": "text_model.encoder", "kind": "encoder", "path_pattern": "model.text_model.encoder" }, { "class_name": "BlipTextPooler", "id": "text_model.pooler", "kind": "pooler", "path_pattern": "model.text_model.pooler" }, { "children": [ "vision_model.embeddings", "vision_model.encoder", "vision_model.post_layernorm" ], "class_name": "BlipVisionModel", "id": "vision_model", "kind": "model", "path_pattern": "model.vision_model" }, { "attributes": { "embedding_dim": "config.hidden_size" }, "children": [ "vision_model.embeddings.patch_embedding" ], "class_name": "BlipVisionEmbeddings", "id": "vision_model.embeddings", "kind": "embedding", "path_pattern": "model.vision_model.embeddings" }, { "class_name": "Conv2d", "id": "vision_model.embeddings.patch_embedding", "kind": "convolution", "path_pattern": "model.vision_model.embeddings.patch_embedding" }, { "children": [ "encoder_layer_2s" ], "class_name": "BlipEncoder", "id": "vision_model.encoder", "kind": "encoder", "path_pattern": "model.vision_model.encoder" }, { "attributes": { "norm_type": "layer" }, "class_name": "LayerNorm", "id": "vision_model.post_layernorm", "kind": "normalization", "path_pattern": "model.vision_model.post_layernorm" }, { "attributes": { "in_features": "config.hidden_size", "out_features": 512 }, "class_name": "Linear", "id": "visual_projection", "kind": "projection", "path_pattern": "model.visual_projection" }, { "attributes": { "in_features": 768, "out_features": 512 }, "class_name": "Linear", "id": "text_projection", "kind": "projection", "path_pattern": "model.text_projection" } ], "config": { "class_name": "BlipConfig", "model_type": "blip", "module": "transformers.models.blip.configuration_blip", "referenced_fields": {}, "salient_fields": { "is_encoder_decoder": false, "tie_word_embeddings": true } }, "dataflow": { "input": { "name": "input_ids", "shape": [ "B", "S" ] }, "output": { "shape": [ "B", 1 ] }, "shapes": { "encoder_layer.attention": { "in": [ "B", "S", 768 ], "out": [ "B", "S", 768 ] }, "encoder_layer.intermediate": { "in": [ "B", "S", 768 ], "out": [ "B", "S", 3072 ] }, "encoder_layer.output": { "in": [ "B", "S", 3072 ], "out": [ "B", "S", 768 ] }, "encoder_layer_2.layer_norm1": { "in": [ "B", 577, 768 ], "out": [ "B", 577, 768 ] }, "encoder_layer_2.layer_norm2": { "in": [ "B", 577, 768 ], "out": [ "B", 577, 768 ] }, "encoder_layer_2.mlp": { "in": [ "B", 577, 768 ], "out": [ "B", 577, 768 ] }, "encoder_layer_2.self_attn": { "in": null, "out": [ "B", 577, 768 ] }, "text_model": { "in": null, "out": [ "B", "S", 768 ] }, "text_projection": { "in": [ "B", 768 ], "out": [ "B", 512 ] }, "vision_model": { "in": null, "out": [ "B", 577, 768 ] }, "visual_projection": { "in": [ "B", 768 ], "out": [ "B", 512 ] } }, "source": "observed_forward_meta" }, "edges": [ { "kind": "data", "source": "text_model", "target": "vision_model" }, { "kind": "data", "source": "text_model.embeddings", "target": "text_model.encoder" }, { "kind": "data", "source": "text_model.encoder", "target": "text_model.pooler" }, { "kind": "data", "source": "text_model.embeddings.word_embeddings", "target": "text_model.embeddings.LayerNorm" }, { "kind": "data", "source": "encoder_layer.attention", "target": "encoder_layer.crossattention" }, { "kind": "data", "source": "encoder_layer.crossattention", "target": "encoder_layer.intermediate" }, { "kind": "data", "source": "encoder_layer.crossattention.self", "target": "encoder_layer.crossattention.output" }, { "kind": "data", "source": "vision_model.embeddings", "target": "vision_model.encoder" }, { "kind": "data", "source": "vision_model.encoder", "target": "vision_model.post_layernorm" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer.attention" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer.attention.self" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer.crossattention" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer.crossattention.self" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer.crossattention.output" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer.crossattention.output.LayerNorm" }, { "kind": "mask", "source": "input:attention_mask", "target": "encoder_layer_2.self_attn" }, { "kind": "residual", "source": "encoder_layer", "target": "encoder_layer.attention" }, { "kind": "residual", "source": "encoder_layer", "target": "encoder_layer.crossattention" }, { "kind": "residual", "source": "encoder_layer", "target": "encoder_layer.intermediate" }, { "kind": "residual", "source": "encoder_layer_2", "target": "encoder_layer_2.self_attn" }, { "kind": "residual", "source": "encoder_layer_2", "target": "encoder_layer_2.mlp" }, { "kind": "position", "source": "text_model.embeddings.position_embeddings", "target": "text_model.embeddings" }, { "kind": "cross_attention", "source": "text_model.encoder", "target": "encoder_layer.crossattention" }, { "kind": "cross_attention", "source": "text_model.encoder", "target": "encoder_layer.crossattention.self" }, { "kind": "cross_attention", "source": "text_model.encoder", "target": "encoder_layer.crossattention.output" }, { "kind": "cross_attention", "source": "text_model.encoder", "target": "encoder_layer.crossattention.output.LayerNorm" }, { "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": "intra_module", "source": "encoder_layer_2.self_attn", "target": "encoder_layer_2.self_attn.qkv" }, { "kind": "data", "provenance": "intra_module", "source": "encoder_layer_2.self_attn", "target": "encoder_layer_2.self_attn.projection" }, { "kind": "data", "provenance": "intra_module", "source": "encoder_layer_2.mlp", "target": "encoder_layer_2.mlp.fc1" }, { "kind": "data", "provenance": "intra_module", "source": "encoder_layer_2.mlp.fc1", "target": "encoder_layer_2.mlp.fc2" }, { "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": "encoder_layer_2.layer_norm1", "target": "encoder_layer_2.self_attn" }, { "kind": "data", "provenance": "observed_forward", "source": "encoder_layer_2.self_attn", "target": "encoder_layer_2.layer_norm2" }, { "kind": "data", "provenance": "observed_forward", "source": "encoder_layer_2.layer_norm2", "target": "encoder_layer_2.mlp" }, { "kind": "data", "provenance": "observed_forward", "source": "vision_model", "target": "text_model" }, { "kind": "data", "provenance": "observed_forward", "source": "text_model", "target": "visual_projection" }, { "kind": "data", "provenance": "observed_forward", "source": "visual_projection", "target": "text_projection" } ], "extends": null, "model_type": "blip", "provenance": { "config_class": "BlipConfig", "config_module": "transformers.models.blip.configuration_blip", "model_class": "BlipModel", "model_module": "transformers.models.blip.modeling_blip" }, "repeats": [ { "body": "encoder_layer", "container_path_pattern": "model.text_model.encoder.layer", "count": 12, "count_expr": "12", "count_source": "module_tree", "id": "encoder_layers", "index_symbol": "i", "item_path_pattern": "model.text_model.encoder.layer.{i}", "kind": "symbolic_repeat", "provenance": { "class_name": "BlipTextLayer", "container_path_pattern": "model.text_model.encoder.layer", "item_path_pattern": "model.text_model.encoder.layer.{i}", "source": "module_tree_repeat_collapse" }, "repeated_class_name": "BlipTextLayer" }, { "body": "encoder_layer_2", "container_path_pattern": "model.vision_model.encoder.layers", "count": 12, "count_expr": "12", "count_source": "module_tree", "id": "encoder_layer_2s", "index_symbol": "i", "item_path_pattern": "model.vision_model.encoder.layers.{i}", "kind": "symbolic_repeat", "provenance": { "class_name": "BlipEncoderLayer", "container_path_pattern": "model.vision_model.encoder.layers", "item_path_pattern": "model.vision_model.encoder.layers.{i}", "source": "module_tree_repeat_collapse" }, "repeated_class_name": "BlipEncoderLayer" } ], "schema_version": "architecture-template-v0", "templates": [ { "children": [ "encoder_layer.attention", "encoder_layer.crossattention", "encoder_layer.intermediate", "encoder_layer.output" ], "class_name": "BlipTextLayer", "id": "encoder_layer", "kind": "transformer_block", "path_pattern": "model.text_model.encoder.layer.{i}" }, { "attributes": { "head_dim": 96, "n_heads": 8, "n_kv_heads": 8, "rope": false, "variant": "MHA" }, "children": [ "encoder_layer.attention.self", "encoder_layer.attention.output" ], "class_name": "BlipTextAttention", "id": "encoder_layer.attention", "kind": "attention", "path_pattern": "model.text_model.encoder.layer.{i}.attention" }, { "attributes": { "head_dim": 96, "n_heads": 8, "n_kv_heads": 8, "rope": false, "variant": "MHA" }, "children": [ "encoder_layer.attention.self.query", "encoder_layer.attention.self.key", "encoder_layer.attention.self.value" ], "class_name": "BlipTextSelfAttention", "id": "encoder_layer.attention.self", "kind": "attention", "path_pattern": "model.text_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.text_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.text_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.text_model.encoder.layer.{i}.attention.self.value" }, { "children": [ "encoder_layer.attention.output.LayerNorm" ], "class_name": "BlipTextSelfOutput", "id": "encoder_layer.attention.output", "kind": "module", "path_pattern": "model.text_model.encoder.layer.{i}.attention.output" }, { "attributes": { "norm_type": "layer" }, "class_name": "LayerNorm", "id": "encoder_layer.attention.output.LayerNorm", "kind": "normalization", "path_pattern": "model.text_model.encoder.layer.{i}.attention.output.LayerNorm" }, { "attributes": { "head_dim": 96, "n_heads": 8, "n_kv_heads": 8, "rope": false, "variant": "MHA" }, "children": [ "encoder_layer.crossattention.self", "encoder_layer.crossattention.output" ], "class_name": "BlipTextAttention", "id": "encoder_layer.crossattention", "kind": "cross_attention", "path_pattern": "model.text_model.encoder.layer.{i}.crossattention" }, { "attributes": { "head_dim": 96, "n_heads": 8, "n_kv_heads": 8, "rope": false, "variant": "MHA" }, "class_name": "BlipTextSelfAttention", "id": "encoder_layer.crossattention.self", "kind": "cross_attention", "path_pattern": "model.text_model.encoder.layer.{i}.crossattention.self" }, { "attributes": { "head_dim": 96, "n_heads": 8, "n_kv_heads": 8, "rope": false, "variant": "MHA" }, "children": [ "encoder_layer.crossattention.output.LayerNorm" ], "class_name": "BlipTextSelfOutput", "id": "encoder_layer.crossattention.output", "kind": "cross_attention", "path_pattern": "model.text_model.encoder.layer.{i}.crossattention.output" }, { "attributes": { "head_dim": 96, "n_heads": 8, "n_kv_heads": 8, "rope": false, "variant": "MHA" }, "class_name": "LayerNorm", "id": "encoder_layer.crossattention.output.LayerNorm", "kind": "cross_attention", "path_pattern": "model.text_model.encoder.layer.{i}.crossattention.output.LayerNorm" }, { "attributes": { "activation": "gelu", "hidden_size": 768, "intermediate_size": 3072 }, "children": [ "encoder_layer.intermediate.dense" ], "class_name": "BlipTextIntermediate", "id": "encoder_layer.intermediate", "kind": "feed_forward", "path_pattern": "model.text_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.text_model.encoder.layer.{i}.intermediate.dense" }, { "attributes": { "activation": "gelu", "hidden_size": 768, "intermediate_size": 3072 }, "children": [ "encoder_layer.output.dense", "encoder_layer.output.LayerNorm" ], "class_name": "BlipTextOutput", "id": "encoder_layer.output", "kind": "feed_forward", "path_pattern": "model.text_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.text_model.encoder.layer.{i}.output.dense" }, { "attributes": { "norm_type": "layer" }, "class_name": "LayerNorm", "id": "encoder_layer.output.LayerNorm", "kind": "normalization", "path_pattern": "model.text_model.encoder.layer.{i}.output.LayerNorm" }, { "children": [ "encoder_layer_2.self_attn", "encoder_layer_2.layer_norm1", "encoder_layer_2.mlp", "encoder_layer_2.layer_norm2" ], "class_name": "BlipEncoderLayer", "id": "encoder_layer_2", "kind": "transformer_block", "path_pattern": "model.vision_model.encoder.layers.{i}" }, { "attributes": { "head_dim": 64, "n_heads": 12, "n_kv_heads": 12, "rope": false, "variant": "MHA" }, "children": [ "encoder_layer_2.self_attn.qkv", "encoder_layer_2.self_attn.projection" ], "class_name": "BlipAttention", "id": "encoder_layer_2.self_attn", "kind": "attention", "path_pattern": "model.vision_model.encoder.layers.{i}.self_attn" }, { "attributes": { "in_features": "config.hidden_size", "out_features": 2304 }, "class_name": "Linear", "id": "encoder_layer_2.self_attn.qkv", "kind": "projection", "path_pattern": "model.vision_model.encoder.layers.{i}.self_attn.qkv" }, { "attributes": { "in_features": "config.hidden_size", "out_features": "config.hidden_size" }, "class_name": "Linear", "id": "encoder_layer_2.self_attn.projection", "kind": "projection", "path_pattern": "model.vision_model.encoder.layers.{i}.self_attn.projection" }, { "attributes": { "norm_type": "layer" }, "class_name": "LayerNorm", "id": "encoder_layer_2.layer_norm1", "kind": "normalization", "path_pattern": "model.vision_model.encoder.layers.{i}.layer_norm1" }, { "attributes": { "activation": "gelu", "hidden_size": 768, "intermediate_size": 3072 }, "children": [ "encoder_layer_2.mlp.fc1", "encoder_layer_2.mlp.fc2" ], "class_name": "BlipMLP", "id": "encoder_layer_2.mlp", "kind": "feed_forward", "path_pattern": "model.vision_model.encoder.layers.{i}.mlp" }, { "attributes": { "in_features": "config.hidden_size", "out_features": "config.intermediate_size" }, "class_name": "Linear", "id": "encoder_layer_2.mlp.fc1", "kind": "projection", "path_pattern": "model.vision_model.encoder.layers.{i}.mlp.fc1" }, { "attributes": { "in_features": "config.intermediate_size", "out_features": "config.hidden_size" }, "class_name": "Linear", "id": "encoder_layer_2.mlp.fc2", "kind": "projection", "path_pattern": "model.vision_model.encoder.layers.{i}.mlp.fc2" }, { "attributes": { "norm_type": "layer" }, "class_name": "LayerNorm", "id": "encoder_layer_2.layer_norm2", "kind": "normalization", "path_pattern": "model.vision_model.encoder.layers.{i}.layer_norm2" } ] }