transformers
d0265691 - Add AutoAudioProcessor with per-backend class resolution

Commit
1 day ago
Add AutoAudioProcessor with per-backend class resolution `AutoAudioProcessor` is the audio counterpart of `AutoImageProcessor` and the successor to `AutoFeatureExtractor`, which is now deprecated and delegates to it. Because each audio model can ship a torch and a numpy processor, the auto mapping becomes backend-keyed: `{"torch": ..., "numpy": ...}` per model type, resolved by `from_pretrained(..., backend=...)`. `_load_class_with_fallback` falls back to whichever sibling exists and warns, so models with only one backend keep working. `_legacy_name_candidates` lets a checkpoint saved with `feature_extractor_type: "WhisperFeatureExtractor"` resolve to the new class. The mapping is introduced in its new shape but still populated with the current `XxxFeatureExtractor` names; each model migration flips its own entry as it lands, so `AutoFeatureExtractor` and `AutoAudioProcessor` both keep resolving correctly at every point in the stack. `MODALITY_TO_BASE_CLASS_MAPPING` and `auto_docstring` learn to resolve backend-keyed mapping values, mirroring how image processors already resolve `{"torchvision": ..., "pil": ...}`. `test_feature_extractor_not_found` now asserts the resolver's "audio processor" wording, since `AutoFeatureExtractor` routes through the shared resolver.
Author
Committer
Parents
Loading