Skip to content

Commit 474ac90

Browse files
committed
Add 'head norm first' convnext_tiny_hnf weights
1 parent dc51334 commit 474ac90

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

timm/models/convnext.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def _cfg(url='', **kwargs):
4444
convnext_large=_cfg(url="https://dl.fbaipublicfiles.com/convnext/convnext_large_1k_224_ema.pth"),
4545

4646
convnext_nano_hnf=_cfg(url=''),
47-
convnext_tiny_hnf=_cfg(url=''),
47+
convnext_tiny_hnf=_cfg(
48+
url='https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/convnext_tiny_hnf_a2h-ab7e9df2.pth',
49+
crop_pct=0.95),
4850

4951
convnext_base_in22ft1k=_cfg(
5052
url='https://dl.fbaipublicfiles.com/convnext/convnext_base_22k_1k_224.pth'),
@@ -322,6 +324,8 @@ def _init_weights(module, name=None, head_init_scale=1.0):
322324

323325
def checkpoint_filter_fn(state_dict, model):
324326
""" Remap FB checkpoints -> timm """
327+
if 'head.norm.weight' in state_dict or 'norm_pre.weight' in state_dict:
328+
return state_dict # non-FB checkpoint
325329
if 'model' in state_dict:
326330
state_dict = state_dict['model']
327331
out_dict = {}

0 commit comments

Comments
 (0)