From d3ebdcfd938baf048ef784210de127013320cde3 Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Thu, 19 Oct 2023 12:03:40 -0700 Subject: [PATCH] Disable strict load when siglip vit pooling removed --- timm/models/vision_transformer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/timm/models/vision_transformer.py b/timm/models/vision_transformer.py index d56037c658..84ffc246ad 100644 --- a/timm/models/vision_transformer.py +++ b/timm/models/vision_transformer.py @@ -1603,11 +1603,17 @@ def _create_vision_transformer(variant, pretrained=False, **kwargs): else: _filter_fn = checkpoint_filter_fn + # FIXME attn pool (currently only in siglip) params removed if pool disabled, is there a better soln? + strict = True + if 'siglip' in variant and kwargs.get('global_pool', None) != 'map': + strict = False + return build_model_with_cfg( VisionTransformer, variant, pretrained, pretrained_filter_fn=_filter_fn, + pretrained_strict=strict, **kwargs, )