



'''simple docstring'''






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

class        SCREAMING_SNAKE_CASE(							__lowerCAmelCase    ):







	"""simple docstring"""






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







	def __init__(		self    :  Optional[Any]	,    __snake_case    :  str	,    __snake_case    :  Optional[Any]	)    ->	Tuple:
								super().__init__(_UpperCamelCase	,    _UpperCamelCase	)
								UpperCAmelCase				: str											=	self.image_processor







	def __call__(		self    :  Union[str, Any]	,    __snake_case    :  List[str]=None	,    __snake_case    :  str=None	,    __snake_case    :  Optional[Any]=None	,    **__snake_case    :  Union[str, Any]	)    ->	Any:


								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				: Union[str, Any]											=	self.tokenizer(_UpperCamelCase	,    return_tensors=_UpperCamelCase	,    **_UpperCamelCase	)

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

								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(**_UpperCamelCase	)	,    tensor_type=_UpperCamelCase	)







	def   A			(		self    :  Union[str, Any]	,    *__snake_case    :  int	,    **__snake_case    :  Any	)    ->	Optional[Any]:
								return self.tokenizer.batch_decode(*_UpperCamelCase	,    **_UpperCamelCase	)







	def   A			(		self    :  int	,    *__snake_case    :  List[Any]	,    **__snake_case    :  Union[str, Any]	)    ->	Union[str, Any]:
								return self.tokenizer.decode(*_UpperCamelCase	,    **_UpperCamelCase	)







	@property
	def   A			(		self    :  Optional[Any]	)    ->	Dict:
								return ["input_ids", "attention_mask", "pixel_values"]










'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCamelCase__:     Union[str, Any]										=    {
    "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__:     List[str]										=    [
						    "LILT_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "LiltForQuestionAnswering",
						    "LiltForSequenceClassification",
						    "LiltForTokenClassification",
						    "LiltModel",
						    "LiltPreTrainedModel",
						]

if TYPE_CHECKING:
						from .configuration_lilt import LILT_PRETRAINED_CONFIG_ARCHIVE_MAP, LiltConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_lilt import (
												    LILT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    LiltForQuestionAnswering,
												    LiltForSequenceClassification,
												    LiltForTokenClassification,
												    LiltModel,
												    LiltPreTrainedModel,
												)

else:
						import sys

						UpperCamelCase__:     Optional[Any]										=    _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





