class_docstr: This is an image processor mixin used to provide saving/loading functionality for sequential and image feature
  extractors.
docstr: Save an image processor object to the directory `save_directory`, so that it can be re-loaded using the
  [`~image_processing_utils.ImageProcessingMixin.from_pretrained`] class method.
  
  Args:
      save_directory (`str` or `os.PathLike`):
          Directory where the image processor JSON file will be saved (will be created if it does not exist).
      push_to_hub (`bool`, *optional*, defaults to `False`):
          Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
          repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
          namespace).
      kwargs (`Dict[str, Any]`, *optional*):
          Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
docstr_tok: ["Save","an","image","processor","object","to","the","directory","`","save_directory","`",",","so","that","it","can","be","re-loaded","using","the","[","`","~image_processing_utils.ImageProcessingMixin.from_pretrained","`","]","class","method",".","Args",":","save_directory","(","`","str","`","or","`","os.PathLike","`",")",":","Directory","where","the","image","processor","JSON","file","will","be","saved","(","will","be","created","if","it","does","not","exist",")",".","push_to_hub","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","to","push","your","model","to","the","Hugging","Face","model","hub","after","saving","it",".","You","can","specify","the","repository","you","want","to","push","to","with","`","repo_id","`","(","will","default","to","the","name","of","`","save_directory","`","in","your","namespace",")",".","kwargs","(","`","Dict","[","str",",","Any","]","`",",","*","optional","*",")",":","Additional","key","word","arguments","passed","along","to","the","[","`","~utils.PushToHubMixin.push_to_hub","`","]","method","."]
code: def save_pretrained(
      self,
      save_directory: Union[str, os.PathLike],
      push_to_hub: bool = False,
      **kwargs,
  ):
      """
      Save an image processor object to the directory `save_directory`, so that it can be re-loaded using the
      [`~image_processing_utils.ImageProcessingMixin.from_pretrained`] class method.
  
      Args:
          save_directory (`str` or `os.PathLike`):
              Directory where the image processor JSON file will be saved (will be created if it does not exist).
          push_to_hub (`bool`, *optional*, defaults to `False`):
              Whether or not to push your model to the Hugging Face model hub after saving it. You can specify the
              repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
              namespace).
          kwargs (`Dict[str, Any]`, *optional*):
              Additional key word arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
      """
      use_auth_token = kwargs.pop("use_auth_token", None)
  
      if use_auth_token is not None:
          warnings.warn(
              "The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.",
              FutureWarning,
          )
          if kwargs.get("token", None) is not None:
              raise ValueError(
                  "`token` and `use_auth_token` are both specified. Please set only the argument `token`."
              )
          kwargs["token"] = use_auth_token
  
      if os.path.isfile(save_directory):
          raise AssertionError(
              f"Provided path ({save_directory}) should be a directory, not a file"
          )
  
      os.makedirs(save_directory, exist_ok=True)
  
      if push_to_hub:
          commit_message = kwargs.pop("commit_message", None)
          repo_id = kwargs.pop(
              "repo_id", save_directory.split(os.path.sep)[-1]
          )
          repo_id = self._create_repo(repo_id, **kwargs)
          files_timestamps = self._get_files_timestamps(save_directory)
  
      # If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be
      # loaded from the Hub.
      if self._auto_class is not None:
          custom_object_save(self, save_directory, config=self)
  
      # If we save using the predefined names, we can load using `from_pretrained`
      output_image_processor_file = os.path.join(
          save_directory, IMAGE_PROCESSOR_NAME
      )
  
      self.to_json_file(output_image_processor_file)
      logger.info(
          f"Image processor saved in {output_image_processor_file}"
      )
  
      if push_to_hub:
          self._upload_modified_files(
              save_directory,
              repo_id,
              files_timestamps,
              commit_message=commit_message,
              token=kwargs.get("token"),
          )
  
      return [output_image_processor_file]
  
imports: import copy
  import json
  import os
  import warnings
  from io import BytesIO
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  import requests
  from .dynamic_module_utils import custom_object_save
  from .feature_extraction_utils import BatchFeature
  from .image_transforms import center_crop, normalize, rescale
  from .image_utils import ChannelDimension
  from .utils import IMAGE_PROCESSOR_NAME, PushToHubMixin, add_model_info_to_auto_map, cached_file, copy_func, download_url, is_offline_mode, is_remote_url, is_vision_available, logging
label_desc: Use image node_id 4 for calling the ImageProcessingMixin obj's underlying member method code with example usage: obj.save_pretrained(save_directory, push_to_hub) and returns: list