-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Swin remove avgpooling #1029
Comments
i am able to resolve this for now by using forward_hooks and iterating through the children() modules, and register the hooks for the module that i am interested in |
@germayneng I'm working on getting this improved for an end of year realease w/ long awaited pypi update. It touches all transformer and mlp based models so it's a bit of a task and requires lots of testing (may break some downstream usage but I feel it's worth it). Aside from your approach create_feature_extractor from recent torchvision can be used too and just pass in |
@germayneng took awhile, but I've cleaned up foward_features for all vit / mlp models so that the unpooled / non-token selected output is consitently returned from forward_features. Pooling or token selection is done in a new forward_head method, and most models have an attribute that can also enable/disable/change the pooling like CNNs.... |
I may tweak things a bit if any problems arise with the new approach but seems okay so far, I've been training / testing from the branch for a bit now before the recent merge. |
Thanks for this awesome library.
i do have a question: i realized there is no way for me to remove the avgpooling layer. I have trained my model and wish to perform some form of analysis and want to remove the avg pooling as stated in the tutorial: tried setting global and avg = ' ' and doesnt seem to work.
Also found a similar thread w.r.t to vit:
#657
Is this behavior expected?
The text was updated successfully, but these errors were encountered: