





import re
import tempfile
import unittest
from pathlib import Path

from datasets.utils.metadata import DatasetMetadata






def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							str      ):
		SCREAMING_SNAKE_CASE__								= min(re.search("""^ +"""   ,				_A      ).end() if t.startswith(""" """      ) else 0 for t in string.splitlines()      )
		return "\n".join([line[indent_level:] for line in string.splitlines() if indent_level < len(_A      )]      )


_lowerCamelCase				 =     '\\n---\nlanguage:\n- zh\n- en\ntask_ids:\n- sentiment-classification\n---\n# Begin of markdown\n\nSome cool dataset card\n'

_lowerCamelCase				 =     '\\n---\n---\n# Begin of markdown\n\nSome cool dataset card\n'


_lowerCamelCase				 =     '\\n# Begin of markdown\n\nSome cool dataset card\n'




class 					UpperCamelCase_    (       unittest.TestCase      ):


							def        _snake_case					(							self      :List[str]						)				->				Optional[Any]:



									"""simple docstring"""



									with tempfile.TemporaryDirectory() as tmp_dir:
											SCREAMING_SNAKE_CASE__								= Path(lowercase_						) / """README.md"""
											with open(lowercase_							,			"""w+"""						) as readme_file:
													readme_file.write(lowercase_						)
											SCREAMING_SNAKE_CASE__								= DatasetMetadata.from_readme(lowercase_						)
											self.assertDictEqual(lowercase_							,			{"""language""": ["""zh""", """en"""], """task_ids""": ["""sentiment-classification"""]}						)

											with open(lowercase_							,			"""w+"""						) as readme_file:
													readme_file.write(lowercase_						)
											SCREAMING_SNAKE_CASE__								= DatasetMetadata.from_readme(lowercase_						)
											self.assertDictEqual(lowercase_							,			{}						)

											with open(lowercase_							,			"""w+"""						) as readme_file:
													readme_file.write(lowercase_						)
											SCREAMING_SNAKE_CASE__								= DatasetMetadata.from_readme(lowercase_						)
											self.assertEqual(lowercase_							,			{}						)


							def        _snake_case					(							self      :List[str]						)				->				Optional[Any]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								= _dedent(
									    """\
            annotations_creators:
            - found
            language_creators:
            - found
            language:
            - en
            license:
            - unknown
            multilinguality:
            - monolingual
            pretty_name: Test Dataset
            size_categories:
            - 10K<n<100K
            source_datasets:
            - extended|other-yahoo-webscope-l6
            task_categories:
            - question-answering
            task_ids:
            - open-domain-qa
            """						)
									assert DatasetMetadata.from_yaml_string(lowercase_						)

									SCREAMING_SNAKE_CASE__								= _dedent(
									    """\
            annotations_creators:
            - found
            language:
            - en
            license:
            - unknown
            multilinguality:
            - monolingual
            pretty_name: Test Dataset
            size_categories:
            - 10K<n<100K
            source_datasets:
            - extended|other-yahoo-webscope-l6
            task_categories:
            - question-answering
            task_ids:
            - open-domain-qa
            task_ids:
            - open-domain-qa
            """						)
									with self.assertRaises(lowercase_						):
											DatasetMetadata.from_yaml_string(lowercase_						)

									SCREAMING_SNAKE_CASE__								= _dedent(
									    """\
            annotations_creators:
            - found
            language_creators:
            - found
            language:
            - en
            license:
            - unknown
            multilinguality:
            - monolingual
            pretty_name: Test Dataset
            size_categories:
            - 10K<n<100K
            source_datasets:
            - extended|other-yahoo-webscope-l6
            task_categories:
            - text-classification
            task_ids:
            - multi-class-classification
            paperswithcode_id:
            - squad
            configs:
            - en
            train-eval-index:
            - config: en
              task: text-classification
              task_id: multi_class_classification
              splits:
                train_split: train
                eval_split: test
              col_mapping:
                text: text
                label: target
              metrics:
                - type: accuracy
                  name: Accuracy
            extra_gated_prompt: |
              By clicking on “Access repository” below, you also agree to ImageNet Terms of Access:
              [RESEARCHER_FULLNAME] (the \"Researcher\") has requested permission to use the ImageNet database (the \"Database\") at Princeton University and Stanford University. In exchange for such permission, Researcher hereby agrees to the following terms and conditions:
              1. Researcher shall use the Database only for non-commercial research and educational purposes.
            extra_gated_fields:
              Company: text
              Country: text
              I agree to use this model for non-commerical use ONLY: checkbox
            """						)
									assert DatasetMetadata.from_yaml_string(lowercase_						)






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


_lowerCamelCase							=     logging.get_logger(__name__)

_lowerCamelCase							=     {
    'MCG-NJU/videomae-base': 'https://huggingface.co/MCG-NJU/videomae-base/resolve/main/config.json',
}




class 					UpperCamelCase_    (       UpperCamelCase__      ):
							lowerCamelCase_          =   "videomae"


							def __init__(							self      :Dict							,			__A      :List[str]=224							,			__A      :List[Any]=16							,			__A      :int=3							,			__A      :Optional[Any]=16							,			__A      :Optional[int]=2							,			__A      :Optional[Any]=768							,			__A      :List[str]=12							,			__A      :Optional[Any]=12							,			__A      :List[str]=3072							,			__A      :Tuple="gelu"							,			__A      :Optional[int]=0.0							,			__A      :Union[str, Any]=0.0							,			__A      :int=0.0_2							,			__A      :Union[str, Any]=1E-12							,			__A      :Optional[Any]=True							,			__A      :Union[str, Any]=True							,			__A      :Optional[int]=6							,			__A      :Tuple=384							,			__A      :str=4							,			__A      :List[str]=1536							,			__A      :Dict=True							,			**__A      :int							,			)				->				Optional[int]:



									"""simple docstring"""



									super().__init__(**__A						)

									SCREAMING_SNAKE_CASE__								= image_size
									SCREAMING_SNAKE_CASE__								= patch_size
									SCREAMING_SNAKE_CASE__								= num_channels
									SCREAMING_SNAKE_CASE__								= num_frames
									SCREAMING_SNAKE_CASE__								= tubelet_size

									SCREAMING_SNAKE_CASE__								= hidden_size
									SCREAMING_SNAKE_CASE__								= num_hidden_layers
									SCREAMING_SNAKE_CASE__								= num_attention_heads
									SCREAMING_SNAKE_CASE__								= intermediate_size
									SCREAMING_SNAKE_CASE__								= hidden_act
									SCREAMING_SNAKE_CASE__								= hidden_dropout_prob
									SCREAMING_SNAKE_CASE__								= attention_probs_dropout_prob
									SCREAMING_SNAKE_CASE__								= initializer_range
									SCREAMING_SNAKE_CASE__								= layer_norm_eps
									SCREAMING_SNAKE_CASE__								= qkv_bias
									SCREAMING_SNAKE_CASE__								= use_mean_pooling

									SCREAMING_SNAKE_CASE__								= decoder_num_attention_heads
									SCREAMING_SNAKE_CASE__								= decoder_hidden_size
									SCREAMING_SNAKE_CASE__								= decoder_num_hidden_layers
									SCREAMING_SNAKE_CASE__								= decoder_intermediate_size
									SCREAMING_SNAKE_CASE__								= norm_pix_loss