| { |
| "architecture": { |
| "family": "image_classification", |
| "is_moe": false, |
| "view": "encoder" |
| }, |
| "capabilities": { |
| "task_heads": [ |
| "backbone", |
| "image", |
| "image_classification", |
| "masked_image_modeling" |
| ], |
| "tensor_parallel": false |
| }, |
| "components": [ |
| { |
| "children": [ |
| "embeddings", |
| "encoder", |
| "layernorm", |
| "pooler" |
| ], |
| "class_name": "FocalNetModel", |
| "id": "model", |
| "kind": "model", |
| "path_pattern": "model" |
| }, |
| { |
| "attributes": {}, |
| "children": [ |
| "embeddings.patch_embeddings", |
| "embeddings.norm" |
| ], |
| "class_name": "FocalNetEmbeddings", |
| "id": "embeddings", |
| "kind": "embedding", |
| "path_pattern": "model.embeddings" |
| }, |
| { |
| "attributes": {}, |
| "children": [ |
| "embeddings.patch_embeddings.projection" |
| ], |
| "class_name": "FocalNetPatchEmbeddings", |
| "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" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "embeddings.norm", |
| "kind": "normalization", |
| "path_pattern": "model.embeddings.norm" |
| }, |
| { |
| "children": [ |
| "encoder_focal_net_stages" |
| ], |
| "class_name": "FocalNetEncoder", |
| "id": "encoder", |
| "kind": "encoder", |
| "path_pattern": "model.encoder" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "layernorm", |
| "kind": "normalization", |
| "path_pattern": "model.layernorm" |
| }, |
| { |
| "class_name": "AdaptiveAvgPool1d", |
| "id": "pooler", |
| "kind": "pooler", |
| "path_pattern": "model.pooler" |
| } |
| ], |
| "config": { |
| "class_name": "FocalNetConfig", |
| "model_type": "focalnet", |
| "module": "transformers.models.focalnet.configuration_focalnet", |
| "referenced_fields": { |
| "depths": [ |
| 2, |
| 2, |
| 6, |
| 2 |
| ] |
| }, |
| "salient_fields": { |
| "hidden_act": "gelu", |
| "is_encoder_decoder": false |
| } |
| }, |
| "dataflow": { |
| "input": { |
| "name": "pixel_values", |
| "shape": [ |
| "B", |
| 3, |
| 224, |
| 224 |
| ] |
| }, |
| "output": { |
| "shape": [ |
| "B", |
| 49, |
| 768 |
| ] |
| }, |
| "shapes": { |
| "embeddings": { |
| "in": [ |
| "B", |
| 3, |
| 224, |
| 224 |
| ], |
| "out": [ |
| "B", |
| 3136, |
| 96 |
| ] |
| }, |
| "encoder": { |
| "in": [ |
| "B", |
| 3136, |
| 96 |
| ], |
| "out": [ |
| "B", |
| 49, |
| 768 |
| ] |
| }, |
| "layernorm": { |
| "in": [ |
| "B", |
| 49, |
| 768 |
| ], |
| "out": [ |
| "B", |
| 49, |
| 768 |
| ] |
| }, |
| "pooler": { |
| "in": [ |
| "B", |
| 768, |
| 49 |
| ], |
| "out": [ |
| "B", |
| 768, |
| 1 |
| ] |
| } |
| }, |
| "source": "observed_forward_meta" |
| }, |
| "edges": [ |
| { |
| "kind": "data", |
| "source": "embeddings", |
| "target": "encoder" |
| }, |
| { |
| "kind": "data", |
| "source": "encoder", |
| "target": "layernorm" |
| }, |
| { |
| "kind": "data", |
| "source": "layernorm", |
| "target": "pooler" |
| }, |
| { |
| "kind": "data", |
| "source": "embeddings.patch_embeddings", |
| "target": "embeddings.norm" |
| }, |
| { |
| "kind": "data", |
| "source": "encoder_layers", |
| "target": "encoder_focal_net_stage.downsample" |
| }, |
| { |
| "kind": "data", |
| "source": "encoder_layer.norm2", |
| "target": "encoder_layer.mlp" |
| }, |
| { |
| "kind": "residual", |
| "source": "encoder_layer", |
| "target": "encoder_layer.mlp" |
| }, |
| { |
| "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" |
| } |
| ], |
| "extends": null, |
| "model_type": "focalnet", |
| "provenance": { |
| "config_class": "FocalNetConfig", |
| "config_module": "transformers.models.focalnet.configuration_focalnet", |
| "model_class": "FocalNetModel", |
| "model_module": "transformers.models.focalnet.modeling_focalnet" |
| }, |
| "repeats": [ |
| { |
| "body": "encoder_focal_net_stage", |
| "container_path_pattern": "model.encoder.stages", |
| "count": 4, |
| "count_expr": "4", |
| "count_source": "module_tree", |
| "id": "encoder_focal_net_stages", |
| "index_symbol": "i", |
| "item_path_pattern": "model.encoder.stages.{i}", |
| "kind": "symbolic_repeat", |
| "provenance": { |
| "class_name": "FocalNetStage", |
| "container_path_pattern": "model.encoder.stages", |
| "item_path_pattern": "model.encoder.stages.{i}", |
| "source": "module_tree_repeat_collapse" |
| }, |
| "repeated_class_name": "FocalNetStage" |
| }, |
| { |
| "body": "encoder_layer", |
| "container_path_pattern": "model.encoder.stages.{i}.layers", |
| "count": 2, |
| "count_expr": "config.depths[i]", |
| "count_source": "config", |
| "id": "encoder_layers", |
| "index_symbol": "j", |
| "item_path_pattern": "model.encoder.stages.{i}.layers.{j}", |
| "kind": "symbolic_repeat", |
| "provenance": { |
| "class_name": "FocalNetLayer", |
| "container_path_pattern": "model.encoder.stages.{i}.layers", |
| "item_path_pattern": "model.encoder.stages.{i}.layers.{j}", |
| "source": "module_tree_repeat_collapse" |
| }, |
| "repeated_class_name": "FocalNetLayer" |
| }, |
| { |
| "body": "encoder_layer_2", |
| "container_path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.focal_layers", |
| "count": 2, |
| "count_expr": "2", |
| "count_source": "module_tree", |
| "id": "encoder_layer_2s", |
| "index_symbol": "k", |
| "item_path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.focal_layers.{k}", |
| "kind": "symbolic_repeat", |
| "provenance": { |
| "class_name": "Sequential", |
| "container_path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.focal_layers", |
| "item_path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.focal_layers.{k}", |
| "source": "module_tree_repeat_collapse" |
| }, |
| "repeated_class_name": "Sequential" |
| } |
| ], |
| "schema_version": "architecture-template-v0", |
| "templates": [ |
| { |
| "children": [ |
| "encoder_layers", |
| "encoder_focal_net_stage.downsample" |
| ], |
| "class_name": "FocalNetStage", |
| "id": "encoder_focal_net_stage", |
| "kind": "module", |
| "path_pattern": "model.encoder.stages.{i}" |
| }, |
| { |
| "attributes": {}, |
| "children": [ |
| "encoder_focal_net_stage.downsample.projection", |
| "encoder_focal_net_stage.downsample.norm" |
| ], |
| "class_name": "FocalNetPatchEmbeddings", |
| "id": "encoder_focal_net_stage.downsample", |
| "kind": "embedding", |
| "path_pattern": "model.encoder.stages.{i}.downsample" |
| }, |
| { |
| "class_name": "Conv2d", |
| "id": "encoder_focal_net_stage.downsample.projection", |
| "kind": "convolution", |
| "path_pattern": "model.encoder.stages.{i}.downsample.projection" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_focal_net_stage.downsample.norm", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.stages.{i}.downsample.norm" |
| }, |
| { |
| "children": [ |
| "encoder_layer.norm1", |
| "encoder_layer.modulation", |
| "encoder_layer.norm2", |
| "encoder_layer.mlp" |
| ], |
| "class_name": "FocalNetLayer", |
| "id": "encoder_layer", |
| "kind": "transformer_block", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_layer.norm1", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.norm1" |
| }, |
| { |
| "children": [ |
| "encoder_layer.modulation.projection_context", |
| "encoder_layer_2s" |
| ], |
| "class_name": "FocalNetModulation", |
| "id": "encoder_layer.modulation", |
| "kind": "module", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation" |
| }, |
| { |
| "class_name": "Conv2d", |
| "id": "encoder_layer.modulation.projection_context", |
| "kind": "convolution", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.projection_context" |
| }, |
| { |
| "attributes": { |
| "norm_type": "layer" |
| }, |
| "class_name": "LayerNorm", |
| "id": "encoder_layer.norm2", |
| "kind": "normalization", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.norm2" |
| }, |
| { |
| "attributes": { |
| "activation": "gelu" |
| }, |
| "children": [ |
| "encoder_layer.mlp.fc1", |
| "encoder_layer.mlp.fc2" |
| ], |
| "class_name": "FocalNetMlp", |
| "id": "encoder_layer.mlp", |
| "kind": "feed_forward", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.mlp" |
| }, |
| { |
| "attributes": { |
| "in_features": 96, |
| "out_features": 384 |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.mlp.fc1", |
| "kind": "projection", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.mlp.fc1" |
| }, |
| { |
| "attributes": { |
| "in_features": 384, |
| "out_features": 96 |
| }, |
| "class_name": "Linear", |
| "id": "encoder_layer.mlp.fc2", |
| "kind": "projection", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.mlp.fc2" |
| }, |
| { |
| "children": [ |
| "encoder_layer_2.0" |
| ], |
| "class_name": "Sequential", |
| "id": "encoder_layer_2", |
| "kind": "module", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.focal_layers.{k}" |
| }, |
| { |
| "class_name": "Conv2d", |
| "id": "encoder_layer_2.0", |
| "kind": "convolution", |
| "path_pattern": "model.encoder.stages.{i}.layers.{j}.modulation.focal_layers.{k}.0" |
| } |
| ] |
| } |
|
|