-
Notifications
You must be signed in to change notification settings - Fork 446
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
Reimplementation of ViT for classification #3719
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Would model weights for deit_tiny
recipe be compatible with 1.6 and 2.1 after these changes?
Hi @sovrasov, thank you for the question. No, the model layers are renamed following timm implementation. So, we need to have a special converter for reusing 1.6 model weights like new_state_dict = OrderedDict()
for key, value in state_dict.items():
new_key = key
new_key = re.sub("backbone.ln1", "backbone.norm", new_key)
new_key = re.sub("ffn.layers.0.0", "mlp.fc1", new_key)
new_key = re.sub("ffn.layers.1", "mlp.fc2", new_key)
new_key = re.sub("ln", "norm", new_key)
new_key = re.sub("projection", "proj", new_key)
new_key = re.sub("layers", "blocks", new_key)
new_state_dict[new_key] = value |
Does this PR include the mentioned weights loading method? We might need to think about backward compatibility taking the future Geti integration into account. |
This PR updates the pretrained weight provided by TIMM. So I instead added the logic for loading weights from pretrained |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this doesn't guarantee DeIT compatibility with OTX 1.6, that's fine. But if so, it would be nice if the load_from_otx_v1_ckpt
function in vit.py
would spit out a warning or error message.
If the compatibility issue is an easy one to solve, it would be nice to modify the function to also work with v1 weight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work. It seems that previous timm
version has conflict w/ current change. Could you specify timm
version at pyproject.toml?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3719 +/- ##
===========================================
- Coverage 80.51% 80.17% -0.35%
===========================================
Files 251 252 +1
Lines 25488 25502 +14
===========================================
- Hits 20521 20445 -76
- Misses 4967 5057 +90
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
added at 0704da1. |
fixed at 9acdfec. |
Co-authored-by: Eunwoo Shin <[email protected]>
Summary
Checklist
License
Feel free to contact the maintainers if that's a concern.