



"""simple docstring"""
import json
import os
import tempfile
import unittest

from transformers.modelcard import ModelCard


class 							lowerCamelCase_(      unittest.TestCase			):





					'''simple docstring'''



					def 	snake_case__					(			self      ):
									_lowerCamelCase					     = {
									    '''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 	snake_case__					(			self      ):
									_lowerCamelCase					     = 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 	snake_case__					(			self      ):
									_lowerCamelCase					     = ModelCard.from_dict(self.inputs_dict      )
									_lowerCamelCase					     = json.loads(modelcard.to_json_string()      )
									for key, value in self.inputs_dict.items():
													self.assertEqual(obj[key] ,				lowerCamelCase__      )

					def 	snake_case__					(			self      ):
									_lowerCamelCase					     = ModelCard.from_dict(self.inputs_dict      )

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

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





					def 	snake_case__					(			self      ):
									_lowerCamelCase					     = ModelCard.from_dict(self.inputs_dict      )

									with tempfile.TemporaryDirectory() as tmpdirname:
													model_card_first.save_pretrained(lowerCamelCase__      )
													_lowerCamelCase					     = ModelCard.from_pretrained(lowerCamelCase__      )

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





"""simple docstring"""
from ..utils import DummyObject, requires_backends


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Tuple        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Tuple        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Tuple        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Any        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Tuple        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				int        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Dict        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Optional[int]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				str        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				List[str]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )


class 							lowerCamelCase_(      metaclass=A__			):





					'''simple docstring'''



					lowercase__      :				Union[str, Any]        =       ['vision']

					def __init__(			self ,				*lowerCamelCase__ ,				**lowerCamelCase__      ):
									requires_backends(self ,				['''vision''']      )
