code: 
  
  
  import os
  import warnings
  from pathlib import Path
  from typing import Optional, Union
  
  from .dynamic_module_utils import custom_object_save
  from .tokenization_utils_base import PreTrainedTokenizerBase
  from .utils import PushToHubMixin, copy_func, direct_transformers_import, logging
  
  
  __lowerCamelCase       :       str				   =			logging.get_logger(__name__)
  
  # Dynamically import the Transformers module to grab the attribute classes of the processor form their names.
  __lowerCamelCase       :       str				   =			direct_transformers_import(Path(__file__).parent)
  
  
  __lowerCamelCase       :       Union[str, Any]				   =			{
      "AutoTokenizer": "PreTrainedTokenizerBase",
      "AutoFeatureExtractor": "FeatureExtractionMixin",
      "AutoImageProcessor": "ImageProcessingMixin",
  }
  
  
  
  class 			a      (      a_   ):
  		__lowercase													=		['feature_extractor', 'tokenizer']
  		# Names need to be attr_class for attr in attributes
  		__lowercase													=		None
  		__lowercase													=		None
  		__lowercase													=		None
  
  
  
  
  
  
  		def __init__(  self	,     *__UpperCamelCase	,     **__UpperCamelCase							)->			List[Any]:
  						'''simple docstring'''
  
  
  						for key in kwargs:
  										if key not in self.attributes:
  														raise TypeError(F'Unexpected keyword argument {key}.'							)
  						for arg, attribute_name in zip(__UpperCamelCase	,     self.attributes							):
  										if attribute_name in kwargs:
  														raise TypeError(F'Got multiple values for argument {attribute_name}.'							)
  										else:
  														A__     :							int   				=arg
  
  						if len(__UpperCamelCase							) != len(self.attributes							):
  										raise ValueError(
  										    F'This processor requires {len(self.attributes							)} arguments: {", ".join(self.attributes							)}. Got '
  										    F'{len(__UpperCamelCase							)} arguments instead.'							)
  
  						# Check each arg is of the proper class (this will also catch a user initializing in the wrong order)
  						for attribute_name, arg in kwargs.items():
  										A__     :							List[Any]   				=getattr(self	,     F'{attribute_name}_class'							)
  										# Nothing is ever going to be an instance of "AutoXxx", in that case we check the base class.
  										A__     :							Optional[Any]   				=AUTO_TO_BASE_CLASS_MAPPING.get(__UpperCamelCase	,     __UpperCamelCase							)
  										if isinstance(__UpperCamelCase	,     __UpperCamelCase							):
  														A__     :							str   				=tuple(getattr(__UpperCamelCase	,     __UpperCamelCase							) for n in class_name if n is not None							)
  										else:
  														A__     :							Optional[Any]   				=getattr(__UpperCamelCase	,     __UpperCamelCase							)
  
  										if not isinstance(__UpperCamelCase	,     __UpperCamelCase							):
  														raise ValueError(
  														    F'Received a {type(__UpperCamelCase							).__name__} for argument {attribute_name}, but a {class_name} was expected.'							)
  
  										setattr(self	,     __UpperCamelCase	,     __UpperCamelCase							)
  
  
  
  
  
  
  		def __repr__(  self							)->			str:
  						'''simple docstring'''
  
  
  						A__     :							int   				=[F'- {name}: {repr(getattr(self	,     __UpperCamelCase							)							)}' for name in self.attributes]
  						A__     :							List[Any]   				='\n'.join(__UpperCamelCase							)
  						return F'{self.__class__.__name__}:\n{attributes_repr}'
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self	,     __UpperCamelCase	,     __UpperCamelCase = False	,     **__UpperCamelCase							)->			Union[str, Any]:
  						'''simple docstring'''
  
  
  						os.makedirs(__UpperCamelCase	,     exist_ok=__UpperCamelCase							)
  
  						if push_to_hub:
  										A__     :							int   				=kwargs.pop('''commit_message'''	,     __UpperCamelCase							)
  										A__     :							Any   				=kwargs.pop('''repo_id'''	,     save_directory.split(os.path.sep							)[-1]							)
  										A__     :							List[Any]   				=self._create_repo(__UpperCamelCase	,     **__UpperCamelCase							)
  										A__     :							List[Any]   				=self._get_files_timestamps(__UpperCamelCase							)
  						# 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:
  										A__     :							Dict   				=[getattr(self	,     __UpperCamelCase							) for attribute_name in self.attributes]
  										A__     :							Any   				=[(a.init_kwargs if isinstance(__UpperCamelCase	,     __UpperCamelCase							) else a) for a in attrs]
  										custom_object_save(self	,     __UpperCamelCase	,     config=__UpperCamelCase							)
  
  						for attribute_name in self.attributes:
  										A__     :							int   				=getattr(self	,     __UpperCamelCase							)
  										# Include the processor class in the attribute config so this processor can then be reloaded with the
  										# `AutoProcessor` API.
  										if hasattr(__UpperCamelCase	,     '''_set_processor_class'''							):
  														attribute._set_processor_class(self.__class__.__name__							)
  										attribute.save_pretrained(__UpperCamelCase							)
  
  						if self._auto_class is not None:
  										# We added an attribute to the init_kwargs of the tokenizers, which needs to be cleaned up.
  										for attribute_name in self.attributes:
  														A__     :							List[Any]   				=getattr(self	,     __UpperCamelCase							)
  														if isinstance(__UpperCamelCase	,     __UpperCamelCase							):
  																		del attribute.init_kwargs["auto_map"]
  
  						if push_to_hub:
  										self._upload_modified_files(
  										    __UpperCamelCase	,     __UpperCamelCase	,     __UpperCamelCase	,     commit_message=__UpperCamelCase	,     token=kwargs.get('''use_auth_token'''							)	,     )
  
  
  
  
  
  
  		@classmethod
  		def       lowerCAmelCase_  (  cls	,     __UpperCamelCase	,     __UpperCamelCase = None	,     __UpperCamelCase = False	,     __UpperCamelCase = False	,     __UpperCamelCase = None	,     __UpperCamelCase = "main"	,     **__UpperCamelCase	,     )->			Any:
  						'''simple docstring'''
  
  
  						A__     :							Dict   				=cache_dir
  						A__     :							int   				=force_download
  						A__     :							str   				=local_files_only
  						A__     :							Optional[int]   				=revision
  
  						A__     :							Any   				=kwargs.pop('''use_auth_token'''	,     __UpperCamelCase							)
  						if use_auth_token is not None:
  										warnings.warn(
  										    '''The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers.'''	,     __UpperCamelCase							)
  										if token is not None:
  														raise ValueError(
  														    '''`token` and `use_auth_token` are both specified. Please set only the argument `token`.'''							)
  										A__     :							Optional[Any]   				=use_auth_token
  
  						if token is not None:
  										# change to `token` in a follow-up PR
  										A__     :							Any   				=token
  
  						A__     :							Any   				=cls._get_arguments_from_pretrained(__UpperCamelCase	,     **__UpperCamelCase							)
  						return cls(*__UpperCamelCase							)
  
  
  
  
  
  
  		@classmethod
  		def       lowerCAmelCase_  (  cls	,     __UpperCamelCase="AutoProcessor"							)->			List[str]:
  						'''simple docstring'''
  
  
  						if not isinstance(__UpperCamelCase	,     __UpperCamelCase							):
  										A__     :							Optional[Any]   				=auto_class.__name__
  
  						import transformers.models.auto as auto_module
  
  						if not hasattr(__UpperCamelCase	,     __UpperCamelCase							):
  										raise ValueError(F'{auto_class} is not a valid auto class.'							)
  
  						A__     :							Optional[int]   				=auto_class
  
  
  
  
  
  
  		@classmethod
  		def       lowerCAmelCase_  (  cls	,     __UpperCamelCase	,     **__UpperCamelCase							)->			Dict:
  						'''simple docstring'''
  
  
  						A__     :							List[Any]   				=[]
  						for attribute_name in cls.attributes:
  										A__     :							Any   				=getattr(cls	,     F'{attribute_name}_class'							)
  										if isinstance(__UpperCamelCase	,     __UpperCamelCase							):
  														A__     :							Optional[int]   				=tuple(getattr(__UpperCamelCase	,     __UpperCamelCase							) if n is not None else None for n in class_name							)
  														A__     :							Any   				=kwargs.get('''use_fast'''	,     __UpperCamelCase							)
  														if use_fast and classes[1] is not None:
  																		A__     :							List[str]   				=classes[1]
  														else:
  																		A__     :							Tuple   				=classes[0]
  										else:
  														A__     :							str   				=getattr(__UpperCamelCase	,     __UpperCamelCase							)
  
  										args.append(attribute_class.from_pretrained(__UpperCamelCase	,     **__UpperCamelCase							)							)
  						return args
  
  
  
  
  
  
  		@property
  		def       lowerCAmelCase_  (  self							)->			int:
  						'''simple docstring'''
  
  
  						A__     :							List[Any]   				=getattr(self	,     self.attributes[0]							)
  						return getattr(__UpperCamelCase	,     '''model_input_names'''	,     __UpperCamelCase							)
  
  
  
  
  
  
  
  __lowerCamelCase       :       Optional[Any]				   =			copy_func(ProcessorMixin.push_to_hub)
  if ProcessorMixin.push_to_hub.__doc__ is not None:
  						__lowerCamelCase       :       str				   =			ProcessorMixin.push_to_hub.__doc__.format(
  						    object="processor", object_class="AutoProcessor", object_files="processor files"
  						)
  
  
  
  
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_torch_available,
  )
  
  
  __lowerCamelCase       :       str				   =			{
      "configuration_align": [
          "ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP",
          "AlignConfig",
          "AlignTextConfig",
          "AlignVisionConfig",
      ],
      "processing_align": ["AlignProcessor"],
  }
  
  try:
  						if not is_torch_available():
  												raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  						pass
  else:
  						__lowerCamelCase       :       Dict				   =			[
  						    "ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST",
  						    "AlignModel",
  						    "AlignPreTrainedModel",
  						    "AlignTextModel",
  						    "AlignVisionModel",
  						]
  
  if TYPE_CHECKING:
  						from .configuration_align import (
  						    ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
  						    AlignConfig,
  						    AlignTextConfig,
  						    AlignVisionConfig,
  						)
  						from .processing_align import AlignProcessor
  
  						try:
  												if not is_torch_available():
  																		raise OptionalDependencyNotAvailable()
  						except OptionalDependencyNotAvailable:
  												pass
  						else:
  												from .modeling_align import (
  												    ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
  												    AlignModel,
  												    AlignPreTrainedModel,
  												    AlignTextModel,
  												    AlignVisionModel,
  												)
  
  else:
  						import sys
  
  						__lowerCamelCase       :       List[str]				   =			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
  
  
  
  