facebook/mask2former-swin-tiny-coco-instance
Original47.4Mparameters
Fixture8.0Mparameters
Layer stacks4compared
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.pixel_level_module.encoder.swin.encoder.layers
Original · 4
Fixture · 4
| Kind | Original | Fixture | |
|---|---|---|---|
| SwinPatchMerging | 3 | 3 | ✓ kept |
| no SwinPatchMerging | 1 | 1 | ✓ kept |
model.pixel_level_module.decoder.input_projections
Original · 3
Fixture · 3
| Kind | Original | Fixture | |
|---|---|---|---|
| Conv2d | 3 | 3 | ✓ kept |
model.pixel_level_module.decoder.encoder.layers
Original · 6
Fixture · 2
| Kind | Original | Fixture | |
|---|---|---|---|
| FormerPixelDecoderEncoderLayer | 6 | 2 | ✓ kept |
model.transformer_module.decoder.layers
Original · 9
Fixture · 1
| Kind | Original | Fixture | |
|---|---|---|---|
| FormerMaskedAttentionDecoderLayer | 9 | 1 | ✓ 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.pixel_level_module.encoder.swin.encoder.layers | 27.5M | 58.0% | 4.9M | 60.7% |
| model.transformer_module.decoder.layers | 14.2M | 30.0% | 659.3K | 8.2% |
| model.pixel_level_module.decoder.encoder.layers | 4.4M | 9.3% | 1.4M | 17.3% |
| model.pixel_level_module | 691.3K | 1.5% | 680.0K | 8.4% |
| model.pixel_level_module.decoder.input_projections | 346.4K | 0.7% | 231.7K | 2.9% |
| model.transformer_module | 249.9K | 0.5% | 191.0K | 2.4% |
| class_predictor | 20.8K | 0.0% | 10.4K | 0.1% |
Preserved properties
| Config | Property | Original | Fixture | |
|---|---|---|---|---|
| model | model_type | mask2former | mask2former | ✓ kept |
| backbone_config | model_type | swin | swin | ✓ kept |
| backbone_config | tie_word_embeddings | True | True | ✓ 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 |
Module classes
Instances of each class in the built model (prefix Mask2 omitted).
| Class | Original | Fixture |
|---|---|---|
| Linear | 169 | 49 |
| LayerNorm | 73 | 25 |
| Dropout | 13 | 5 |
| GELUActivation | 12 | 4 |
| ReLU | 12 | 4 |
| SwinAttention | 12 | 4 |
| SwinLayer | 12 | 4 |
| SwinMLP | 12 | 4 |
| SwinRelativePositionBias | 12 | 4 |
| SwinDropPath | 11 | 3 |
| FormerAttention | 9 | 1 |
| FormerMaskedAttentionDecoderLayer | 9 | 1 |
| ModuleList | 9 | 9 |
| MultiheadAttention | 9 | 1 |
| NonDynamicallyQuantizableLinear | 9 | 1 |
| Sequential | 8 | 5 |
| Conv2d | 7 | 10 |
| FormerPixelDecoderEncoderLayer | 6 | 2 |
| FormerPixelDecoderEncoderMultiscaleDeformableAttention | 6 | 2 |
| GroupNorm | 5 | 5 |
| SwinStage | 4 | 4 |
| Embedding | 3 | 3 |
| FormerPredictionBlock | 3 | 3 |
| SwinPatchMerging | 3 | 3 |
| Identity | 2 | 2 |
| FormerSinePositionEmbedding | 2 | 2 |
| FormerForUniversalSegmentation | 1 | 1 |
| FormerHungarianMatcher | 1 | 1 |
| FormerLoss | 1 | 1 |
| FormerMLPPredictionHead | 1 | 1 |
| FormerMaskPredictor | 1 | 1 |
| FormerMaskedAttentionDecoder | 1 | 1 |
| FormerModel | 1 | 1 |
| FormerPixelDecoder | 1 | 1 |
| FormerPixelDecoderEncoderOnly | 1 | 1 |
| FormerPixelLevelModule | 1 | 1 |
| FormerTransformerModule | 1 | 1 |
| ModuleDict | 1 | 1 |
| SwinBackbone | 1 | 1 |
| SwinEmbeddings | 1 | 1 |
| SwinEncoder | 1 | 1 |
| SwinModel | 1 | 1 |
| SwinPatchEmbeddings | 1 | 1 |
Config changes
9 fields changed, 78 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 |
| decoder_layers | 10 | 2 |
| encoder_layers | 6 | 2 |
| hidden_dim | 256 | 128 |
| num_attention_heads | 8 | 4 |