


"""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					(				__snake_case							):






		'''simple docstring'''

		lowerCamelCase__           ='MarkupLMFeatureExtractor'
		lowerCamelCase__           =('MarkupLMTokenizer', 'MarkupLMTokenizerFast')
		lowerCamelCase__           =True



		def __call__(self							,			a_=None							,			a_=None							,			a_=None							,			a_=None							,			a_=None							,			a_ = True							,			a_ = False							,			a_ = None							,			a_ = None							,			a_ = 0							,			a_ = None							,			a_ = None							,			a_ = None							,			a_ = False							,			a_ = False							,			a_ = False							,			a_ = False							,			a_ = True							,			a_ = None							,			**a_							,			):





			'''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`'''   )

				__snake_case      :		List[str]         =							self.feature_extractor(a_   )
				__snake_case      :		Tuple         =							features['''nodes''']
				__snake_case      :		Tuple         =							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(a_							,			a_   ):
					__snake_case      :		Dict         =							[questions]  # add batch dimension (as the feature extractor always adds a batch dimension)

			__snake_case      :		Union[str, Any]         =							self.tokenizer(
			    text=questions if questions is not None else nodes							,			text_pair=nodes if questions is not None else None							,			xpaths=a_							,			node_labels=a_							,			add_special_tokens=a_							,			padding=a_							,			truncation=a_							,			max_length=a_							,			stride=a_							,			pad_to_multiple_of=a_							,			return_token_type_ids=a_							,			return_attention_mask=a_							,			return_overflowing_tokens=a_							,			return_special_tokens_mask=a_							,			return_offsets_mapping=a_							,			return_length=a_							,			verbose=a_							,			return_tensors=a_							,			**a_							,			)

			return encoded_inputs



		def 							SCREAMING_SNAKE_CASE    (self							,			*a_							,			**a_   ):





			'''simple docstring'''

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



		def 							SCREAMING_SNAKE_CASE    (self							,			*a_							,			**a_   ):





			'''simple docstring'''

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



		@property
		def 							SCREAMING_SNAKE_CASE    (self   ):





			'''simple docstring'''

			__snake_case      :		Tuple         =							self.tokenizer.model_input_names
			return tokenizer_input_names









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__UpperCAmelCase      			=  {
    """configuration_switch_transformers""": [
        """SWITCH_TRANSFORMERS_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """SwitchTransformersConfig""",
        """SwitchTransformersOnnxConfig""",
    ]
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __UpperCAmelCase      			=  [
         """SWITCH_TRANSFORMERS_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """SwitchTransformersEncoderModel""",
         """SwitchTransformersForConditionalGeneration""",
         """SwitchTransformersModel""",
         """SwitchTransformersPreTrainedModel""",
         """SwitchTransformersTop1Router""",
         """SwitchTransformersSparseMLP""",
     ]


if TYPE_CHECKING:
     from .configuration_switch_transformers import (
         SWITCH_TRANSFORMERS_PRETRAINED_CONFIG_ARCHIVE_MAP,
         SwitchTransformersConfig,
         SwitchTransformersOnnxConfig,
     )

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_switch_transformers import (
              SWITCH_TRANSFORMERS_PRETRAINED_MODEL_ARCHIVE_LIST,
              SwitchTransformersEncoderModel,
              SwitchTransformersForConditionalGeneration,
              SwitchTransformersModel,
              SwitchTransformersPreTrainedModel,
              SwitchTransformersSparseMLP,
              SwitchTransformersTopaRouter,
          )


else:
     import sys

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

