
"""simple docstring"""




import importlib
import os
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Union

import torch

from ..utils import BaseOutput


lowerCamelCase_  :	Any 				=					"""scheduler_config.json"""

class     _UpperCamelCase			(   _A					):






			'''simple docstring'''

			__UpperCamelCase :  Optional[Any]    =	1
			__UpperCamelCase :  Union[str, Any]    =	2
			__UpperCamelCase :  List[str]    =	3
			__UpperCamelCase :  int    =	4
			__UpperCamelCase :  str    =	5
			__UpperCamelCase :  Dict    =	6
			__UpperCamelCase :  str    =	7
			__UpperCamelCase :  Optional[int]    =	8
			__UpperCamelCase :  str    =	9
			__UpperCamelCase :  List[Any]    =	10
			__UpperCamelCase :  Optional[int]    =	11
			__UpperCamelCase :  Optional[int]    =	12
			__UpperCamelCase :  Any    =	13
			__UpperCamelCase :  Dict    =	14




@dataclass
class     _UpperCamelCase			(   _A					):






			'''simple docstring'''

			__UpperCamelCase :  torch.FloatTensor




class     _UpperCamelCase			:






			'''simple docstring'''

			__UpperCamelCase :  List[str]    =	SCHEDULER_CONFIG_NAME
			__UpperCamelCase :  Tuple    =	[]
			__UpperCamelCase :  Tuple    =	True

			@classmethod
			def  lowerCAmelCase__		(    cls	:    int  ,		snake_case_	:    Dict[str, Any] = None  ,		snake_case_	:    Optional[str] = None  ,		snake_case_	:    Optional[int]=False  ,		**snake_case_	:    str  ,		):
							UpperCamelCase_:							Dict		=  cls.load_config(
							    pretrained_model_name_or_path=snake_case_  ,		subfolder=snake_case_  ,		return_unused_kwargs=snake_case_  ,		return_commit_hash=snake_case_  ,		**snake_case_  ,		)
							return cls.from_config(snake_case_  ,		return_unused_kwargs=snake_case_  ,		**snake_case_ )

			def  lowerCAmelCase__		(    self	:    Optional[int]  ,		snake_case_	:    Union[str, os.PathLike]  ,		snake_case_	:    bool = False  ,		**snake_case_	:    str ):
							self.save_config(save_directory=snake_case_  ,		push_to_hub=snake_case_  ,		**snake_case_ )

			@property
			def  lowerCAmelCase__		(    self	:    Any ):
							return self._get_compatibles()




			@classmethod
			def  lowerCAmelCase__		(    cls	:    List[Any] ):
							UpperCamelCase_:							List[Any]		=  list(set([cls.__name__] + cls._compatibles ) )
							UpperCamelCase_:							Union[str, Any]		=  importlib.import_module(__name__.split(""".""" )[0] )
							UpperCamelCase_:							Union[str, Any]		=  [
							    getattr(snake_case_  ,		snake_case_ ) for c in compatible_classes_str if hasattr(snake_case_  ,		snake_case_ )
							]
							return compatible_classes








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

class     _UpperCamelCase			(   _A					):






			'''simple docstring'''

			__UpperCamelCase :  Union[str, Any]    =	["""image_processor""", """tokenizer"""]
			__UpperCamelCase :  List[Any]    =	"""AutoImageProcessor"""
			__UpperCamelCase :  Tuple    =	"""AutoTokenizer"""

			def __init__(    self	:    Any  ,		snake_case_	:    Optional[Any]  ,		snake_case_	:    Any ):
							super().__init__(snake_case_  ,		snake_case_ )
							UpperCamelCase_:							int		=  self.image_processor

			def __call__(    self	:    str  ,		snake_case_	:    Optional[int]=None  ,		snake_case_	:    int=None  ,		snake_case_	:    Dict=None  ,		**snake_case_	:    Optional[int] ):

							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_:							List[Any]		=  self.tokenizer(snake_case_  ,		return_tensors=snake_case_  ,		**snake_case_ )

							if images is not None:
											UpperCamelCase_:							Any		=  self.image_processor(snake_case_  ,		return_tensors=snake_case_  ,		**snake_case_ )

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

			def  lowerCAmelCase__		(    self	:    List[str]  ,		*snake_case_	:    int  ,		**snake_case_	:    Optional[Any] ):
							return self.tokenizer.batch_decode(*snake_case_  ,		**snake_case_ )

			def  lowerCAmelCase__		(    self	:    int  ,		*snake_case_	:    Optional[Any]  ,		**snake_case_	:    str ):
							return self.tokenizer.decode(*snake_case_  ,		**snake_case_ )




			@property
			def  lowerCAmelCase__		(    self	:    Union[str, Any] ):
							return ["input_ids", "attention_mask", "pixel_values"]






