Commit Graph

30 Commits (9613c7684408c4ca0c4a1448d0972b7ecb3564db)

Author SHA1 Message Date
Ross Wightman a5a2ad2e48 Fix consistency, testing for forward_head w/ pre_logits, reset_classifier, models with pre_logits size != unpooled feature size
* add test that model supports forward_head(x, pre_logits=True)
* add head_hidden_size attr to all models and set differently from num_features attr when head has hidden layers
* test forward_features() feat dim == model.num_features and pre_logits feat dim == self.head_hidden_size
* more consistency in reset_classifier signature, add typing
* asserts in some heads where pooling cannot be disabled
Fix #2194
2024-06-07 13:53:00 -07:00
Ross Wightman cb57a96862 Fix early stop for efficientnet/mobilenetv3 fwd inter. Fix indices typing for all fwd inter. 2024-05-04 10:21:58 -07:00
Ross Wightman c719f7eb86 More forward_intermediates() updates
* add convnext, resnet, efficientformer, levit support
* remove kwargs only for fn so that torchscript isn't broken for all :(
* use reset_classifier() consistently in prune
2024-05-03 16:22:32 -07:00
Ross Wightman 67332fce24 Add features_intermediate() support to coatnet, maxvit, swin* models. Refine feature interface. Start prep of new vit weights. 2024-04-30 16:56:33 -07:00
Ross Wightman 88889de923 Fix meshgrid deprecation warnings and backward compat with explicit 'ndgrid' and 'meshgrid' fn w/o indexing arg 2024-01-27 13:48:33 -08:00
Ross Wightman e4e43190ce Add typing to all model entrypoint fns, add old cache check env var to builder 2023-05-08 08:52:38 -07:00
Ross Wightman 4d135421a3 Implement patch dropout for eva / vision_transformer, refactor / improve consistency of dropout args across all vit based models 2023-04-07 20:27:23 -07:00
Ross Wightman 1bb3989b61 Improve kwarg passthrough for swin, vit, deit, beit, eva 2023-04-05 21:37:16 -07:00
Ross Wightman 572f05096a Swin and FocalNet weights on HF hub. Add model deprecation functionality w/ some registry tweaks. 2023-03-18 14:55:09 -07:00
Ross Wightman acfd85ad68 All swin models support spatial output, add output_fmt to v1/v2 and use ClassifierHead.
* update ClassifierHead to allow different input format
* add output format support to patch embed
* fix some flatten issues for a few conv head models
* add Format enum and helpers for tensor format (layout) choices
2023-03-15 23:21:51 -07:00
Ross Wightman 7d9e321b76 Improve tracing of window attn models with simpler reshape logic 2023-02-17 07:59:06 -08:00
Ross Wightman 927f031293 Major module / path restructure, timm.models.layers -> timm.layers, add _ prefix to all non model modules in timm.models 2022-12-06 15:00:06 -08:00
Ross Wightman d4c0588012 Remove persistent buffers from Swin-V2. Change SwinV2Cr cos attn + tau/logit_scale to match official, add ckpt convert, init_value zeros resid LN weight by default 2022-05-13 10:50:59 -07:00
Ross Wightman c0211b0bf7 Swin-V2 test fixes, typo 2022-05-12 22:31:55 -07:00
Ross Wightman 9a86b900fa Official SwinV2 models 2022-05-12 15:05:10 -07:00
Ross Wightman b7cb8d0337 Add Swin-V2 Small-NS weights (83.5 @ 224). Add layer scale like 'init_values' via post-norm LN weight scaling 2022-04-26 17:32:49 -07:00
Ross Wightman c5a8e929fb Add initial swinv2 tiny / small weights 2022-04-03 15:22:55 -07:00
Ross Wightman 024fc4d9ab version 0.6.1 for master 2022-03-21 22:03:13 -07:00
Ross Wightman e1e037ba52 Fix bad tuple typing fix that was on XLA branch bust missed on master merge 2022-03-21 22:00:33 -07:00
Ross Wightman fe457c1996 Update SwinTransformerV2Cr post-merge, update with grad checkpointing / grad matcher
* weight compat break, activate norm3 for final block of final stage (equivalent to pre-head norm, but while still in BLC shape)
* remove fold/unfold for TPU compat, add commented out roll code for TPU
* add option for end of stage norm in all stages
* allow weight_init to be selected between pytorch default inits and xavier / moco style vit variant
2022-03-21 14:50:28 -07:00
Ross Wightman 1420c118df Missed comitting outstanding changes to default_cfg keys and test exclusions for swin v2 2022-02-23 19:50:26 -08:00
Ross Wightman c6e4b7895a Swin V2 CR impl refactor.
* reformat and change some naming so closer to existing timm vision transformers
* remove typing that wasn't adding clarity (or causing torchscript issues)
* support non-square windows
* auto window size adjust from image size
* post-norm + main-branch no
2022-02-23 17:28:52 -08:00
Christoph Reich 67d140446b Fix bug in classification head 2022-02-20 22:28:05 +01:00
Christoph Reich 29add820ac Refactor (back to relative imports) 2022-02-20 00:46:48 +01:00
Christoph Reich 74a04e0016 Add parameter to change normalization type 2022-02-20 00:46:00 +01:00
Christoph Reich 2a4f6c13dd Create model functions 2022-02-20 00:40:22 +01:00
Christoph Reich 87b4d7a29a Add get and reset classifier method 2022-02-19 22:47:02 +01:00
Christoph Reich ff5f6bcd6c Check input resolution 2022-02-19 22:42:02 +01:00
Christoph Reich 81bf0b4033 Change parameter names to match Swin V1 2022-02-19 22:37:22 +01:00
Christoph Reich f227b88831 Add initials (CR) to model and file 2022-02-19 22:14:38 +01:00