


import warnings

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







class 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						["""image_processor""", """tokenizer"""]
							_UpperCAmelCase      =						"""ViTImageProcessor"""
							_UpperCAmelCase      =						("""CLIPTokenizer""", """CLIPTokenizerFast""")






							def __init__(      self			,						lowerCAmelCase__=None			,						lowerCAmelCase__=None			,						**lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Any					=					None
										if "feature_extractor" in kwargs:
													warnings.warn(
													    'The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`'
													    ' instead.'			,						lowerCAmelCase__			,						)
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					kwargs.pop('feature_extractor'       )

										SCREAMING_SNAKE_CASE_		:     str					=					image_processor if image_processor is not None else feature_extractor
										if image_processor is None:
													raise ValueError('You need to specify an `image_processor`.'       )
										if tokenizer is None:
													raise ValueError('You need to specify a `tokenizer`.'       )

										super().__init__(lowerCAmelCase__			,						lowerCAmelCase__       )






							def __call__(      self			,						lowerCAmelCase__=None			,						lowerCAmelCase__=None			,						lowerCAmelCase__=None			,						lowerCAmelCase__=None			,						**lowerCAmelCase__       ):





										"""simple docstring"""




										if text is None and visual_prompt is None and images is None:
													raise ValueError('You have to specify either text, visual prompt or images.'       )

										if text is not None and visual_prompt is not None:
													raise ValueError('You have to specify exactly one type of prompt. Either text or visual prompt.'       )

										if text is not None:
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					self.tokenizer(lowerCAmelCase__			,						return_tensors=lowerCAmelCase__			,						**lowerCAmelCase__       )

										if visual_prompt is not None:
													SCREAMING_SNAKE_CASE_		:     int					=					self.image_processor(lowerCAmelCase__			,						return_tensors=lowerCAmelCase__			,						**lowerCAmelCase__       )

										if images is not None:
													SCREAMING_SNAKE_CASE_		:     Dict					=					self.image_processor(lowerCAmelCase__			,						return_tensors=lowerCAmelCase__			,						**lowerCAmelCase__       )

										if visual_prompt is not None and images is not None:
													SCREAMING_SNAKE_CASE_		:     List[str]					=					{
													    'pixel_values': image_features.pixel_values,
													    'conditional_pixel_values': prompt_features.pixel_values,
													}
													return encoding
										elif text is not None and images is not None:
													SCREAMING_SNAKE_CASE_		:     Optional[int]					=					image_features.pixel_values
													return encoding
										elif text is not None:
													return encoding
										elif visual_prompt is not None:
													SCREAMING_SNAKE_CASE_		:     Tuple					=					{
													    'conditional_pixel_values': prompt_features.pixel_values,
													}
													return encoding
										else:
													return BatchEncoding(data=dict(**lowerCAmelCase__       )			,						tensor_type=lowerCAmelCase__       )






							def 					UpperCamelCase__     (      self			,						*lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




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






							def 					UpperCamelCase__     (      self			,						*lowerCAmelCase__			,						**lowerCAmelCase__       ):





										"""simple docstring"""




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






							@property
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										warnings.warn(
										    '`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.'			,						lowerCAmelCase__			,						)
										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.'			,						lowerCAmelCase__			,						)
										return self.image_processor







"""simple docstring"""
import warnings

from ..trainer import Trainer
from ..utils import logging


SCREAMING_SNAKE_CASE_					     =	logging.get_logger(__name__)
class       lowerCAmelCase_		(				A__ ):



							'''simple docstring'''





							def __init__( self    ,				snake_case_=None    ,				**snake_case_				)       ->  Optional[Any]:
													warnings.warn(
													    """`SageMakerTrainer` is deprecated and will be removed in v5 of Transformers. You can use `Trainer` """
													    """instead."""    ,				snake_case_    ,				)
													super().__init__(args=snake_case_    ,				**snake_case_				)
