Building-block protocol: model class points at its family's
Config via the config_class ClassVar.
Every concrete PretrainedModel subclass — backbone or
task wrapper — declares config_class: ClassVar[type[...]] = <FamilyConfig>. The base PretrainedModel.__init__ uses the
attribute to validate the runtime config argument and
from_pretrained uses it to reconstruct the config from
JSON on disk.
Attributes
config_classClassVar[type]Pointer to the family's
ModelConfig subclass. Set
on every concrete model class; left as None on the
abstract PretrainedModel base so a missing override
raises a clear TypeError at first instantiation.Notes
Component of PretrainedModelProtocol. Refine to
BackboneProtocol or TaskWrapperProtocol in
signatures that need finer distinctions.
Examples
>>> from lucid.models.vision.resnet import ResNet
>>> from lucid.models._protocols import HasConfigClass
>>> isinstance(ResNet, HasConfigClass)
True
>>> ResNet.config_class.__name__
'ResNetConfig'