






import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding





class __lowerCamelCase			(				snake_case__):





	"""simple docstring"""






	UpperCamelCase__								=				["image_processor", "tokenizer"]
	UpperCamelCase__								=				"AutoImageProcessor"
	UpperCamelCase__								=				"AutoTokenizer"

	def __init__(							self	,   UpperCAmelCase=None	,   UpperCAmelCase=None	,   **UpperCAmelCase   ):
							"""simple docstring"""







							_UpperCAmelCase     =      None
							if "feature_extractor" in kwargs:
													warnings.warn(
													    'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
													    ' instead.'	,   UpperCAmelCase	,   )
													_UpperCAmelCase     =      kwargs.pop('feature_extractor'   )

							_UpperCAmelCase     =      image_processor if image_processor is not None else feature_extractor
							if image_processor is None:
													raise ValueError('You have to specify an image_processor.'   )
							if tokenizer is None:
													raise ValueError('You have to specify a tokenizer.'   )

							super().__init__(UpperCAmelCase	,   UpperCAmelCase   )
							_UpperCAmelCase     =      self.image_processor

	def __call__(							self	,   UpperCAmelCase=None	,   UpperCAmelCase=None	,   UpperCAmelCase=None	,   **UpperCAmelCase   ):
							"""simple docstring"""







							if text is None and images is None:
													raise ValueError('You have to specify either text or images. Both cannot be none.'   )

							if text is not None:
													_UpperCAmelCase     =      self.tokenizer(UpperCAmelCase	,   return_tensors=UpperCAmelCase	,   **UpperCAmelCase   )

							if images is not None:
													_UpperCAmelCase     =      self.image_processor(UpperCAmelCase	,   return_tensors=UpperCAmelCase	,   **UpperCAmelCase   )

							if text is not None and images is not None:
													_UpperCAmelCase     =      image_features.pixel_values
													return encoding
							elif text is not None:
													return encoding
							else:
													return BatchEncoding(data=dict(**UpperCAmelCase   )	,   tensor_type=UpperCAmelCase   )

	def 	UpperCamelCase   (							self	,   *UpperCAmelCase	,   **UpperCAmelCase   ):
							"""simple docstring"""







							return self.tokenizer.batch_decode(*UpperCAmelCase	,   **UpperCAmelCase   )

	def 	UpperCamelCase   (							self	,   *UpperCAmelCase	,   **UpperCAmelCase   ):
							"""simple docstring"""







							return self.tokenizer.decode(*UpperCAmelCase	,   **UpperCAmelCase   )

	@property
	def 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							_UpperCAmelCase     =      self.tokenizer.model_input_names
							_UpperCAmelCase     =      self.image_processor.model_input_names
							return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names   )   )

	@property
	def 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							warnings.warn(
							    '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'	,   UpperCAmelCase	,   )
							return self.image_processor_class

	@property
	def 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							warnings.warn(
							    '`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.'	,   UpperCAmelCase	,   )
							return self.image_processor








from ...configuration_utils import PretrainedConfig
from ...utils import logging


_a				     =  logging.get_logger(__name__)

_a				     =  {
    '''facebook/regnet-y-040''': '''https://huggingface.co/facebook/regnet-y-040/blob/main/config.json''',
}





class __lowerCamelCase			(				snake_case__):





	"""simple docstring"""






	UpperCamelCase__								=				"regnet"
	UpperCamelCase__								=				["x", "y"]

	def __init__(							self	,   UpperCAmelCase=3	,   UpperCAmelCase=32	,   UpperCAmelCase=[128, 192, 512, 1088]	,   UpperCAmelCase=[2, 6, 12, 2]	,   UpperCAmelCase=64	,   UpperCAmelCase="y"	,   UpperCAmelCase="relu"	,   **UpperCAmelCase	,   ):
							"""simple docstring"""







							super().__init__(**UpperCAmelCase   )
							if layer_type not in self.layer_types:
													raise ValueError(F"""layer_type={layer_type} is not one of {",".join(self.layer_types   )}"""   )
							_UpperCAmelCase     =      num_channels
							_UpperCAmelCase     =      embedding_size
							_UpperCAmelCase     =      hidden_sizes
							_UpperCAmelCase     =      depths
							_UpperCAmelCase     =      groups_width
							_UpperCAmelCase     =      layer_type
							_UpperCAmelCase     =      hidden_act
							# always downsample in the first stage
							_UpperCAmelCase     =      True
