Auto-dispatching wrapper that loads the backbone of any family.
"Backbone" means the family base class with no task head attached
(e.g. ResNet, not ResNetForImageClassification). Use this
when you want raw feature outputs or intend to attach a custom head
on top.
Notes
Each registered model carries a _task tag; this class filters on
_task == "base". A given name can resolve to different classes
under different AutoModelFor* shells — for example,
AutoModel.from_pretrained("resnet_50") returns ResNet whereas
AutoModelForImageClassification.from_pretrained("resnet_50")
returns ResNetForImageClassification.
Examples
>>> from lucid.models import AutoModel
>>> backbone = AutoModel.from_pretrained("resnet_50")
>>> type(backbone).__name__
'ResNet'
>>> import lucid
>>> features = backbone.forward_features(lucid.randn(1, 3, 224, 224))
>>> features.shape
(1, 2048, 7, 7)