Resolver mirroring Hugging Face's AutoImageProcessor.
Stateless utility — no instances are constructed; the classmethods
look up the registry by preprocessor_type and dispatch.
Examples
>>> from lucid.utils.transforms import AutoTransformsPreset
>>> cfg = {
... "preprocessor_type": "ImageClassification",
... "init_kwargs": {"crop_size": 224, "resize_size": 256},
... }
>>> preset = AutoTransformsPreset.from_dict(cfg)
>>> type(preset).__name__
'ImageClassification'Used by 1
Static methods
2from_dict(cfg: dict[str, object])Reconstruct a preset from a TransformsPreset.to_dict payload.
Dispatches on the preprocessor_type key to the registered
TransformsPreset subclass and forwards init_kwargs
to its constructor. Symmetric with TransformsPreset.to_dict
— the round-trip from_dict(p.to_dict()) produces a preset
with identical behaviour.
Parameters
cfgdict{"preprocessor_type": <class-key>, "init_kwargs": {...}}
payload — typically loaded from a pretrained model's
preprocessor_config.json.Returns
TransformsPresetFresh instance of the named subclass.
Raises
ValueErrorIf
preprocessor_type is missing or names an unknown
preset; if init_kwargs is not a dict.Return the sorted list of registered preset type keys.
Useful for discovery / introspection — every returned name is
a legal value of the preprocessor_type field accepted by
from_dict.