huggingface/transformers · error · ValueError
{auto_class} is not a valid auto class.
Error message
{auto_class} is not a valid auto class. What it means
Error "{auto_class} is not a valid auto class." thrown in huggingface/transformers.
Source
Thrown at src/transformers/image_processing_base.py:469
@classmethod
def register_for_auto_class(cls, auto_class="AutoImageProcessor"):
"""
Register this class with a given auto class. This should only be used for custom image processors as the ones
in the library are already mapped with `AutoImageProcessor `.
Args:
auto_class (`str` or `type`, *optional*, defaults to `"AutoImageProcessor "`):
The auto class to register this new image processor with.
"""
if not isinstance(auto_class, str):
auto_class = auto_class.__name__
import transformers.models.auto as auto_module
if not hasattr(auto_module, auto_class):
raise ValueError(f"{auto_class} is not a valid auto class.")
cls._auto_class = auto_class
def fetch_images(self, image_url_or_urls: str | list[str] | list[list[str]]):
"""
Convert a single or a list of urls into the corresponding `PIL.Image` objects.
If a single url is passed, the return value will be a single object. If a list is passed a list of objects is
returned.
"""
if isinstance(image_url_or_urls, (list, tuple)):
return [self.fetch_images(x) for x in image_url_or_urls]
elif isinstance(image_url_or_urls, str):
return load_image(image_url_or_urls)
elif is_valid_image(image_url_or_urls):
return image_url_or_urls
else:
raise TypeError(f"only a single or a list of entries is supported but got type={type(image_url_or_urls)}")View on GitHub (pinned to a597f97485)
Solutions
- Use a valid auto class name such as 'AutoImageProcessor'.
- Check the registered auto class names in the mapping.
When it happens
Trigger: Raised in ImageProcessingMixin.from_dict/from_json auto-class resolution when auto_class is not a registered auto class name.
Common situations: Typo or unsupported value in the auto_class argument when loading an image processor generically.
AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14).
Data as JSON: /api/errors/65b8cb91b60007ce.
Report an issue: GitHub.