Skip to content

Commit

Permalink
Fix PT TF ViTMAE (huggingface#16766)
Browse files Browse the repository at this point in the history
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
2 people authored and elusenji committed Jun 12, 2022
1 parent f5eea6a commit 59c39cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/transformers/models/vit_mae/modeling_tf_vit_mae.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,9 @@ def __init__(self, config, num_patches, **kwargs):

self.decoder_norm = tf.keras.layers.LayerNormalization(epsilon=config.layer_norm_eps, name="decoder_norm")
self.decoder_pred = tf.keras.layers.Dense(
config.patch_size**2 * config.num_channels, name="decoder_pred"
config.patch_size**2 * config.num_channels,
kernel_initializer=get_initializer(config.initializer_range),
name="decoder_pred",
) # encoder to decoder
self.config = config
self.num_patches = num_patches
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/models/vit_mae/modeling_vit_mae.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def __init__(self, config, num_patches):
[ViTMAELayer(decoder_config) for _ in range(config.decoder_num_hidden_layers)]
)

self.decoder_norm = nn.LayerNorm(config.decoder_hidden_size)
self.decoder_norm = nn.LayerNorm(config.decoder_hidden_size, eps=config.layer_norm_eps)
self.decoder_pred = nn.Linear(
config.decoder_hidden_size, config.patch_size**2 * config.num_channels, bias=True
) # encoder to decoder
Expand Down

0 comments on commit 59c39cd

Please # to comment.