code: 
  
  
  """simple docstring"""
  
  
  
  
  
  
  
  from copy import deepcopy
  from unittest.case import TestCase
  
  import pytest
  
  from datasets.arrow_dataset import Dataset
  from datasets.features import Audio, ClassLabel, Features, Image, Sequence, Value
  from datasets.info import DatasetInfo
  from datasets.tasks import (
      AudioClassification,
      AutomaticSpeechRecognition,
      ImageClassification,
      LanguageModeling,
      QuestionAnsweringExtractive,
      Summarization,
      TextClassification,
      task_template_from_dict,
  )
  from datasets.utils.py_utils import asdict
  
  
  lowerCamelCase_     :     Union[str, Any]    		=						{
      """id""": """5733be284776f41900661182""",
      """title""": """University_of_Notre_Dame""",
      """context""": """Architecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend \"Venite Ad Me Omnes\". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.""",
      """question""": """To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?""",
      """answers""": {"""text""": ["""Saint Bernadette Soubirous"""], """answer_start""": [5_1_5]},
  }
  @pytest.mark.parametrize(
      '''task_cls''' ,					[
          AudioClassification,
          AutomaticSpeechRecognition,
          ImageClassification,
          LanguageModeling,
          QuestionAnsweringExtractive,
          Summarization,
          TextClassification,
      ] ,					)
  def _A		(		lowercase	):
  
  
  
  
  
  
  
      """simple docstring"""
      a					=task_cls()
      a					=asdict(lowercase_	)
      a					=task_template_from_dict(lowercase_	)
      assert task == reloaded
  
  
  
  
  
  
  class    __A       :
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Union[str, Any]:
       a					=LanguageModeling(text_column='''input_text'''		)
       assert {"input_text": "text"} == task.column_mapping
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Optional[Any]:
       a					=Features({'''text''': Value('''string'''		)}		)
       a					={'text_column': 'input_text'}
       a					=LanguageModeling.from_dict(__A		)
       assert "language-modeling" == task.task
       assert input_schema == task.input_schema
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  List[str]:
       a					=sorted(['''pos''', '''neg''']		)
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  List[str]:
       a					=TextClassification(text_column='''input_text'''				,					label_column='''input_label'''		)
       self.assertDictEqual({'''input_text''': '''text''', '''input_label''': '''labels'''}				,					task.column_mapping		)
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Optional[Any]:
       a					=Features({'''text''': Value('''string'''		)}		)
       # Labels are cast to tuple during `TextClassification.__post_init__`, so we do the same here
       a					=Features({'''labels''': ClassLabel}		)
       a					={'text_column': 'input_text', 'label_column': 'input_labels'}
       a					=TextClassification.from_dict(__A		)
       self.assertEqual('''text-classification'''				,					task.task		)
       self.assertEqual(__A				,					task.input_schema		)
       self.assertEqual(__A				,					task.label_schema		)
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  List[Any]:
       a					=TextClassification(text_column='''input_text'''				,					label_column='''input_label'''		)
       self.assertEqual(task.label_schema['''labels''']				,					__A		)
       a					=task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels		)}		)		)
       self.assertEqual(task.label_schema['''labels''']				,					ClassLabel(names=self.labels		)		)
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Dict:
       a					=QuestionAnsweringExtractive(
           context_column='''input_context'''				,					question_column='''input_question'''				,					answers_column='''input_answers'''		)
       self.assertDictEqual(
           {'''input_context''': '''context''', '''input_question''': '''question''', '''input_answers''': '''answers'''}				,					task.column_mapping		)
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Dict:
       a					=Features({'''question''': Value('''string'''		), '''context''': Value('''string'''		)}		)
       a					=Features(
           {
               '''answers''': Sequence(
                   {
                       '''text''': Value('''string'''		),
                       '''answer_start''': Value('''int32'''		),
                   }		)
           }		)
       a					={
           'context_column': 'input_input_context',
           'question_column': 'input_question',
           'answers_column': 'input_answers',
       }
       a					=QuestionAnsweringExtractive.from_dict(__A		)
       self.assertEqual('''question-answering-extractive'''				,					task.task		)
       self.assertEqual(__A				,					task.input_schema		)
       self.assertEqual(__A				,					task.label_schema		)
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Union[str, Any]:
       a					=Summarization(text_column='''input_text'''				,					summary_column='''input_summary'''		)
       self.assertDictEqual({'''input_text''': '''text''', '''input_summary''': '''summary'''}				,					task.column_mapping		)
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  List[str]:
       a					=Features({'''text''': Value('''string'''		)}		)
       a					=Features({'''summary''': Value('''string'''		)}		)
       a					={'text_column': 'input_text', 'summary_column': 'input_summary'}
       a					=Summarization.from_dict(__A		)
       self.assertEqual('''summarization'''				,					task.task		)
       self.assertEqual(__A				,					task.input_schema		)
       self.assertEqual(__A				,					task.label_schema		)
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Optional[int]:
       a					=AutomaticSpeechRecognition(audio_column='''input_audio'''				,					transcription_column='''input_transcription'''		)
       self.assertDictEqual({'''input_audio''': '''audio''', '''input_transcription''': '''transcription'''}				,					task.column_mapping		)
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  List[str]:
       a					=Features({'''audio''': Audio()}		)
       a					=Features({'''transcription''': Value('''string'''		)}		)
       a					={
           'audio_column': 'input_audio',
           'transcription_column': 'input_transcription',
       }
       a					=AutomaticSpeechRecognition.from_dict(__A		)
       self.assertEqual('''automatic-speech-recognition'''				,					task.task		)
       self.assertEqual(__A				,					task.input_schema		)
       self.assertEqual(__A				,					task.label_schema		)
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Tuple:
       a					=sorted(['''pos''', '''neg''']		)
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Optional[int]:
       a					=AudioClassification(audio_column='''input_audio'''				,					label_column='''input_label'''		)
       self.assertDictEqual({'''input_audio''': '''audio''', '''input_label''': '''labels'''}				,					task.column_mapping		)
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Tuple:
       a					=Features({'''audio''': Audio()}		)
       a					=Features({'''labels''': ClassLabel}		)
       a					={
           'audio_column': 'input_image',
           'label_column': 'input_label',
       }
       a					=AudioClassification.from_dict(__A		)
       self.assertEqual('''audio-classification'''				,					task.task		)
       self.assertEqual(__A				,					task.input_schema		)
       self.assertEqual(__A				,					task.label_schema		)
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Optional[int]:
       a					=AudioClassification(audio_column='''input_audio'''				,					label_column='''input_label'''		)
       self.assertEqual(task.label_schema['''labels''']				,					__A		)
       a					=task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels		)}		)		)
       self.assertEqual(task.label_schema['''labels''']				,					ClassLabel(names=self.labels		)		)
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  str:
       a					=sorted(['''pos''', '''neg''']		)
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Dict:
       a					=ImageClassification(image_column='''input_image'''				,					label_column='''input_label'''		)
       self.assertDictEqual({'''input_image''': '''image''', '''input_label''': '''labels'''}				,					task.column_mapping		)
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Any:
       a					=Features({'''image''': Image()}		)
       a					=Features({'''labels''': ClassLabel}		)
       a					={
           'image_column': 'input_image',
           'label_column': 'input_label',
       }
       a					=ImageClassification.from_dict(__A		)
       self.assertEqual('''image-classification'''				,					task.task		)
       self.assertEqual(__A				,					task.input_schema		)
       self.assertEqual(__A				,					task.label_schema		)
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Dict:
       a					=ImageClassification(image_column='''input_image'''				,					label_column='''input_label'''		)
       self.assertEqual(task.label_schema['''labels''']				,					__A		)
       a					=task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels		)}		)		)
       self.assertEqual(task.label_schema['''labels''']				,					ClassLabel(names=self.labels		)		)
  
  
  
  
  
  
  class    __A       ( a_    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  Optional[int]:
       a					=DatasetInfo(task_templates=QuestionAnsweringExtractive()		)
       a					=Dataset.from_dict({k: [v] for k, v in SAMPLE_QUESTION_ANSWERING_EXTRACTIVE.items()}				,					info=__A		)
       assert isinstance(dataset.info.task_templates				,					__A		)
       assert len(dataset.info.task_templates		) == 1
  
       def keep_task(__A		):
           return x
  
       def dont_keep_task(__A		):
           a					=deepcopy(__A		)
           a					=0
           return out
  
       a					=dataset.map(__A		)
       assert mapped_dataset.info.task_templates == dataset.info.task_templates
       # reload from cache
       a					=dataset.map(__A		)
       assert mapped_dataset.info.task_templates == dataset.info.task_templates
  
       a					=dataset.map(__A		)
       assert mapped_dataset.info.task_templates == []
       # reload from cache
       a					=dataset.map(__A		)
       assert mapped_dataset.info.task_templates == []
  
  
  
  
  
   def    SCREAMING_SNAKE_CASE							(	self		)      ->  List[Any]:
       a					=Features({'''text''': Value('''string'''		), '''label''': ClassLabel(names=('''pos''', '''neg''')		)}		)
       a					=TextClassification(text_column='''text'''				,					label_column='''label'''		)
       a					=DatasetInfo(features=__A				,					task_templates=__A		)
       a					=Dataset.from_dict({'''text''': ['''A sentence.'''], '''label''': ['''pos''']}				,					info=__A		)
  
       def process(__A		):
           return example
  
       a					=dataset.remove_columns('''label'''		)
       a					=modified_dataset.map(__A		)
       assert mapped_dataset.info.task_templates == []
style_context: 
  
  
  """simple docstring"""
  
  
  
  
  
  
  
  from ...configuration_utils import PretrainedConfig
  from ...utils import logging
  
  
  lowerCamelCase_     :     int    		=						logging.get_logger(__name__)
  
  lowerCamelCase_     :     Optional[Any]    		=						{
      """dandelin/vilt-b32-mlm""": """https://huggingface.co/dandelin/vilt-b32-mlm/blob/main/config.json"""
  }
  
  
  
  
  
  
  class    __A       ( _SCREAMING_SNAKE_CASE    ):
  
  
  
  
  
  
   """simple docstring"""
  
  
  
  
   __lowerCAmelCase				      =						"vilt"
  
  
   def __init__(	self				,					__A=3_0522				,					__A=2				,					__A=2				,					__A=40				,					__A=768				,					__A=12				,					__A=12				,					__A=3072				,					__A="gelu"				,					__A=0.0				,					__A=0.0				,					__A=0.02				,					__A=1E-1_2				,					__A=384				,					__A=32				,					__A=3				,					__A=True				,					__A=-1				,					__A=False				,					__A=-1				,					**__A				,					)      ->  Dict:
       super().__init__(tie_word_embeddings=__A				,					**__A		)
  
       a					=vocab_size
       a					=type_vocab_size
       a					=modality_type_vocab_size
       a					=max_position_embeddings
  
       a					=hidden_size
       a					=num_hidden_layers
       a					=num_attention_heads
       a					=intermediate_size
       a					=hidden_act
       a					=hidden_dropout_prob
       a					=attention_probs_dropout_prob
       a					=initializer_range
       a					=layer_norm_eps
  
       a					=image_size
       a					=patch_size
       a					=num_channels
       a					=qkv_bias
       a					=max_image_length
       a					=num_images