




"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


SCREAMING_SNAKE_CASE       = {"configuration_vit_hybrid": ["VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP", "ViTHybridConfig"]}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						SCREAMING_SNAKE_CASE       = [
						    "VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "ViTHybridForImageClassification",
						    "ViTHybridModel",
						    "ViTHybridPreTrainedModel",
						]

try:
						if not is_vision_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						SCREAMING_SNAKE_CASE       = ["ViTHybridImageProcessor"]


if TYPE_CHECKING:
						from .configuration_vit_hybrid import VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTHybridConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_vit_hybrid import (
												    VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST,
												    ViTHybridForImageClassification,
												    ViTHybridModel,
												    ViTHybridPreTrainedModel,
												)

						try:
												if not is_vision_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .image_processing_vit_hybrid import ViTHybridImageProcessor


else:
						import sys

						SCREAMING_SNAKE_CASE       = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)











"""simple docstring"""



from typing import Optional, Union

from ...file_utils import TensorType
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, TruncationStrategy




class 			UpperCAmelCase_						(		A_							):
    lowercase__		      =   '''MarkupLMFeatureExtractor'''
    lowercase__		      =   ('''MarkupLMTokenizer''', '''MarkupLMTokenizerFast''')
    lowercase__		      =   True




    def __call__(					self		: Dict			,				snake_case_		: Optional[int]=None			,				snake_case_		: Union[str, Any]=None			,				snake_case_		: Tuple=None			,				snake_case_		: str=None			,				snake_case_		: Optional[Any]=None			,				snake_case_		: bool = True			,				snake_case_		: Union[bool, str, PaddingStrategy] = False			,				snake_case_		: Union[bool, str, TruncationStrategy] = None			,				snake_case_		: Optional[int] = None			,				snake_case_		: int = 0			,				snake_case_		: Optional[int] = None			,				snake_case_		: Optional[bool] = None			,				snake_case_		: Optional[bool] = None			,				snake_case_		: bool = False			,				snake_case_		: bool = False			,				snake_case_		: bool = False			,				snake_case_		: bool = False			,				snake_case_		: bool = True			,				snake_case_		: Optional[Union[str, TensorType]] = None			,				**snake_case_		: Dict			,				)   ->							BatchEncoding:




     '''simple docstring'''

     if self.parse_html:
      if html_strings is None:
       raise ValueError("Make sure to pass HTML strings in case `parse_html` is set to `True`"   )

      if nodes is not None or xpaths is not None or node_labels is not None:
       raise ValueError(
           "Please don't pass nodes, xpaths nor node labels in case `parse_html` is set to `True`"   )

      A__ =       self.feature_extractor(snake_case_   )
      A__ =       features["nodes"]
      A__ =       features["xpaths"]
     else:
      if html_strings is not None:
       raise ValueError("You have passed HTML strings but `parse_html` is set to `False`."   )
      if nodes is None or xpaths is None:
       raise ValueError("Make sure to pass nodes and xpaths in case `parse_html` is set to `False`"   )

        # # second, apply the tokenizer
     if questions is not None and self.parse_html:
      if isinstance(snake_case_			,				snake_case_   ):
       A__ =       [questions]  # add batch dimension (as the feature extractor always adds a batch dimension)

     A__ =       self.tokenizer(
         text=questions if questions is not None else nodes			,				text_pair=nodes if questions is not None else None			,				xpaths=snake_case_			,				node_labels=snake_case_			,				add_special_tokens=snake_case_			,				padding=snake_case_			,				truncation=snake_case_			,				max_length=snake_case_			,				stride=snake_case_			,				pad_to_multiple_of=snake_case_			,				return_token_type_ids=snake_case_			,				return_attention_mask=snake_case_			,				return_overflowing_tokens=snake_case_			,				return_special_tokens_mask=snake_case_			,				return_offsets_mapping=snake_case_			,				return_length=snake_case_			,				verbose=snake_case_			,				return_tensors=snake_case_			,				**snake_case_			,				)

     return encoded_inputs




    def 							__magic_name__							(					self		: Optional[Any]			,				*snake_case_		: Any			,				**snake_case_		: Any   )   ->							int:




     '''simple docstring'''

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




    def 							__magic_name__							(					self		: Tuple			,				*snake_case_		: Optional[Any]			,				**snake_case_		: List[Any]   )   ->							Any:




     '''simple docstring'''

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




    @property
    def 							__magic_name__							(					self		: List[Any]   )   ->							Optional[int]:




     '''simple docstring'''

     A__ =       self.tokenizer.model_input_names
     return tokenizer_input_names





