Backbone kwargs in config#28784
Conversation
04f3fb2 to
cdc6e93
Compare
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
c55d529 to
f3d272c
Compare
ArthurZucker
left a comment
There was a problem hiding this comment.
Could you explain the motivations behind this? IMO would should push users to use a config for the backbone, as we do for the quantization_config for example.
I feel like `backbone = AutoBackbone.from_config(config.backbone_config, arg1 =x, arg2=y) could be used in the potential refactor?
Would help if you have a linked PR that has the expected behaviour to see how this is gonna be called 🤗
|
@ArthurZucker Sure! We want to remove the hard-coded conditional logic inside of models like DETR and be able to fully configure the backbone's behaviour. The use case is: image I want to create a new model to train. Instead of the default architecture of DETR, I want to use a different timm backbone, and I want the backbone to return different feature maps from the default. At the moment this isn't possible because:
I completely agree that it would be better to have this all as one argument! For context: when the backbones were first added, there were four arguments:
The backbone = AutoBackbone.from_config(backbone_config)and backbone = AutoBackbone.from_pretrained(backbone)So Adding If you want, I'm happy to code something up and we can decide which is best from the two :) For more context, here's an example of the final step for removing timm in the modeling files: https://github.com/amyeroberts/transformers/pull/114/files#diff-bdc82cb85f491576a99a341adabaf42260eac9cd797d70d0a2c564b0d4ee2930 You can see how all we need is a single call |
ArthurZucker
left a comment
There was a problem hiding this comment.
Alright, looks good to me then!
bba8b2c to
9fd1233
Compare
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
9fd1233 to
4877d32
Compare
What does this PR do?
This enables configuring the backbones through the config directly e.g. passing in
out_indicesto the backbone. This enables configuring a model's backbone when it's loaded from a pretrained checkpoint. At the moment, this is only possible when loading from abackbone_config.Example:
This is necessary to replace th
timmcode currently there for models like DETR e.g. here, which is often hard coded.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.