-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update timm to 1.* version and support more encoders #885
base: main
Are you sure you want to change the base?
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.
Hi! I've left some suggestions that fixed the tests on my side, since I am looking to use segmentation_models_pytorch with timm>1.0
in_channels: int = 3, | ||
depth: int = 5, | ||
output_stride: int = 32, | ||
out_indices: Optional[List[int]] = None, |
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.
out_indices: Optional[List[int]] = None, | |
out_indices: Union[str, List[int]] = "first", |
if "encoder_indices" in kwargs and kwargs["encoder_indices"] is None: | ||
kwargs["encoder_indices"] = "first" |
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 "encoder_indices" in kwargs and kwargs["encoder_indices"] is None: | |
kwargs["encoder_indices"] = "first" | |
if "out_indices" in kwargs and kwargs["out_indices"] is None: | |
kwargs["out_indices"] = "first" |
While it's called encoder_indices
in the function select_feature_indices
, in TimmUniversalEncoder
it is still called out_indices
encoder_indices = kwargs.pop("encoder_indices", None) | ||
if encoder_indices is not None: | ||
logger.warning( | ||
"Argument `encoder_indices` is supported only for `tu-` encoders (Timm) and will be ignored." | ||
) |
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.
encoder_indices = kwargs.pop("encoder_indices", None) | |
if encoder_indices is not None: | |
logger.warning( | |
"Argument `encoder_indices` is supported only for `tu-` encoders (Timm) and will be ignored." | |
) | |
out_indices = kwargs.pop("encoder_indices", None) | |
if out_indices is not None: | |
logger.warning( | |
"Argument `out_indices ` is supported only for `tu-` encoders (Timm) and will be ignored." | |
) |
Hi @wouterzwerink thanks for the review! |
According to #918, timm 1.0.9 already works great. Or our tests are useless. One or the other. |
This PR is more about unlocking newer backbones, the latest timm itself should work with the current setup |
@qubvel @adamjstewart Is it planned to support the transformer backbones from timm anytime soon ? That would be awesome !! |
Hey @patrontheo, I've overcomplicated it a bit and can't find time to finish this 🥲 maybe during the Christmas holidays... |
I had in mind Swin but I think any good transformer backbone could help! Okay no worries, don't forget to take some time off during Christmas ;) |
Thanks @patrontheo! |
Make most of the models from timm compatible with decoders (including transformers and convnext models)