



"""simple docstring"""






import random
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
		import torch

if is_vision_available():
		import PIL

		from transformers import FlavaImageProcessor
		from transformers.image_utils import PILImageResampling
		from transformers.models.flava.image_processing_flava import (
		    FLAVA_CODEBOOK_MEAN,
		    FLAVA_CODEBOOK_STD,
		    FLAVA_IMAGE_MEAN,
		    FLAVA_IMAGE_STD,
		)
else:
		_lowercase					:					Tuple 		=		None

class 			__SCREAMING_SNAKE_CASE      ( unittest.TestCase  ):


					'''simple docstring'''





					def __init__(			self				:    List[str],    lowerCamelCase				:    Optional[Any],    lowerCamelCase				:    Optional[Any]=7,    lowerCamelCase				:    Tuple=3,    lowerCamelCase				:    List[Any]=30,    lowerCamelCase				:    Any=400,    lowerCamelCase				:    List[str]=True,    lowerCamelCase				:    Tuple=None,    lowerCamelCase				:    Optional[Any]=True,    lowerCamelCase				:    Any=None,    lowerCamelCase				:    str=None,    lowerCamelCase				:    Tuple=True,    lowerCamelCase				:    int=1 / 255,    lowerCamelCase				:    Optional[int]=True,    lowerCamelCase				:    List[str]=FLAVA_IMAGE_MEAN,    lowerCamelCase				:    Optional[Any]=FLAVA_IMAGE_STD,    lowerCamelCase				:    List[str]=14,    lowerCamelCase				:    str=75,    lowerCamelCase				:    Optional[int]=None,    lowerCamelCase				:    Union[str, Any]=16,    lowerCamelCase				:    List[Any]=0.3,    lowerCamelCase				:    List[Any]=None,    lowerCamelCase				:    int=True,    lowerCamelCase				:    Any=None,    lowerCamelCase				:    Tuple=None,    lowerCamelCase				:    int=True,    lowerCamelCase				:    str=None,    lowerCamelCase				:    Tuple=True,    lowerCamelCase				:    Any=True,    lowerCamelCase				:    List[Any]=FLAVA_CODEBOOK_MEAN,    lowerCamelCase				:    str=FLAVA_CODEBOOK_STD,    )->   Optional[Any]:
								lowerCamelCase__						:						Any						      =size if size is not None else {'''height''': 224, '''width''': 224}
								lowerCamelCase__						:						Optional[Any]						      =crop_size if crop_size is not None else {'''height''': 224, '''width''': 224}
								lowerCamelCase__						:						str						      =codebook_size if codebook_size is not None else {'''height''': 112, '''width''': 112}
								lowerCamelCase__						:						Optional[Any]						      =codebook_crop_size if codebook_crop_size is not None else {'''height''': 112, '''width''': 112}

								lowerCamelCase__						:						Any						      =parent
								lowerCamelCase__						:						Union[str, Any]						      =batch_size
								lowerCamelCase__						:						Tuple						      =num_channels
								lowerCamelCase__						:						Optional[int]						      =do_resize
								lowerCamelCase__						:						Union[str, Any]						      =do_rescale
								lowerCamelCase__						:						Dict						      =rescale_factor
								lowerCamelCase__						:						Optional[int]						      =min_resolution
								lowerCamelCase__						:						Optional[Any]						      =max_resolution
								lowerCamelCase__						:						Dict						      =size
								lowerCamelCase__						:						int						      =resample if resample is not None else PILImageResampling.BICUBIC
								lowerCamelCase__						:						Any						      =do_normalize
								lowerCamelCase__						:						Optional[int]						      =image_mean
								lowerCamelCase__						:						str						      =image_std
								lowerCamelCase__						:						Union[str, Any]						      =do_center_crop
								lowerCamelCase__						:						List[Any]						      =crop_size

								lowerCamelCase__						:						List[str]						      =input_size_patches
								lowerCamelCase__						:						int						      =total_mask_patches
								lowerCamelCase__						:						List[str]						      =mask_group_max_patches
								lowerCamelCase__						:						Any						      =mask_group_min_patches
								lowerCamelCase__						:						int						      =mask_group_min_aspect_ratio
								lowerCamelCase__						:						Any						      =mask_group_max_aspect_ratio

								lowerCamelCase__						:						Union[str, Any]						      =codebook_do_resize
								lowerCamelCase__						:						Any						      =codebook_size
								lowerCamelCase__						:						str						      =codebook_resample if codebook_resample is not None else PILImageResampling.LANCZOS
								lowerCamelCase__						:						Optional[Any]						      =codebook_do_center_crop
								lowerCamelCase__						:						Any						      =codebook_crop_size
								lowerCamelCase__						:						int						      =codebook_do_map_pixels
								lowerCamelCase__						:						Optional[int]						      =codebook_do_normalize
								lowerCamelCase__						:						Union[str, Any]						      =codebook_image_mean
								lowerCamelCase__						:						int						      =codebook_image_std



					def 						snake_case			(			self				:    Optional[int]	)->   int:
								return {
								    "image_mean": self.image_mean,
								    "image_std": self.image_std,
								    "do_normalize": self.do_normalize,
								    "do_resize": self.do_resize,
								    "size": self.size,
								    "resample": self.resample,
								    "do_rescale": self.do_rescale,
								    "rescale_factor": self.rescale_factor,
								    "do_center_crop": self.do_center_crop,
								    "crop_size": self.crop_size,
								    "input_size_patches": self.input_size_patches,
								    "total_mask_patches": self.total_mask_patches,
								    "mask_group_max_patches": self.mask_group_max_patches,
								    "mask_group_min_patches": self.mask_group_min_patches,
								    "mask_group_min_aspect_ratio": self.mask_group_min_aspect_ratio,
								    "mask_group_max_aspect_ratio": self.mask_group_min_aspect_ratio,
								    "codebook_do_resize": self.codebook_do_resize,
								    "codebook_size": self.codebook_size,
								    "codebook_resample": self.codebook_resample,
								    "codebook_do_center_crop": self.codebook_do_center_crop,
								    "codebook_crop_size": self.codebook_crop_size,
								    "codebook_do_map_pixels": self.codebook_do_map_pixels,
								    "codebook_do_normalize": self.codebook_do_normalize,
								    "codebook_image_mean": self.codebook_image_mean,
								    "codebook_image_std": self.codebook_image_std,
								}



					def 						snake_case			(			self				:    int	)->   Optional[int]:
								return (self.size["height"], self.size["width"])



					def 						snake_case			(			self				:    Optional[Any]	)->   Tuple:
								return (
								    (self.input_size_patches, self.input_size_patches)
								    if not isinstance(self.input_size_patches,    lowerCamelCase	)
								    else self.input_size_patches
								)




					def 						snake_case			(			self				:    Union[str, Any]	)->   Union[str, Any]:
								return (self.codebook_size["height"], self.codebook_size["width"])





@require_torch
@require_vision
class 			__SCREAMING_SNAKE_CASE      ( lowerCAmelCase_						,  unittest.TestCase  ):


					'''simple docstring'''





					_a       =				FlavaImageProcessor if is_vision_available() else None
					_a       =				None



					def 						snake_case			(			self				:    List[Any]	)->   str:
								lowerCamelCase__						:						str						      =FlavaImageProcessingTester(self	)



					@property
					def 						snake_case			(			self				:    Dict	)->   Dict:
								return self.image_processor_tester.prepare_image_processor_dict()



					def 						snake_case			(			self				:    Tuple	)->   Optional[int]:
								lowerCamelCase__						:						Tuple						      =self.image_processing_class(**self.image_processor_dict	)
								self.assertTrue(hasattr(lowerCamelCase,    '''image_mean'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''image_std'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''do_normalize'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''do_resize'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''resample'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''crop_size'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''do_center_crop'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''do_rescale'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''rescale_factor'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''masking_generator'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_do_resize'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_size'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_resample'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_do_center_crop'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_crop_size'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_do_map_pixels'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_do_normalize'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_image_mean'''	)	)
								self.assertTrue(hasattr(lowerCamelCase,    '''codebook_image_std'''	)	)



					def 						snake_case			(			self				:    Any	)->   Union[str, Any]:
								lowerCamelCase__						:						str						      =self.image_processing_class.from_dict(self.image_processor_dict	)
								self.assertEqual(image_processor.size,    {'''height''': 224, '''width''': 224}	)
								self.assertEqual(image_processor.crop_size,    {'''height''': 224, '''width''': 224}	)
								self.assertEqual(image_processor.codebook_size,    {'''height''': 112, '''width''': 112}	)
								self.assertEqual(image_processor.codebook_crop_size,    {'''height''': 112, '''width''': 112}	)

								lowerCamelCase__						:						List[str]						      =self.image_processing_class.from_dict(
								    self.image_processor_dict,    size=42,    crop_size=84,    codebook_size=33,    codebook_crop_size=66	)
								self.assertEqual(image_processor.size,    {'''height''': 42, '''width''': 42}	)
								self.assertEqual(image_processor.crop_size,    {'''height''': 84, '''width''': 84}	)
								self.assertEqual(image_processor.codebook_size,    {'''height''': 33, '''width''': 33}	)
								self.assertEqual(image_processor.codebook_crop_size,    {'''height''': 66, '''width''': 66}	)



					def 						snake_case			(			self				:    Optional[Any]	)->   Dict:
								pass



					def 						snake_case			(			self				:    int	)->   Optional[Any]:
								# Initialize image_processing
								lowerCamelCase__						:						Optional[int]						      =self.image_processing_class(**self.image_processor_dict	)
								# create random PIL images
								lowerCamelCase__						:						int						      =prepare_image_inputs(self.image_processor_tester,    equal_resolution=lowerCamelCase	)
								for image in image_inputs:
											self.assertIsInstance(lowerCamelCase,    PIL.Image.Image	)

								# Test not batched input
								lowerCamelCase__						:						List[Any]						      =image_processing(image_inputs[0],    return_tensors='''pt'''	)

								# Test no bool masked pos
								self.assertFalse('''bool_masked_pos''' in encoded_images	)

								lowerCamelCase__      ,  lowerCamelCase__						:						Union[str, Any]						      =self.image_processor_tester.get_expected_image_size()

								self.assertEqual(
								    encoded_images.pixel_values.shape,    (1, self.image_processor_tester.num_channels, expected_height, expected_width),    )

								# Test batched
								lowerCamelCase__						:						Dict						      =image_processing(lowerCamelCase,    return_tensors='''pt'''	)
								lowerCamelCase__      ,  lowerCamelCase__						:						int						      =self.image_processor_tester.get_expected_image_size()

								# Test no bool masked pos
								self.assertFalse('''bool_masked_pos''' in encoded_images	)

								self.assertEqual(
								    encoded_images.pixel_values.shape,    (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),    )



					def 						snake_case			(			self				:    Union[str, Any],    lowerCamelCase				:    str,    lowerCamelCase				:    Tuple	)->   Optional[int]:
								# Initialize image_processing
								lowerCamelCase__						:						Tuple						      =self.image_processing_class(**self.image_processor_dict	)
								# create random tensors
								lowerCamelCase__						:						Union[str, Any]						      =prepare_image_inputs(self.image_processor_tester,    equal_resolution=lowerCamelCase,    **lowerCamelCase	)
								for image in image_inputs:
											self.assertIsInstance(lowerCamelCase,    lowerCamelCase	)

								# Test not batched input
								lowerCamelCase__						:						List[str]						      =image_processing(image_inputs[0],    return_tensors='''pt'''	)

								lowerCamelCase__      ,  lowerCamelCase__						:						int						      =self.image_processor_tester.get_expected_image_size()
								self.assertEqual(
								    encoded_images.pixel_values.shape,    (1, self.image_processor_tester.num_channels, expected_height, expected_width),    )

								lowerCamelCase__						:						List[str]						      =image_processing(lowerCamelCase,    return_image_mask=lowerCamelCase,    return_tensors='''pt'''	)

								lowerCamelCase__      ,  lowerCamelCase__						:						int						      =self.image_processor_tester.get_expected_image_size()
								self.assertEqual(
								    encoded_images.pixel_values.shape,    (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),    )

								lowerCamelCase__      ,  lowerCamelCase__						:						Tuple						      =self.image_processor_tester.get_expected_mask_size()
								self.assertEqual(
								    encoded_images.bool_masked_pos.shape,    (
								        self.image_processor_tester.batch_size,
								        expected_height,
								        expected_width,
								    ),    )

								# Test batched
								lowerCamelCase__						:						int						      =image_processing(lowerCamelCase,    return_tensors='''pt'''	).pixel_values

								lowerCamelCase__      ,  lowerCamelCase__						:						int						      =self.image_processor_tester.get_expected_image_size()
								self.assertEqual(
								    encoded_images.shape,    (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),    )

								# Test masking
								lowerCamelCase__						:						List[str]						      =image_processing(lowerCamelCase,    return_image_mask=lowerCamelCase,    return_tensors='''pt'''	)

								lowerCamelCase__      ,  lowerCamelCase__						:						Any						      =self.image_processor_tester.get_expected_image_size()
								self.assertEqual(
								    encoded_images.pixel_values.shape,    (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),    )

								lowerCamelCase__      ,  lowerCamelCase__						:						str						      =self.image_processor_tester.get_expected_mask_size()
								self.assertEqual(
								    encoded_images.bool_masked_pos.shape,    (
								        self.image_processor_tester.batch_size,
								        expected_height,
								        expected_width,
								    ),    )



					def 						snake_case			(			self				:    Optional[int]	)->   Tuple:
								self._test_call_framework(np.ndarray,    prepare_kwargs={'''numpify''': True}	)



					def 						snake_case			(			self				:    Optional[Any]	)->   Dict:
								self._test_call_framework(torch.Tensor,    prepare_kwargs={'''torchify''': True}	)



					def 						snake_case			(			self				:    Dict	)->   int:
								# Initialize image_processing
								random.seed(1234	)
								lowerCamelCase__						:						Optional[int]						      =self.image_processing_class(**self.image_processor_dict	)
								lowerCamelCase__						:						Any						      =prepare_image_inputs(self.image_processor_tester,    equal_resolution=lowerCamelCase,    torchify=lowerCamelCase	)

								# Test not batched input
								lowerCamelCase__						:						List[str]						      =image_processing(image_inputs[0],    return_image_mask=lowerCamelCase,    return_tensors='''pt'''	)
								self.assertEqual(encoded_images.bool_masked_pos.sum().item(),    75	)




					def 						snake_case			(			self				:    List[Any]	)->   str:
								# Initialize image_processing
								lowerCamelCase__						:						List[Any]						      =self.image_processing_class(**self.image_processor_dict	)
								# create random PIL images
								lowerCamelCase__						:						List[Any]						      =prepare_image_inputs(self.image_processor_tester,    equal_resolution=lowerCamelCase	)
								for image in image_inputs:
											self.assertIsInstance(lowerCamelCase,    PIL.Image.Image	)

								# Test not batched input
								lowerCamelCase__						:						Optional[Any]						      =image_processing(image_inputs[0],    return_codebook_pixels=lowerCamelCase,    return_tensors='''pt'''	)
								lowerCamelCase__      ,  lowerCamelCase__						:						Dict						      =self.image_processor_tester.get_expected_codebook_image_size()
								self.assertEqual(
								    encoded_images.codebook_pixel_values.shape,    (1, self.image_processor_tester.num_channels, expected_height, expected_width),    )

								# Test batched
								lowerCamelCase__						:						List[Any]						      =image_processing(lowerCamelCase,    return_codebook_pixels=lowerCamelCase,    return_tensors='''pt'''	)
								lowerCamelCase__      ,  lowerCamelCase__						:						int						      =self.image_processor_tester.get_expected_codebook_image_size()
								self.assertEqual(
								    encoded_images.codebook_pixel_values.shape,    (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        expected_height,
								        expected_width,
								    ),    )





"""simple docstring"""







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


UpperCamelCase_							:							Optional[int]				 =		logging.get_logger(__name__)

# Dynamically import the Transformers module to grab the attribute classes of the processor form their names.
UpperCamelCase_							:							Optional[Any]				 =		direct_transformers_import(Path(__file__).parent)


UpperCamelCase_							:							Optional[int]				 =		{
    """AutoTokenizer""": """PreTrainedTokenizerBase""",
    """AutoFeatureExtractor""": """FeatureExtractionMixin""",
    """AutoImageProcessor""": """ImageProcessingMixin""",
}


class       _lowercase		( __lowerCamelCase	):
				lowerCamelCase__							=							['feature_extractor', 'tokenizer']
				# Names need to be attr_class for attr in attributes
				lowerCamelCase__							=							None
				lowerCamelCase__							=							None
				lowerCamelCase__							=							None

				def __init__(  self							:     Any							,     *_lowercase							:     Optional[int]							,     **_lowercase							:     int  ):


										'''simple docstring'''
										# 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(_lowercase							,     self.attributes  ):
																if attribute_name in kwargs:
																						raise TypeError(f'Got multiple values for argument {attribute_name}.'  )
																else:
																						UpperCAmelCase__       						=		arg

										if len(_lowercase  ) != len(self.attributes  ):
																raise ValueError(
																    f'This processor requires {len(self.attributes  )} arguments: {", ".join(self.attributes  )}. Got '
																    f'{len(_lowercase  )} 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():
																UpperCAmelCase__       						=		getattr(self							,     f'{attribute_name}_class'  )
																# Nothing is ever going to be an instance of "AutoXxx", in that case we check the base class.
																UpperCAmelCase__       						=		AUTO_TO_BASE_CLASS_MAPPING.get(_lowercase							,     _lowercase  )
																if isinstance(_lowercase							,     _lowercase  ):
																						UpperCAmelCase__       						=		tuple(getattr(_lowercase							,     _lowercase  ) for n in class_name if n is not None  )
																else:
																						UpperCAmelCase__       						=		getattr(_lowercase							,     _lowercase  )

																if not isinstance(_lowercase							,     _lowercase  ):
																						raise ValueError(
																						    f'Received a {type(_lowercase  ).__name__} for argument {attribute_name}, but a {class_name} was expected.'  )

																setattr(self							,     _lowercase							,     _lowercase  )

				def __repr__(  self							:     Tuple  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		[f'- {name}: {repr(getattr(self							,     _lowercase  )  )}' for name in self.attributes]
										UpperCAmelCase__       						=		"""\n""".join(_lowercase  )
										return f'{self.__class__.__name__}:\n{attributes_repr}'

				def 							A			(  self							:     Tuple							,     _lowercase							:     Dict							,     _lowercase							:     bool = False							,     **_lowercase							:     List[str]  ):


										'''simple docstring'''
										os.makedirs(_lowercase							,     exist_ok=_lowercase  )

										if push_to_hub:
																UpperCAmelCase__       						=		kwargs.pop("""commit_message"""							,     _lowercase  )
																UpperCAmelCase__       						=		kwargs.pop("""repo_id"""							,     save_directory.split(os.path.sep  )[-1]  )
																UpperCAmelCase__       						=		self._create_repo(_lowercase							,     **_lowercase  )
																UpperCAmelCase__       						=		self._get_files_timestamps(_lowercase  )
										# 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:
																UpperCAmelCase__       						=		[getattr(self							,     _lowercase  ) for attribute_name in self.attributes]
																UpperCAmelCase__       						=		[(a.init_kwargs if isinstance(_lowercase							,     _lowercase  ) else a) for a in attrs]
																custom_object_save(self							,     _lowercase							,     config=_lowercase  )

										for attribute_name in self.attributes:
																UpperCAmelCase__       						=		getattr(self							,     _lowercase  )
																# Include the processor class in the attribute config so this processor can then be reloaded with the
																# `AutoProcessor` API.
																if hasattr(_lowercase							,     """_set_processor_class"""  ):
																						attribute._set_processor_class(self.__class__.__name__  )
																attribute.save_pretrained(_lowercase  )

										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:
																						UpperCAmelCase__       						=		getattr(self							,     _lowercase  )
																						if isinstance(_lowercase							,     _lowercase  ):
																												del attribute.init_kwargs["auto_map"]

										if push_to_hub:
																self._upload_modified_files(
																    _lowercase							,     _lowercase							,     _lowercase							,     commit_message=_lowercase							,     token=kwargs.get("""use_auth_token"""  )							,     )

				@classmethod
				def 							A			(  cls							:     Dict							,     _lowercase							:     Union[str, os.PathLike]							,     _lowercase							:     Optional[Union[str, os.PathLike]] = None							,     _lowercase							:     bool = False							,     _lowercase							:     bool = False							,     _lowercase							:     Optional[Union[str, bool]] = None							,     _lowercase							:     str = "main"							,     **_lowercase							:     Dict							,     ):


										'''simple docstring'''
										UpperCAmelCase__       						=		cache_dir
										UpperCAmelCase__       						=		force_download
										UpperCAmelCase__       						=		local_files_only
										UpperCAmelCase__       						=		revision

										UpperCAmelCase__       						=		kwargs.pop("""use_auth_token"""							,     _lowercase  )
										if use_auth_token is not None:
																warnings.warn(
																    """The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers."""							,     _lowercase  )
																if token is not None:
																						raise ValueError(
																						    """`token` and `use_auth_token` are both specified. Please set only the argument `token`."""  )
																UpperCAmelCase__       						=		use_auth_token

										if token is not None:
																# change to `token` in a follow-up PR
																UpperCAmelCase__       						=		token

										UpperCAmelCase__       						=		cls._get_arguments_from_pretrained(_lowercase							,     **_lowercase  )
										return cls(*_lowercase  )

				@classmethod
				def 							A			(  cls							:     List[Any]							,     _lowercase							:     Dict="AutoProcessor"  ):


										'''simple docstring'''
										if not isinstance(_lowercase							,     _lowercase  ):
																UpperCAmelCase__       						=		auto_class.__name__

										import transformers.models.auto as auto_module

										if not hasattr(_lowercase							,     _lowercase  ):
																raise ValueError(f'{auto_class} is not a valid auto class.'  )

										UpperCAmelCase__       						=		auto_class

				@classmethod
				def 							A			(  cls							:     Any							,     _lowercase							:     Tuple							,     **_lowercase							:     List[Any]  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		[]
										for attribute_name in cls.attributes:
																UpperCAmelCase__       						=		getattr(cls							,     f'{attribute_name}_class'  )
																if isinstance(_lowercase							,     _lowercase  ):
																						UpperCAmelCase__       						=		tuple(getattr(_lowercase							,     _lowercase  ) if n is not None else None for n in class_name  )
																						UpperCAmelCase__       						=		kwargs.get("""use_fast"""							,     _lowercase  )
																						if use_fast and classes[1] is not None:
																												UpperCAmelCase__       						=		classes[1]
																						else:
																												UpperCAmelCase__       						=		classes[0]
																else:
																						UpperCAmelCase__       						=		getattr(_lowercase							,     _lowercase  )

																args.append(attribute_class.from_pretrained(_lowercase							,     **_lowercase  )  )
										return args

				@property
				def 							A			(  self							:     int  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		getattr(self							,     self.attributes[0]  )
										return getattr(_lowercase							,     """model_input_names"""							,     _lowercase  )
UpperCamelCase_							:							List[Any]				 =		copy_func(ProcessorMixin.push_to_hub)
if ProcessorMixin.push_to_hub.__doc__ is not None:
						UpperCamelCase_							:							Dict				 =		ProcessorMixin.push_to_hub.__doc__.format(
						    object="""processor""", object_class="""AutoProcessor""", object_files="""processor files"""
						)

