Different weights in ViTMAEModel and ViTMAEForPreTraining
Author: Richar-Du
Pull request: no

@NielsRogge 
Thanks for the implementation of MAE! I noticed that the weights in ViTMAEModel and the weights in ViTMAEForPreTraining.vit are different.  However, they are actually the same model. I wonder there is some errors when calling `model = ViTMAEModel.from_pretrained("facebook/vit-mae-base")`, because lots of weights in the encoder are randomly initialized.

Some weights of the model checkpoint at facebook/vit-mae-base were not used when initializing ViTMAEModel: ['vit.encoder.layer.9.intermediate.dense.bias', 'decoder.decoder_layers.5.attention.attention.value.weight', 'decoder.decoder_layers.4.output.dense.bias', 'vit.encoder.layer.8.intermediate.dense.weight', 'decoder.decoder_layers.3.layernorm_after.weight', 'decoder.decoder_pred.bias', 'vit.encoder.layer.2.layernorm_before.bias', 'decoder.decoder_layers.1.attention.attention.value.bias', 'decoder.decoder_layers.4.attention.attention.key.bias', 'vit.encoder.layer.8.intermediate.dense.bias', 'vit.encoder.layer.2.attention.output.dense.weight', 'decoder.decoder_layers.6.attention.output.dense.bias', 'vit.encoder.layer.8.layernorm_before.weight', 'vit.encoder.layer.8.layernorm_after.bias', 'vit.encoder.layer.11.attention.attention.query.bias', 'decoder.decoder_layers.4.output.dense.weight', 'vit.encoder.layer.1.layernorm_before.bias', 'vit.encoder.layer.0.attention.attention.key.bias', 'vit.encoder.layer.11.attention.attention.query.weight', 'decoder.decoder_layers.2.attention.attention.key.bias', 'vit.encoder.layer.3.layernorm_after.weight', 'vit.encoder.layer.5.layernorm_after.bias', 'decoder.decoder_layers.3.layernorm_after.bias', 'vit.encoder.layer.6.attention.attention.key.bias', 'decoder.decoder_layers.1.attention.attention.value.weight', 'vit.encoder.layer.4.attention.attention.value.weight', 'decoder.decoder_layers.3.output.dense.bias', 'vit.encoder.layer.3.attention.output.dense.bias', 'vit.encoder.layer.1.output.dense.weight', 'vit.encoder.layer.2.attention.attention.query.bias', 'vit.encoder.layer.11.intermediate.dense.weight', 'vit.encoder.layer.1.attention.attention.query.bias', 'decoder.decoder_embed.bias', 'decoder.decoder_layers.4.attention.attention.value.bias', 'decoder.decoder_layers.6.attention.attention.query.weight', 'decoder.decoder_layers.3.attention.attention.key.bias', 'vit.encoder.layer.10.attention.output.dense.bias', 'vit.encoder.layer.6.layernorm_after.bias', 'decoder.decoder_layers.0.intermediate.dense.bias', 'vit.encoder.layer.2.output.dense.weight', 'decoder.decoder_layers.6.layernorm_before.weight', 'vit.encoder.layer.11.layernorm_after.bias', 'vit.encoder.layer.11.output.dense.bias', 'vit.encoder.layer.10.attention.output.dense.weight', 'decoder.decoder_layers.5.attention.attention.value.bias', 'vit.encoder.layer.10.intermediate.dense.weight', 'vit.encoder.layer.0.attention.attention.key.weight', 'vit.encoder.layer.7.output.dense.bias', 'vit.encoder.layer.6.intermediate.dense.weight', 'vit.encoder.layer.8.attention.attention.query.bias', 'vit.encoder.layer.1.attention.attention.query.weight', 'vit.encoder.layer.10.layernorm_after.bias', 'vit.encoder.layer.1.layernorm_after.bias', 'vit.encoder.layer.5.layernorm_before.bias', 'decoder.decoder_layers.5.attention.output.dense.bias', 'vit.encoder.layer.7.attention.attention.value.bias', 'decoder.decoder_norm.weight', 'decoder.decoder_layers.6.attention.attention.query.bias', 'decoder.decoder_layers.7.attention.attention.query.weight', 'vit.encoder.layer.10.attention.attention.key.bias', 'vit.encoder.layer.5.attention.attention.key.weight', 'decoder.decoder_layers.1.attention.attention.query.weight', 'vit.encoder.layer.7.layernorm_after.weight', 'vit.encoder.layer.2.output.dense.bias', 'vit.encoder.layer.10.output.dense.weight', 'vit.encoder.layer.8.attention.attention.value.weight', 'vit.encoder.layer.9.output.dense.weight', 'decoder.decoder_layers.0.attention.attention.value.bias', 'vit.encoder.layer.3.attention.attention.key.bias', 'decoder.decoder_layers.4.intermediate.dense.weight', 'vit.encoder.layer.9.attention.attention.key.weight', 'decoder.decoder_layers.7.attention.attention.value.bias', 'vit.encoder.layer.5.attention.attention.value.weight', 'vit.encoder.layer.9.output.dense.bias', 'decoder.decoder_layers.7.attention.attention.query.bias', 'vit.encoder.layer.2.layernorm_after.bias', 'vit.encoder.layer.5.output.dense.weight', 'vit.encoder.layer.3.intermediate.dense.bias', 'vit.encoder.layer.0.attention.output.dense.bias', 'decoder.decoder_layers.0.attention.attention.key.weight', 'vit.encoder.layer.0.layernorm_before.bias', 'vit.encoder.layer.0.intermediate.dense.bias', 'vit.encoder.layer.7.layernorm_after.bias', 'vit.encoder.layer.4.attention.output.dense.bias', 'decoder.decoder_layers.7.attention.attention.value.weight', 'vit.encoder.layer.7.attention.attention.key.weight', 'vit.encoder.layer.2.attention.attention.value.weight', 'vit.embeddings.patch_embeddings.projection.bias', 'vit.embeddings.patch_embeddings.projection.weight', 'vit.encoder.layer.9.intermediate.dense.weight', 'decoder.decoder_layers.4.layernorm_before.bias', 'vit.encoder.layer.0.layernorm_before.weight', 'decoder.decoder_layers.7.intermediate.dense.weight', 'decoder.decoder_layers.1.output.dense.bias', 'vit.encoder.layer.2.attention.attention.value.bias', 'vit.encoder.layer.6.attention.attention.query.bias', 'decoder.decoder_layers.2.output.dense.weight', 'decoder.decoder_layers.5.attention.attention.query.weight', 'decoder.decoder_layers.3.attention.attention.value.weight', 'vit.encoder.layer.10.attention.attention.value.bias', 'decoder.decoder_layers.2.layernorm_after.weight', 'decoder.decoder_layers.5.attention.attention.key.bias', 'vit.encoder.layer.10.attention.attention.value.weight', 'vit.encoder.layer.0.layernorm_after.bias', 'vit.encoder.layer.11.output.dense.weight', 'vit.encoder.layer.5.attention.attention.query.weight', 'decoder.decoder_layers.4.attention.output.dense.weight', 'vit.encoder.layer.3.layernorm_after.bias', 'vit.encoder.layer.4.intermediate.dense.bias', 'vit.encoder.layer.7.intermediate.dense.weight', 'vit.encoder.layer.6.attention.attention.query.weight', 'vit.encoder.layer.2.layernorm_before.weight', 'decoder.decoder_layers.5.attention.output.dense.weight', 'vit.encoder.layer.9.attention.output.dense.weight', 'vit.encoder.layer.5.intermediate.dense.bias', 'decoder.decoder_layers.4.attention.attention.value.weight', 'decoder.decoder_layers.1.layernorm_before.weight', 'decoder.decoder_layers.3.attention.output.dense.bias', 'vit.encoder.layer.6.attention.attention.value.bias', 'vit.encoder.layer.10.layernorm_before.weight', 'vit.encoder.layer.6.output.dense.bias', 'vit.encoder.layer.3.layernorm_before.bias', 'decoder.decoder_layers.2.output.dense.bias', 'vit.encoder.layer.10.attention.attention.query.bias', 'decoder.decoder_layers.4.layernorm_before.weight', 'decoder.decoder_layers.3.attention.attention.query.bias', 'decoder.decoder_layers.2.attention.attention.query.weight', 'vit.encoder.layer.11.attention.attention.value.bias', 'vit.encoder.layer.3.intermediate.dense.weight', 'vit.encoder.layer.8.output.dense.weight', 'decoder.decoder_layers.2.attention.attention.value.bias', 'vit.encoder.layer.5.output.dense.bias', 'decoder.decoder_layers.2.layernorm_before.bias', 'vit.layernorm.weight', 'decoder.decoder_layers.2.layernorm_before.weight', 'vit.encoder.layer.2.intermediate.dense.weight', 'decoder.decoder_layers.3.layernorm_before.bias', 'vit.encoder.layer.10.layernorm_after.weight', 'vit.encoder.layer.9.attention.attention.key.bias', 'decoder.decoder_layers.0.attention.attention.value.weight', 'decoder.decoder_layers.1.attention.attention.key.bias', 'vit.encoder.layer.4.attention.attention.value.bias', 'vit.encoder.layer.7.attention.attention.key.bias', 'vit.encoder.layer.1.attention.attention.key.weight', 'decoder.decoder_layers.3.intermediate.dense.weight', 'vit.encoder.layer.6.attention.output.dense.weight', 'decoder.decoder_pos_embed', 'decoder.decoder_layers.3.attention.attention.value.bias', 'decoder.decoder_layers.1.attention.output.dense.weight', 'vit.encoder.layer.5.attention.attention.key.bias', 'vit.encoder.layer.10.output.dense.bias', 'vit.encoder.layer.8.attention.output.dense.weight', 'decoder.decoder_layers.5.attention.attention.key.weight', 'vit.encoder.layer.7.attention.output.dense.bias', 'vit.encoder.layer.2.intermediate.dense.bias', 'decoder.decoder_layers.2.attention.attention.key.weight', 'decoder.decoder_pred.weight', 'vit.encoder.layer.5.attention.attention.query.bias', 'vit.encoder.layer.5.layernorm_before.weight', 'vit.encoder.layer.1.attention.attention.key.bias', 'vit.encoder.layer.4.intermediate.dense.weight', 'vit.encoder.layer.9.layernorm_before.bias', 'vit.encoder.layer.8.output.dense.bias', 'vit.encoder.layer.3.attention.attention.key.weight', 'vit.encoder.layer.8.attention.attention.key.bias', 'vit.encoder.layer.2.attention.output.dense.bias', 'vit.encoder.layer.1.output.dense.bias', 'decoder.decoder_layers.4.intermediate.dense.bias', 'decoder.decoder_layers.3.layernorm_before.weight', 'vit.encoder.layer.11.layernorm_before.weight', 'vit.encoder.layer.2.layernorm_after.weight', 'decoder.decoder_layers.4.attention.attention.query.bias', 'vit.encoder.layer.5.attention.attention.value.bias', 'vit.encoder.layer.6.layernorm_after.weight', 'decoder.decoder_layers.1.intermediate.dense.weight', 'decoder.decoder_layers.2.intermediate.dense.weight', 'vit.encoder.layer.5.intermediate.dense.weight', 'decoder.decoder_layers.7.output.dense.bias', 'decoder.decoder_layers.7.layernorm_after.bias', 'vit.encoder.layer.1.attention.output.dense.bias', 'decoder.decoder_layers.4.attention.output.dense.bias', 'decoder.decoder_layers.5.output.dense.weight', 'vit.encoder.layer.6.attention.attention.value.weight', 'decoder.decoder_layers.2.intermediate.dense.bias', 'vit.encoder.layer.7.attention.attention.query.bias', 'vit.encoder.layer.8.layernorm_before.bias', 'vit.encoder.layer.3.attention.attention.query.weight', 'vit.encoder.layer.0.attention.attention.value.bias', 'vit.encoder.layer.0.output.dense.weight', 'decoder.decoder_layers.3.output.dense.weight', 'vit.encoder.layer.11.attention.attention.value.weight', 'vit.encoder.layer.0.attention.output.dense.weight', 'decoder.decoder_layers.3.attention.attention.key.weight', 'decoder.decoder_layers.5.layernorm_before.weight', 'vit.encoder.layer.9.layernorm_after.weight', 'vit.encoder.layer.8.attention.output.dense.bias', 'decoder.decoder_layers.0.intermediate.dense.weight', 'vit.encoder.layer.6.output.dense.weight', 'decoder.decoder_layers.1.intermediate.dense.bias', 'vit.encoder.layer.2.attention.attention.query.weight', 'decoder.decoder_layers.1.attention.attention.key.weight', 'vit.encoder.layer.3.output.dense.weight', 'vit.encoder.layer.9.attention.output.dense.bias', 'vit.encoder.layer.11.intermediate.dense.bias', 'decoder.decoder_layers.1.output.dense.weight', 'vit.encoder.layer.4.layernorm_after.bias', 'vit.encoder.layer.11.attention.output.dense.weight', 'decoder.decoder_layers.6.attention.attention.value.bias', 'vit.encoder.layer.7.intermediate.dense.bias', 'decoder.decoder_layers.7.attention.output.dense.bias', 'vit.encoder.layer.4.attention.attention.query.weight', 'vit.encoder.layer.3.attention.attention.value.weight', 'decoder.decoder_layers.3.intermediate.dense.bias', 'vit.embeddings.position_embeddings', 'vit.encoder.layer.3.attention.attention.query.bias', 'vit.encoder.layer.1.intermediate.dense.bias', 'decoder.decoder_layers.6.layernorm_before.bias', 'vit.encoder.layer.11.layernorm_after.weight', 'decoder.decoder_layers.5.attention.attention.query.bias', 'decoder.decoder_layers.1.layernorm_after.weight', 'decoder.decoder_layers.5.intermediate.dense.bias', 'vit.encoder.layer.0.layernorm_after.weight', 'vit.encoder.layer.11.attention.attention.key.weight', 'vit.encoder.layer.3.attention.output.dense.weight', 'decoder.decoder_layers.0.layernorm_after.bias', 'vit.encoder.layer.9.attention.attention.query.weight', 'decoder.decoder_layers.1.layernorm_before.bias', 'vit.layernorm.bias', 'decoder.decoder_layers.5.output.dense.bias', 'vit.encoder.layer.1.layernorm_before.weight', 'decoder.decoder_layers.1.attention.attention.query.bias', 'decoder.decoder_layers.7.intermediate.dense.bias', 'decoder.decoder_layers.1.attention.output.dense.bias', 'decoder.decoder_layers.0.layernorm_before.bias', 'vit.encoder.layer.4.attention.attention.key.weight', 'vit.encoder.layer.0.output.dense.bias', 'decoder.decoder_layers.6.intermediate.dense.weight', 'decoder.decoder_layers.0.attention.attention.key.bias', 'decoder.decoder_layers.3.attention.attention.query.weight', 'vit.encoder.layer.7.layernorm_before.weight', 'decoder.decoder_layers.0.attention.output.dense.bias', 'decoder.decoder_layers.6.attention.attention.key.bias', 'vit.encoder.layer.6.attention.attention.key.weight', 'vit.encoder.layer.4.output.dense.weight', 'vit.encoder.layer.4.attention.attention.query.bias', 'vit.encoder.layer.4.layernorm_before.bias', 'decoder.decoder_layers.7.attention.output.dense.weight', 'vit.encoder.layer.11.attention.output.dense.bias', 'vit.encoder.layer.1.intermediate.dense.weight', 'decoder.decoder_layers.6.layernorm_after.bias', 'vit.encoder.layer.2.attention.attention.key.bias', 'decoder.decoder_layers.0.layernorm_before.weight', 'vit.encoder.layer.7.attention.attention.value.weight', 'vit.encoder.layer.1.attention.attention.value.bias', 'decoder.decoder_layers.2.attention.output.dense.weight', 'decoder.decoder_layers.7.layernorm_before.bias', 'decoder.decoder_layers.5.layernorm_before.bias', 'decoder.decoder_layers.7.layernorm_after.weight', 'vit.encoder.layer.7.attention.attention.query.weight', 'vit.encoder.layer.3.output.dense.bias', 'vit.encoder.layer.0.attention.attention.query.bias', 'decoder.decoder_layers.0.attention.output.dense.weight', 'vit.encoder.layer.7.attention.output.dense.weight', 'decoder.decoder_layers.4.layernorm_after.weight', 'vit.encoder.layer.10.attention.attention.query.weight', 'vit.encoder.layer.9.attention.attention.value.bias', 'decoder.decoder_layers.5.layernorm_after.bias', 'decoder.decoder_layers.7.attention.attention.key.bias', 'decoder.decoder_layers.0.layernorm_after.weight', 'vit.encoder.layer.6.attention.output.dense.bias', 'vit.encoder.layer.4.attention.attention.key.bias', 'decoder.decoder_layers.4.layernorm_after.bias', 'vit.encoder.layer.7.layernorm_before.bias', 'vit.encoder.layer.0.intermediate.dense.weight', 'vit.encoder.layer.10.layernorm_before.bias', 'vit.encoder.layer.7.output.dense.weight', 'vit.encoder.layer.0.attention.attention.value.weight', 'vit.encoder.layer.4.layernorm_before.weight', 'vit.encoder.layer.3.attention.attention.value.bias', 'decoder.decoder_layers.7.attention.attention.key.weight', 'vit.encoder.layer.1.attention.output.dense.weight', 'decoder.decoder_layers.2.attention.output.dense.bias', 'decoder.decoder_layers.7.layernorm_before.weight', 'decoder.decoder_layers.4.attention.attention.query.weight', 'decoder.decoder_layers.6.attention.attention.key.weight', 'vit.encoder.layer.0.attention.attention.query.weight', 'vit.encoder.layer.10.intermediate.dense.bias', 'decoder.decoder_layers.6.output.dense.bias', 'decoder.decoder_layers.7.output.dense.weight', 'vit.encoder.layer.5.attention.output.dense.weight', 'decoder.decoder_layers.4.attention.attention.key.weight', 'vit.encoder.layer.6.layernorm_before.weight', 'vit.encoder.layer.9.attention.attention.query.bias', 'decoder.decoder_layers.6.output.dense.weight', 'vit.encoder.layer.2.attention.attention.key.weight', 'vit.encoder.layer.8.attention.attention.query.weight', 'decoder.decoder_layers.3.attention.output.dense.weight', 'vit.encoder.layer.4.output.dense.bias', 'vit.encoder.layer.1.attention.attention.value.weight', 'vit.encoder.layer.1.layernorm_after.weight', 'vit.encoder.layer.8.layernorm_after.weight', 'vit.encoder.layer.3.layernorm_before.weight', 'decoder.decoder_layers.6.attention.attention.value.weight', 'decoder.decoder_layers.0.output.dense.weight', 'vit.encoder.layer.5.attention.output.dense.bias', 'vit.encoder.layer.4.attention.output.dense.weight', 'vit.encoder.layer.4.layernorm_after.weight', 'vit.encoder.layer.10.attention.attention.key.weight', 'vit.encoder.layer.9.attention.attention.value.weight', 'decoder.decoder_layers.2.attention.attention.value.weight', 'decoder.decoder_layers.5.intermediate.dense.weight', 'decoder.decoder_layers.6.layernorm_after.weight', 'decoder.mask_token', 'vit.encoder.layer.6.layernorm_before.bias', 'vit.encoder.layer.9.layernorm_after.bias', 'decoder.decoder_layers.1.layernorm_after.bias', 'decoder.decoder_layers.2.attention.attention.query.bias', 'decoder.decoder_layers.2.layernorm_after.bias', 'decoder.decoder_norm.bias', 'decoder.decoder_layers.5.layernorm_after.weight', 'vit.encoder.layer.11.attention.attention.key.bias', 'vit.encoder.layer.8.attention.attention.value.bias', 'vit.encoder.layer.8.attention.attention.key.weight', 'decoder.decoder_layers.0.output.dense.bias', 'vit.embeddings.cls_token', 'vit.encoder.layer.11.layernorm_before.bias', 'vit.encoder.layer.9.layernorm_before.weight', 'vit.encoder.layer.5.layernorm_after.weight', 'vit.encoder.layer.6.intermediate.dense.bias', 'decoder.decoder_layers.6.attention.output.dense.weight', 'decoder.decoder_layers.0.attention.attention.query.bias', 'decoder.decoder_embed.weight', 'decoder.decoder_layers.0.attention.attention.query.weight', 'decoder.decoder_layers.6.intermediate.dense.bias']
-This IS expected if you are initializing ViTMAEModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
-This IS NOT expected if you are initializing ViTMAEModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).

Comments: