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
  
  
  __A   :     Tuple      =			logging.get_logger(__name__)
  
  # Dynamically import the Transformers module to grab the attribute classes of the processor form their names.
  __A   :     List[str]      =			direct_transformers_import(Path(__file__).parent)
  
  
  __A   :     Tuple      =			{
      '''AutoTokenizer''': '''PreTrainedTokenizerBase''',
      '''AutoFeatureExtractor''': '''FeatureExtractionMixin''',
      '''AutoImageProcessor''': '''ImageProcessingMixin''',
  }
  
  
  
  
  
  
  class    __A				(							lowerCAmelCase ):
      lowerCAmelCase_							:		str						=							["feature_extractor", "tokenizer"]
      # Names need to be attr_class for attr in attributes
      lowerCAmelCase_							:		int						=							None
      lowerCAmelCase_							:		Any						=							None
      lowerCAmelCase_							:		int						=							None
  
  
  
  
  
  
      def __init__(	self			:    int    ,				*UpperCAmelCase_			:    Any    ,				**UpperCAmelCase_			:    Union[str, Any]    ):
          # Sanitize args and kwargs
          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:
                  lowerCAmelCase				:			Union[str, Any]    			=      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():
              lowerCAmelCase				:			str    			=      getattr(self    ,				f"{attribute_name}_class"    )
              # Nothing is ever going to be an instance of "AutoXxx", in that case we check the base class.
              lowerCAmelCase				:			List[Any]    			=      AUTO_TO_BASE_CLASS_MAPPING.get(UpperCAmelCase_    ,				UpperCAmelCase_    )
              if isinstance(UpperCAmelCase_    ,				UpperCAmelCase_    ):
                  lowerCAmelCase				:			Any    			=      tuple(getattr(UpperCAmelCase_    ,				UpperCAmelCase_    ) for n in class_name if n is not None    )
              else:
                  lowerCAmelCase				:			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			:    int    ):
          lowerCAmelCase				:			int    			=      [f"- {name}: {repr(getattr(self    ,				UpperCAmelCase_    )    )}" for name in self.attributes]
          lowerCAmelCase				:			Dict    			=      '\n'.join(UpperCAmelCase_    )
          return f"{self.__class__.__name__}:\n{attributes_repr}"
  
  
  
  
  
  
      def 	lowercase__ (	self			:    str    ,				UpperCAmelCase_			:    Optional[Any]    ,				UpperCAmelCase_			:    bool = False    ,				**UpperCAmelCase_			:    str    ):
          os.makedirs(UpperCAmelCase_    ,				exist_ok=UpperCAmelCase_    )
  
          if push_to_hub:
              lowerCAmelCase				:			Union[str, Any]    			=      kwargs.pop('commit_message'    ,				UpperCAmelCase_    )
              lowerCAmelCase				:			List[Any]    			=      kwargs.pop('repo_id'    ,				save_directory.split(os.path.sep    )[-1]    )
              lowerCAmelCase				:			List[Any]    			=      self._create_repo(UpperCAmelCase_    ,				**UpperCAmelCase_    )
              lowerCAmelCase				:			Dict    			=      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:
              lowerCAmelCase				:			List[Any]    			=      [getattr(self    ,				UpperCAmelCase_    ) for attribute_name in self.attributes]
              lowerCAmelCase				:			Optional[int]    			=      [(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:
              lowerCAmelCase				:			Union[str, Any]    			=      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:
                  lowerCAmelCase				:			Optional[int]    			=      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 	lowercase__ (	cls			:    Any    ,				UpperCAmelCase_			:    Union[str, os.PathLike]    ,				UpperCAmelCase_			:    Optional[Union[str, os.PathLike]] = None    ,				UpperCAmelCase_			:    bool = False    ,				UpperCAmelCase_			:    bool = False    ,				UpperCAmelCase_			:    Optional[Union[str, bool]] = None    ,				UpperCAmelCase_			:    str = "main"    ,				**UpperCAmelCase_			:    List[str]    ,				):
          lowerCAmelCase				:			Optional[int]    			=      cache_dir
          lowerCAmelCase				:			str    			=      force_download
          lowerCAmelCase				:			Tuple    			=      local_files_only
          lowerCAmelCase				:			str    			=      revision
  
          lowerCAmelCase				:			str    			=      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`.'    )
              lowerCAmelCase				:			List[Any]    			=      use_auth_token
  
          if token is not None:
              # change to `token` in a follow-up PR
              lowerCAmelCase				:			List[str]    			=      token
  
          lowerCAmelCase				:			Dict    			=      cls._get_arguments_from_pretrained(UpperCAmelCase_    ,				**UpperCAmelCase_    )
          return cls(*UpperCAmelCase_    )
  
  
  
  
  
  
      @classmethod
      def 	lowercase__ (	cls			:    List[str]    ,				UpperCAmelCase_			:    Tuple="AutoProcessor"    ):
          if not isinstance(UpperCAmelCase_    ,				UpperCAmelCase_    ):
              lowerCAmelCase				:			List[str]    			=      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."    )
  
          lowerCAmelCase				:			List[Any]    			=      auto_class
  
  
  
  
  
  
      @classmethod
      def 	lowercase__ (	cls			:    Dict    ,				UpperCAmelCase_			:    List[str]    ,				**UpperCAmelCase_			:    Tuple    ):
          lowerCAmelCase				:			Tuple    			=      []
          for attribute_name in cls.attributes:
              lowerCAmelCase				:			Dict    			=      getattr(cls    ,				f"{attribute_name}_class"    )
              if isinstance(UpperCAmelCase_    ,				UpperCAmelCase_    ):
                  lowerCAmelCase				:			str    			=      tuple(getattr(UpperCAmelCase_    ,				UpperCAmelCase_    ) if n is not None else None for n in class_name    )
                  lowerCAmelCase				:			Dict    			=      kwargs.get('use_fast'    ,				UpperCAmelCase_    )
                  if use_fast and classes[1] is not None:
                      lowerCAmelCase				:			int    			=      classes[1]
                  else:
                      lowerCAmelCase				:			Tuple    			=      classes[0]
              else:
                  lowerCAmelCase				:			Tuple    			=      getattr(UpperCAmelCase_    ,				UpperCAmelCase_    )
  
              args.append(attribute_class.from_pretrained(UpperCAmelCase_    ,				**UpperCAmelCase_    )    )
          return args
  
  
  
  
  
  
      @property
      def 	lowercase__ (	self			:    List[str]    ):
          lowerCAmelCase				:			List[Any]    			=      getattr(self    ,				self.attributes[0]    )
          return getattr(UpperCAmelCase_    ,				'model_input_names'    ,				UpperCAmelCase_    )
  
  
  
  __A   :     List[Any]      =			copy_func(ProcessorMixin.push_to_hub)
  if ProcessorMixin.push_to_hub.__doc__ is not None:
   __A   :     Dict      =			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
  
  
  __A   :     List[Any]      =			{'''configuration_umt5''': ['''UMT5Config''', '''UMT5OnnxConfig''']}
  
  
  try:
   if not is_torch_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   __A   :     Tuple      =			[
       '''UMT5EncoderModel''',
       '''UMT5ForConditionalGeneration''',
       '''UMT5ForQuestionAnswering''',
       '''UMT5Model''',
       '''UMT5PreTrainedModel''',
   ]
  
  if TYPE_CHECKING:
   from .configuration_umta import UMTaConfig, UMTaOnnxConfig
  
   try:
    if not is_torch_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from .modeling_umta import (
        UMTaEncoderModel,
        UMTaForConditionalGeneration,
        UMTaForQuestionAnswering,
        UMTaModel,
        UMTaPreTrainedModel,
    )
  else:
   import sys
  
   __A   :     Any      =			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
  
  
  
  
  
  