






import unittest

from transformers.testing_utils import require_bsa
from transformers.utils import is_bsa_available

from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin


if is_bsa_available():
		from transformers import MarkupLMFeatureExtractor



class   lowerCamelCase      (unittest.TestCase			):







		'''simple docstring'''



		def __init__(							self				,		_UpperCamelCase   )	->							Optional[Any]:
							UpperCAmelCase_    :      Optional[Any]            =						parent



		def 					__UpperCAmelCase			(							self   )	->							str:
							return {}





def      lowercase__      (     ):


					'''simple docstring'''


					UpperCAmelCase_    :      Any            =						'''<HTML>

    <HEAD>
    <TITLE>sample document</TITLE>
    </HEAD>

    <BODY BGCOLOR="FFFFFF">
    <HR>
    <a href="http://google.com">Goog</a>
    <H1>This is one header</H1>
    <H2>This is a another Header</H2>
    <P>Travel from
        <P>
        <B>SFO to JFK</B>
        <BR>
        <B><I>on May 2, 2015 at 2:00 pm. For details go to confirm.com </I></B>
        <HR>
        <div style="color:#0000FF">
            <h3>Traveler <b> name </b> is
            <p> John Doe </p>
        </div>'''

					UpperCAmelCase_    :      Optional[int]            =						'''
    <!DOCTYPE html>
    <html>
    <body>

    <h1>My First Heading</h1>
    <p>My first paragraph.</p>

    </body>
    </html>
    '''

					return [html_string_a, html_string_a]






@require_bsa
class   lowerCamelCase      (UpperCAmelCase__ ,  unittest.TestCase			):







		'''simple docstring'''



		_snake_case    :    Dict       						=  MarkupLMFeatureExtractor if is_bsa_available() else None



		def 					__UpperCAmelCase			(							self   )	->							int:
							UpperCAmelCase_    :      List[str]            =						MarkupLMFeatureExtractionTester(self   )



		@property
		def 					__UpperCAmelCase			(							self   )	->							Tuple:
							return self.feature_extract_tester.prepare_feat_extract_dict()



		def 					__UpperCAmelCase			(							self   )	->							List[str]:
							# Initialize feature_extractor
							UpperCAmelCase_    :      Tuple            =						self.feature_extraction_class()

							# Test not batched input
							UpperCAmelCase_    :      Optional[int]            =						get_html_strings()[0]
							UpperCAmelCase_    :      List[Any]            =						feature_extractor(__lowercase   )

							# fmt: off
							UpperCAmelCase_    :      List[str]            =						[['''sample document''', '''Goog''', '''This is one header''', '''This is a another Header''', '''Travel from''', '''SFO to JFK''', '''on May 2, 2015 at 2:00 pm. For details go to confirm.com''', '''Traveler''', '''name''', '''is''', '''John Doe''']]
							UpperCAmelCase_    :      str            =						[['''/html/head/title''', '''/html/body/a''', '''/html/body/h1''', '''/html/body/h2''', '''/html/body/p''', '''/html/body/p/p/b[1]''', '''/html/body/p/p/b[2]/i''', '''/html/body/p/p/div/h3''', '''/html/body/p/p/div/h3/b''', '''/html/body/p/p/div/h3''', '''/html/body/p/p/div/h3/p''']]
							# fmt: on

							self.assertEqual(encoding.nodes				,		__lowercase   )
							self.assertEqual(encoding.xpaths				,		__lowercase   )

							# Test batched
							UpperCAmelCase_    :      str            =						get_html_strings()
							UpperCAmelCase_    :      int            =						feature_extractor(__lowercase   )

							# fmt: off
							UpperCAmelCase_    :      Optional[Any]            =						expected_nodes + [['''My First Heading''', '''My first paragraph.''']]
							UpperCAmelCase_    :      List[str]            =						expected_xpaths + [['''/html/body/h1''', '''/html/body/p''']]

							self.assertEqual(len(encoding.nodes   )				,		2   )
							self.assertEqual(len(encoding.xpaths   )				,		2   )

							self.assertEqual(encoding.nodes				,		__lowercase   )
							self.assertEqual(encoding.xpaths				,		__lowercase   )










from ...configuration_utils import PretrainedConfig
from ...utils import logging


_UpperCAmelCase	:     Optional[Any]   =logging.get_logger(__name__)

_UpperCAmelCase	:     str   ={
    """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""",
    # See all ViT MAE models at https://huggingface.co/models?filter=vit-mae
}







class  snake_case__(							UpperCAmelCase__							):







						'''simple docstring'''




						SCREAMING_SNAKE_CASE__					:     Optional[Any]    =							"""vit_mae"""




						def __init__( self      ,  __lowercase=7_6_8      ,  __lowercase=1_2      ,  __lowercase=1_2      ,  __lowercase=3_0_7_2      ,  __lowercase="gelu"      ,  __lowercase=0.0      ,  __lowercase=0.0      ,  __lowercase=0.02      ,  __lowercase=1e-12      ,  __lowercase=2_2_4      ,  __lowercase=1_6      ,  __lowercase=3      ,  __lowercase=True      ,  __lowercase=1_6      ,  __lowercase=5_1_2      ,  __lowercase=8      ,  __lowercase=2_0_4_8      ,  __lowercase=0.75      ,  __lowercase=False      ,  **__lowercase      ,  )    ->			str:
										super().__init__(**__lowercase							)

										lowerCAmelCase_       :					Dict			 = hidden_size
										lowerCAmelCase_       :					Any			 = num_hidden_layers
										lowerCAmelCase_       :					Any			 = num_attention_heads
										lowerCAmelCase_       :					int			 = intermediate_size
										lowerCAmelCase_       :					Dict			 = hidden_act
										lowerCAmelCase_       :					int			 = hidden_dropout_prob
										lowerCAmelCase_       :					str			 = attention_probs_dropout_prob
										lowerCAmelCase_       :					List[str]			 = initializer_range
										lowerCAmelCase_       :					Dict			 = layer_norm_eps
										lowerCAmelCase_       :					Union[str, Any]			 = image_size
										lowerCAmelCase_       :					Optional[int]			 = patch_size
										lowerCAmelCase_       :					Tuple			 = num_channels
										lowerCAmelCase_       :					List[str]			 = qkv_bias
										lowerCAmelCase_       :					List[Any]			 = decoder_num_attention_heads
										lowerCAmelCase_       :					int			 = decoder_hidden_size
										lowerCAmelCase_       :					Optional[int]			 = decoder_num_hidden_layers
										lowerCAmelCase_       :					Tuple			 = decoder_intermediate_size
										lowerCAmelCase_       :					Tuple			 = mask_ratio
										lowerCAmelCase_       :					Any			 = norm_pix_loss