Repository: huggingface/transformers
Pull request: Fix AutoImageProcessor.register and documentation in auto processing modules

# What does this PR do?

This PR fixes several issues in the auto processing modules:

1. **Fixes `AutoImageProcessor.register` bug**: Removes incorrect validation logic that was copied from tokenizers. The validation checked for `slow_image_processor_class` attribute consistency, but fast image processors don't have this attribute (unlike fast tokenizers), causing the `register` method to fail when registering custom image processors.

2. **Fixes documentation errors**: Corrects copy-paste errors in docstrings where "tokenizer" was incorrectly used instead of the appropriate processor type (feature extractor, image processor, video processor).

3. **Fixes typos**: Corrects "fine" → "find" in comments across multiple auto modules.

4. **Improves `AutoVideoProcessor` trust handling**: Adds proper upstream repository extraction from `video_processor_auto_map` when resolving trust_remote_code.

## Changes by file:

- `feature_extraction_auto.py`: Fixed typo and corrected docstring to reference feature extractors instead of tokenizers
- `image_processing_auto.py`: Removed incorrect `slow_image_processor_class` validation and fixed import in docstring example
- `processing_auto.py`: Fixed typo in comment
- `tokenization_auto.py`: Fixed typo in comment  
- `video_processing_auto.py`: Fixed docstring reference and added upstream repo handling for trust_remote_code

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [x] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

@ArthurZucker @Rocketknight1 (auto modules and processing)



Changed files:
filename: src/transformers/models/auto/feature_extraction_auto.py
patch: @@ -93,7 +93,7 @@ def feature_extractor_class_from_name(class_name: str):
         if getattr(extractor, "__name__", None) == class_name:
             return extractor
 
-    # We did not fine the class, but maybe it's because a dep is missing. In that case, the class will be in the main
+    # We did not find the class, but maybe it's because a dep is missing. In that case, the class will be in the main
     # init and we return the proper dummy to get an appropriate error message.
     main_module = importlib.import_module("transformers")
     if hasattr(main_module, class_name):
@@ -113,7 +113,7 @@ def get_feature_extractor_config(
     **kwargs,
 ):
     """
-    Loads the tokenizer configuration from a pretrained model tokenizer configuration.
+    Loads the feature extractor configuration from a pretrained model feature extractor configuration.
 
     Args:
         pretrained_model_name_or_path (`str` or `os.PathLike`):
@@ -122,7 +122,7 @@ def get_feature_extractor_config(
             - a string, the *model id* of a pretrained model configuration hosted inside a model repo on
               huggingface.co.
             - a path to a *directory* containing a configuration file saved using the
-              [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.
+              [`~FeatureExtractionMixin.save_pretrained`] method, e.g., `./my_model_directory/`.
 
         cache_dir (`str` or `os.PathLike`, *optional*):
             Path to a directory in which a downloaded pretrained model configuration should be cached if the standard
@@ -141,7 +141,7 @@ def get_feature_extractor_config(
             git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
             identifier allowed by git.
         local_files_only (`bool`, *optional*, defaults to `False`):
-            If `True`, will only try to load the tokenizer configuration from local files.
+            If `True`, will only try to load the feature extractor configuration from local files.
 
     <Tip>
 
@@ -150,22 +150,22 @@ def get_feature_extractor_config(
     </Tip>
 
     Returns:
-        `Dict`: The configuration of the tokenizer.
+        `Dict`: The configuration of the feature extractor.
 
     Examples:
 
     ```python
     # Download configuration from huggingface.co and cache.
-    tokenizer_config = get_tokenizer_config("google-bert/bert-base-uncased")
-    # This model does not have a tokenizer config so the result will be an empty dict.
-    tokenizer_config = get_tokenizer_config("FacebookAI/xlm-roberta-base")
+    feature_extractor_config = get_feature_extractor_config("facebook/wav2vec2-base-960h")
+    # This model does not have a feature extractor config so the result will be an empty dict.
+    feature_extractor_config = get_feature_extractor_config("FacebookAI/xlm-roberta-base")
 
-    # Save a pretrained tokenizer locally and you can reload its config
-    from transformers import AutoTokenizer
+    # Save a pretrained feature extractor locally and you can reload its config
+    from transformers import AutoFeatureExtractor
 
-    tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
-    tokenizer.save_pretrained("tokenizer-test")
-    tokenizer_config = get_tokenizer_config("tokenizer-test")
+    feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base-960h")
+    feature_extractor.save_pretrained("feature-extractor-test")
+    feature_extractor_config = get_feature_extractor_config("feature-extractor-test")
     ```"""
     resolved_config_file = cached_file(
         pretrained_model_name_or_path,

filename: src/transformers/models/auto/image_processing_auto.py
patch: @@ -260,7 +260,7 @@ def get_image_processor_config(
             - a string, the *model id* of a pretrained model configuration hosted inside a model repo on
               huggingface.co.
             - a path to a *directory* containing a configuration file saved using the
-              [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.
+              [`~ProcessorMixin.save_pretrained`] method, e.g., `./my_model_directory/`.
 
         cache_dir (`str` or `os.PathLike`, *optional*):
             Path to a directory in which a downloaded pretrained model configuration should be cached if the standard
@@ -299,7 +299,7 @@ def get_image_processor_config(
     image_processor_config = get_image_processor_config("FacebookAI/xlm-roberta-base")
 
     # Save a pretrained image processor locally and you can reload its config
-    from transformers import AutoTokenizer
+    from transformers import AutoImageProcessor
 
     image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k")
     image_processor.save_pretrained("image-processor-test")
@@ -629,19 +629,6 @@ def register(
         ):
             raise ValueError("The `fast_image_processor_class` should inherit from `BaseImageProcessorFast`.")
 
-        if (
-            slow_image_processor_class is not None
-            and fast_image_processor_class is not None
-            and issubclass(fast_image_processor_class, BaseImageProcessorFast)
-            and fast_image_processor_class.slow_image_processor_class != slow_image_processor_class
-        ):
-            raise ValueError(
-                "The fast processor class you are passing has a `slow_image_processor_class` attribute that is not "
-                "consistent with the slow processor class you passed (fast tokenizer has "
-                f"{fast_image_processor_class.slow_image_processor_class} and you passed {slow_image_processor_class}. Fix one of those "
-                "so they match!"
-            )
-
         # Avoid resetting a set slow/fast image processor if we are passing just the other ones.
         if config_class in IMAGE_PROCESSOR_MAPPING._extra_content:
             existing_slow, existing_fast = IMAGE_PROCESSOR_MAPPING[config_class]

filename: src/transformers/models/auto/processing_auto.py
patch: @@ -175,7 +175,7 @@ def processor_class_from_name(class_name: str):
         if getattr(processor, "__name__", None) == class_name:
             return processor
 
-    # We did not fine the class, but maybe it's because a dep is missing. In that case, the class will be in the main
+    # We did not find the class, but maybe it's because a dep is missing. In that case, the class will be in the main
     # init and we return the proper dummy to get an appropriate error message.
     main_module = importlib.import_module("transformers")
     if hasattr(main_module, class_name):

filename: src/transformers/models/auto/tokenization_auto.py
patch: @@ -815,7 +815,7 @@ def tokenizer_class_from_name(class_name: str) -> Union[type[Any], None]:
             if getattr(tokenizer, "__name__", None) == class_name:
                 return tokenizer
 
-    # We did not fine the class, but maybe it's because a dep is missing. In that case, the class will be in the main
+    # We did not find the class, but maybe it's because a dep is missing. In that case, the class will be in the main
     # init and we return the proper dummy to get an appropriate error message.
     main_module = importlib.import_module("transformers")
     if hasattr(main_module, class_name):

filename: src/transformers/models/auto/video_processing_auto.py
patch: @@ -122,7 +122,7 @@ def get_video_processor_config(
             - a string, the *model id* of a pretrained model configuration hosted inside a model repo on
               huggingface.co.
             - a path to a *directory* containing a configuration file saved using the
-              [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.
+              [`~BaseVideoProcessor.save_pretrained`] method, e.g., `./my_model_directory/`.
 
         cache_dir (`str` or `os.PathLike`, *optional*):
             Path to a directory in which a downloaded pretrained model configuration should be cached if the standard
@@ -313,9 +313,14 @@ def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs):
 
         has_remote_code = video_processor_auto_map is not None
         has_local_code = video_processor_class is not None or type(config) in VIDEO_PROCESSOR_MAPPING
-        trust_remote_code = resolve_trust_remote_code(
-            trust_remote_code, pretrained_model_name_or_path, has_local_code, has_remote_code
-        )
+        if has_remote_code:
+            if "--" in video_processor_auto_map:
+                upstream_repo = video_processor_auto_map.split("--")[0]
+            else:
+                upstream_repo = None
+            trust_remote_code = resolve_trust_remote_code(
+                trust_remote_code, pretrained_model_name_or_path, has_local_code, has_remote_code, upstream_repo
+            )
 
         if has_remote_code and trust_remote_code:
             class_ref = video_processor_auto_map