IDEA-Research/grounding-dino-tiny
Original172.3Mparameters
Fixture7.7Mparameters
Layer stacks7compared
Findings0to review
✓ Same architecture, smaller
Every module class, layer kind and checked property of the original is in the fixture.
Layer stacks
One square per layer, colored by kind: the layer's module classes and type attributes. Hover a square for its index and kind.
model.backbone.conv_encoder.model.swin.encoder.layers
Original · 4
Fixture · 4
| Kind | Original | Fixture | |
|---|---|---|---|
| SwinPatchMerging | 3 | 3 | ✓ kept |
| no SwinPatchMerging | 1 | 1 | ✓ kept |
model.input_proj_vision
Original · 4
Fixture · 4
| Kind | Original | Fixture | |
|---|---|---|---|
| Conv2d | 4 | 4 | ✓ kept |
model.text_backbone.encoder.layer
Original · 12
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| BertLayer | 12 | 2 | ✓ kept |
model.encoder.layers
Original · 6
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| FusionLayer | 6 | 2 | ✓ kept |
model.decoder.layers
Original · 6
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| DecoderLayer | 6 | 2 | ✓ kept |
model.decoder.bbox_embed
Original · 6
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| Linear | 6 | 2 | ✓ kept |
bbox_embed
Original · 6
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| Linear | 6 | 2 | ✓ kept |
Where the parameters are
Share of each model's parameters per component. Vocabulary and patch sizes are kept, so embeddings usually take a larger share of the fixture.
Original
Fixture
| Component | Original | Share | Fixture | Share |
|---|---|---|---|---|
| model.text_backbone.encoder.layer | 85.1M | 49.4% | 66.9K | 0.9% |
| model.backbone.conv_encoder.model.swin.encoder.layers | 27.5M | 16.0% | 4.9M | 63.4% |
| model.text_backbone | 23.8M | 13.8% | 2.0M | 25.7% |
| model.encoder.layers | 21.9M | 12.7% | 176.4K | 2.3% |
| model.decoder.layers | 10.9M | 6.3% | 142.3K | 1.8% |
| model.input_proj_vision | 2.1M | 1.2% | 353.0K | 4.6% |
| model.query_position_embeddings | 230.4K | 0.1% | 57.6K | 0.7% |
| 8 others | 736.2K | 0.4% | 44.5K | 0.6% |
Preserved properties
| Config | Property | Original | Fixture | |
|---|---|---|---|---|
| model | model_type | grounding-dino | grounding-dino | ✓ kept |
| model | tie_word_embeddings | True | True | ✓ kept |
| backbone_config | model_type | swin | swin | ✓ kept |
| backbone_config | hidden_act | gelu | gelu | ✓ kept |
| backbone_config | image_size | 224 | 224 | ✓ kept |
| backbone_config | patch_size | 4 | 4 | ✓ kept |
| backbone_config | num_channels | 3 | 3 | ✓ kept |
| text_config | model_type | bert | bert | ✓ kept |
| text_config | vocab_size | 30522 | 30522 | ✓ kept |
| text_config | tie_word_embeddings | True | True | ✓ kept |
| text_config | hidden_act | gelu | gelu | ✓ kept |
| text_config | max_position_embeddings | 512 | 512 | ✓ kept |
Module classes
Instances of each class in the built model (prefix GroundingDino omitted).
| Class | Original | Fixture |
|---|---|---|
| Linear | 382 | 122 |
| LayerNorm | 119 | 43 |
| Dropout | 68 | 18 |
| ModuleList | 26 | 18 |
| GELUActivation | 24 | 6 |
| MultiheadAttention | 18 | 6 |
| ReLU | 18 | 6 |
| MLPPredictionHead | 14 | 6 |
| BertAttention | 12 | 2 |
| BertIntermediate | 12 | 2 |
| BertLayer | 12 | 2 |
| BertOutput | 12 | 2 |
| BertSelfAttention | 12 | 2 |
| BertSelfOutput | 12 | 2 |
| MultiscaleDeformableAttention | 12 | 4 |
| MultiScaleDeformableAttention | 12 | 4 |
| SwinAttention | 12 | 4 |
| SwinLayer | 12 | 4 |
| SwinMLP | 12 | 4 |
| SwinRelativePositionBias | 12 | 4 |
| SwinDropPath | 11 | 3 |
| ContrastiveEmbedding | 7 | 3 |
| BiMultiHeadAttention | 6 | 2 |
| DecoderLayer | 6 | 2 |
| DeformableLayer | 6 | 2 |
| DropPath | 6 | 2 |
| EncoderLayer | 6 | 2 |
| FusionLayer | 6 | 2 |
| TextEnhancerLayer | 6 | 2 |
| Conv2d | 5 | 5 |
| Embedding | 4 | 4 |
| GroupNorm | 4 | 4 |
| Sequential | 4 | 4 |
| SwinStage | 4 | 4 |
| SwinPatchMerging | 3 | 3 |
| BertEmbeddings | 1 | 1 |
| BertEncoder | 1 | 1 |
| BertModel | 1 | 1 |
| ConvEncoder | 1 | 1 |
| ConvModel | 1 | 1 |
| Decoder | 1 | 1 |
| Encoder | 1 | 1 |
| ForObjectDetection | 1 | 1 |
| Model | 1 | 1 |
| SinePositionEmbedding | 1 | 1 |
| Identity | 1 | 1 |
| ModuleDict | 1 | 1 |
| SwinBackbone | 1 | 1 |
| SwinEmbeddings | 1 | 1 |
| SwinEncoder | 1 | 1 |
| SwinModel | 1 | 1 |
| SwinPatchEmbeddings | 1 | 1 |
Config changes
16 fields changed, 91 unchanged.
| Field | Original | Fixture |
|---|---|---|
| backbone_config.depths | [2, 2, 6, 2] | [1, 1, 1, 1] |
| backbone_config.embed_dim | 96 | 64 |
| backbone_config.hidden_size | 768 | 64 |
| backbone_config.num_heads | [3, 6, 12, 24] | [2, 4, 8, 16] |
| backbone_config.num_layers | 4 | 2 |
| d_model | 256 | 64 |
| decoder_attention_heads | 8 | 4 |
| decoder_ffn_dim | 2048 | 128 |
| decoder_layers | 6 | 2 |
| encoder_attention_heads | 8 | 4 |
| encoder_ffn_dim | 2048 | 128 |
| encoder_layers | 6 | 2 |
| text_config.hidden_size | 768 | 64 |
| text_config.intermediate_size | 3072 | 128 |
| text_config.num_attention_heads | 12 | 4 |
| text_config.num_hidden_layers | 12 | 2 |