


import json
import os
import tempfile
import unittest

from transformers.modelcard import ModelCard

class      __snake_case				(   unittest.TestCase):
					def 	a			(						self       :						Optional[Any]  )							->					int:



											'''simple docstring'''





											__magic_name__					=      {
											    'model_details': {
											        'Organization': 'testing',
											        'Model date': 'today',
											        'Model version': 'v2.1, Developed by Test Corp in 2019.',
											        'Architecture': 'Convolutional Neural Network.',
											    },
											    'metrics': 'BLEU and ROUGE-1',
											    'evaluation_data': {
											        'Datasets': {'BLEU': 'My-great-dataset-v1', 'ROUGE-1': 'My-short-dataset-v2.1'},
											        'Preprocessing': 'See details on https://arxiv.org/pdf/1810.03993.pdf',
											    },
											    'training_data': {
											        'Dataset': 'English Wikipedia dump dated 2018-12-01',
											        'Preprocessing': (
											            'Using SentencePiece vocabulary of size 52k tokens. See details on'
											            ' https://arxiv.org/pdf/1810.03993.pdf'
											        ),
											    },
											    'quantitative_analyses': {'BLEU': 5_5.1, 'ROUGE-1': 7_6},
											}
					def 	a			(						self       :						List[str]  )							->					List[str]:



											'''simple docstring'''





											__magic_name__					=      ModelCard.from_dict(self.inputs_dict  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'model_details'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'intended_use'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'factors'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'metrics'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'evaluation_data'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'training_data'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'quantitative_analyses'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'ethical_considerations'  )  )
											self.assertTrue(hasattr(__lowerCAmelCase	,      'caveats_and_recommendations'  )  )
					def 	a			(						self       :						List[Any]  )							->					List[str]:



											'''simple docstring'''





											__magic_name__					=      ModelCard.from_dict(self.inputs_dict  )
											__magic_name__					=      json.loads(modelcard.to_json_string()  )
											for key, value in self.inputs_dict.items():
																	self.assertEqual(obj[key]	,      __lowerCAmelCase  )
					def 	a			(						self       :						Any  )							->					Optional[Any]:



											'''simple docstring'''





											__magic_name__					=      ModelCard.from_dict(self.inputs_dict  )

											with tempfile.TemporaryDirectory() as tmpdirname:
																	__magic_name__					=      os.path.join(__lowerCAmelCase	,      'modelcard.json'  )
																	model_card_first.to_json_file(__lowerCAmelCase  )
																	__magic_name__					=      ModelCard.from_json_file(__lowerCAmelCase  )

											self.assertEqual(model_card_second.to_dict()	,      model_card_first.to_dict()  )







					def 	a			(						self       :						Union[str, Any]  )							->					Union[str, Any]:



											'''simple docstring'''





											__magic_name__					=      ModelCard.from_dict(self.inputs_dict  )

											with tempfile.TemporaryDirectory() as tmpdirname:
																	model_card_first.save_pretrained(__lowerCAmelCase  )
																	__magic_name__					=      ModelCard.from_pretrained(__lowerCAmelCase  )

											self.assertEqual(model_card_second.to_dict()	,      model_card_first.to_dict()  )








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						( _lowercase       ):
					__A        = "videomae"




					def __init__(    self     ,   __lowerCAmelCase=224     ,   __lowerCAmelCase=16     ,   __lowerCAmelCase=3     ,   __lowerCAmelCase=16     ,   __lowerCAmelCase=2     ,   __lowerCAmelCase=768     ,   __lowerCAmelCase=12     ,   __lowerCAmelCase=12     ,   __lowerCAmelCase=3_072     ,   __lowerCAmelCase="gelu"     ,   __lowerCAmelCase=0.0     ,   __lowerCAmelCase=0.0     ,   __lowerCAmelCase=0.0_2     ,   __lowerCAmelCase=1E-1_2     ,   __lowerCAmelCase=True     ,   __lowerCAmelCase=True     ,   __lowerCAmelCase=6     ,   __lowerCAmelCase=384     ,   __lowerCAmelCase=4     ,   __lowerCAmelCase=1_536     ,   __lowerCAmelCase=True     ,   **__lowerCAmelCase     ,   )    ->	Any:
							super().__init__(**__lowerCAmelCase							)

							UpperCamelCase__								=						image_size
							UpperCamelCase__								=						patch_size
							UpperCamelCase__								=						num_channels
							UpperCamelCase__								=						num_frames
							UpperCamelCase__								=						tubelet_size

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

							UpperCamelCase__								=						decoder_num_attention_heads
							UpperCamelCase__								=						decoder_hidden_size
							UpperCamelCase__								=						decoder_num_hidden_layers
							UpperCamelCase__								=						decoder_intermediate_size
							UpperCamelCase__								=						norm_pix_loss





