Merge pull request #1365 from veritable-tech/fix-resize-pos-embed

Take `no_emb_class` into account when calling  `resize_pos_embed`
pull/1606/head
Ross Wightman 2 years ago committed by GitHub
commit c8f69e04a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -644,7 +644,7 @@ def checkpoint_filter_fn(state_dict, model, adapt_layer_scale=False):
v = resize_pos_embed( v = resize_pos_embed(
v, v,
model.pos_embed, model.pos_embed,
getattr(model, 'num_prefix_tokens', 1), 0 if getattr(model, 'no_embed_class') else getattr(model, 'num_prefix_tokens', 1),
model.patch_embed.grid_size model.patch_embed.grid_size
) )
elif adapt_layer_scale and 'gamma_' in k: elif adapt_layer_scale and 'gamma_' in k:

Loading…
Cancel
Save