mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
Merge pull request #1365 from veritable-tech/fix-resize-pos-embed
Take `no_emb_class` into account when calling `resize_pos_embed`
This commit is contained in:
commit
c8f69e04a9
@ -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…
x
Reference in New Issue
Block a user