code: 
  
  
  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       :       int				   =			{
      "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": [515]},
  }
  
  
  
  @pytest.mark.parametrize(
      '''task_cls''',	[
          AudioClassification,
          AutomaticSpeechRecognition,
          ImageClassification,
          LanguageModeling,
          QuestionAnsweringExtractive,
          Summarization,
          TextClassification,
      ],	)
  def   SCREAMING_SNAKE_CASE__						(							snake_case_	)			->							int:
  				A__     :							List[str]   				=task_cls()
  				A__     :							Optional[int]   				=asdict(snake_case_	)
  				A__     :							List[str]   				=task_template_from_dict(snake_case_	)
  				assert task == reloaded
  
  
  
  class 			a      :
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[int]:
  						'''simple docstring'''
  
  
  						A__     :							Optional[Any]   				=LanguageModeling(text_column='''input_text'''							)
  						assert {"input_text": "text"} == task.column_mapping
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Dict:
  						'''simple docstring'''
  
  
  						A__     :							Optional[Any]   				=Features({'''text''': Value('''string'''							)}							)
  						A__     :							int   				={'''text_column''': '''input_text'''}
  						A__     :							str   				=LanguageModeling.from_dict(UpperCamelCase_							)
  						assert "language-modeling" == task.task
  						assert input_schema == task.input_schema
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[int]:
  						'''simple docstring'''
  
  
  						A__     :							Optional[Any]   				=sorted(['''pos''', '''neg''']							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			List[Any]:
  						'''simple docstring'''
  
  
  						A__     :							str   				=TextClassification(text_column='''input_text'''	,     label_column='''input_label'''							)
  						self.assertDictEqual({'''input_text''': '''text''', '''input_label''': '''labels'''}	,     task.column_mapping							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			List[Any]:
  						'''simple docstring'''
  
  
  						A__     :							List[Any]   				=Features({'''text''': Value('''string'''							)}							)
  						# Labels are cast to tuple during `TextClassification.__post_init__`, so we do the same here
  						A__     :							List[Any]   				=Features({'''labels''': ClassLabel}							)
  						A__     :							List[Any]   				={'''text_column''': '''input_text''', '''label_column''': '''input_labels'''}
  						A__     :							List[Any]   				=TextClassification.from_dict(UpperCamelCase_							)
  						self.assertEqual('''text-classification'''	,     task.task							)
  						self.assertEqual(UpperCamelCase_	,     task.input_schema							)
  						self.assertEqual(UpperCamelCase_	,     task.label_schema							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			str:
  						'''simple docstring'''
  
  
  						A__     :							Union[str, Any]   				=TextClassification(text_column='''input_text'''	,     label_column='''input_label'''							)
  						self.assertEqual(task.label_schema['''labels''']	,     UpperCamelCase_							)
  						A__     :							Tuple   				=task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels							)}							)							)
  						self.assertEqual(task.label_schema['''labels''']	,     ClassLabel(names=self.labels							)							)
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Dict:
  						'''simple docstring'''
  
  
  						A__     :							Dict   				=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       lowerCAmelCase_  (  self							)->			Optional[int]:
  						'''simple docstring'''
  
  
  						A__     :							List[str]   				=Features({'''question''': Value('''string'''							), '''context''': Value('''string'''							)}							)
  						A__     :							Dict   				=Features(
  						    {
  						        '''answers''': Sequence(
  						            {
  						                '''text''': Value('''string'''							),
  						                '''answer_start''': Value('''int32'''							),
  						            }							)
  						    }							)
  						A__     :							Tuple   				={
  						    '''context_column''': '''input_input_context''',
  						    '''question_column''': '''input_question''',
  						    '''answers_column''': '''input_answers''',
  						}
  						A__     :							int   				=QuestionAnsweringExtractive.from_dict(UpperCamelCase_							)
  						self.assertEqual('''question-answering-extractive'''	,     task.task							)
  						self.assertEqual(UpperCamelCase_	,     task.input_schema							)
  						self.assertEqual(UpperCamelCase_	,     task.label_schema							)
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Tuple:
  						'''simple docstring'''
  
  
  						A__     :							str   				=Summarization(text_column='''input_text'''	,     summary_column='''input_summary'''							)
  						self.assertDictEqual({'''input_text''': '''text''', '''input_summary''': '''summary'''}	,     task.column_mapping							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[Any]:
  						'''simple docstring'''
  
  
  						A__     :							str   				=Features({'''text''': Value('''string'''							)}							)
  						A__     :							Optional[Any]   				=Features({'''summary''': Value('''string'''							)}							)
  						A__     :							Optional[int]   				={'''text_column''': '''input_text''', '''summary_column''': '''input_summary'''}
  						A__     :							int   				=Summarization.from_dict(UpperCamelCase_							)
  						self.assertEqual('''summarization'''	,     task.task							)
  						self.assertEqual(UpperCamelCase_	,     task.input_schema							)
  						self.assertEqual(UpperCamelCase_	,     task.label_schema							)
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[Any]:
  						'''simple docstring'''
  
  
  						A__     :							int   				=AutomaticSpeechRecognition(audio_column='''input_audio'''	,     transcription_column='''input_transcription'''							)
  						self.assertDictEqual({'''input_audio''': '''audio''', '''input_transcription''': '''transcription'''}	,     task.column_mapping							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Dict:
  						'''simple docstring'''
  
  
  						A__     :							List[str]   				=Features({'''audio''': Audio()}							)
  						A__     :							str   				=Features({'''transcription''': Value('''string'''							)}							)
  						A__     :							Any   				={
  						    '''audio_column''': '''input_audio''',
  						    '''transcription_column''': '''input_transcription''',
  						}
  						A__     :							Dict   				=AutomaticSpeechRecognition.from_dict(UpperCamelCase_							)
  						self.assertEqual('''automatic-speech-recognition'''	,     task.task							)
  						self.assertEqual(UpperCamelCase_	,     task.input_schema							)
  						self.assertEqual(UpperCamelCase_	,     task.label_schema							)
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[int]:
  						'''simple docstring'''
  
  
  						A__     :							str   				=sorted(['''pos''', '''neg''']							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Any:
  						'''simple docstring'''
  
  
  						A__     :							Union[str, Any]   				=AudioClassification(audio_column='''input_audio'''	,     label_column='''input_label'''							)
  						self.assertDictEqual({'''input_audio''': '''audio''', '''input_label''': '''labels'''}	,     task.column_mapping							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			List[Any]:
  						'''simple docstring'''
  
  
  						A__     :							List[Any]   				=Features({'''audio''': Audio()}							)
  						A__     :							Tuple   				=Features({'''labels''': ClassLabel}							)
  						A__     :							List[Any]   				={
  						    '''audio_column''': '''input_image''',
  						    '''label_column''': '''input_label''',
  						}
  						A__     :							Any   				=AudioClassification.from_dict(UpperCamelCase_							)
  						self.assertEqual('''audio-classification'''	,     task.task							)
  						self.assertEqual(UpperCamelCase_	,     task.input_schema							)
  						self.assertEqual(UpperCamelCase_	,     task.label_schema							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			str:
  						'''simple docstring'''
  
  
  						A__     :							int   				=AudioClassification(audio_column='''input_audio'''	,     label_column='''input_label'''							)
  						self.assertEqual(task.label_schema['''labels''']	,     UpperCamelCase_							)
  						A__     :							List[Any]   				=task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels							)}							)							)
  						self.assertEqual(task.label_schema['''labels''']	,     ClassLabel(names=self.labels							)							)
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Tuple:
  						'''simple docstring'''
  
  
  						A__     :							List[str]   				=sorted(['''pos''', '''neg''']							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			List[Any]:
  						'''simple docstring'''
  
  
  						A__     :							Optional[int]   				=ImageClassification(image_column='''input_image'''	,     label_column='''input_label'''							)
  						self.assertDictEqual({'''input_image''': '''image''', '''input_label''': '''labels'''}	,     task.column_mapping							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[Any]:
  						'''simple docstring'''
  
  
  						A__     :							List[Any]   				=Features({'''image''': Image()}							)
  						A__     :							Any   				=Features({'''labels''': ClassLabel}							)
  						A__     :							Tuple   				={
  						    '''image_column''': '''input_image''',
  						    '''label_column''': '''input_label''',
  						}
  						A__     :							Optional[Any]   				=ImageClassification.from_dict(UpperCamelCase_							)
  						self.assertEqual('''image-classification'''	,     task.task							)
  						self.assertEqual(UpperCamelCase_	,     task.input_schema							)
  						self.assertEqual(UpperCamelCase_	,     task.label_schema							)
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			str:
  						'''simple docstring'''
  
  
  						A__     :							Optional[int]   				=ImageClassification(image_column='''input_image'''	,     label_column='''input_label'''							)
  						self.assertEqual(task.label_schema['''labels''']	,     UpperCamelCase_							)
  						A__     :							List[str]   				=task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels							)}							)							)
  						self.assertEqual(task.label_schema['''labels''']	,     ClassLabel(names=self.labels							)							)
  
  
  
  
  
  
  
  class 			a      (      UpperCamelCase_   ):
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			str:
  						'''simple docstring'''
  
  
  						A__     :							int   				=DatasetInfo(task_templates=QuestionAnsweringExtractive()							)
  						A__     :							Any   				=Dataset.from_dict({k: [v] for k, v in SAMPLE_QUESTION_ANSWERING_EXTRACTIVE.items()}	,     info=UpperCamelCase_							)
  						assert isinstance(dataset.info.task_templates	,     UpperCamelCase_							)
  						assert len(dataset.info.task_templates							) == 1
  
  						def keep_task(__UpperCamelCase							):
  										return x
  
  						def dont_keep_task(__UpperCamelCase							):
  										A__     :							List[str]   				=deepcopy(UpperCamelCase_							)
  										A__     :							List[str]   				=0
  										return out
  
  						A__     :							Optional[Any]   				=dataset.map(UpperCamelCase_							)
  						assert mapped_dataset.info.task_templates == dataset.info.task_templates
  						# reload from cache
  						A__     :							Any   				=dataset.map(UpperCamelCase_							)
  						assert mapped_dataset.info.task_templates == dataset.info.task_templates
  
  						A__     :							str   				=dataset.map(UpperCamelCase_							)
  						assert mapped_dataset.info.task_templates == []
  						# reload from cache
  						A__     :							Tuple   				=dataset.map(UpperCamelCase_							)
  						assert mapped_dataset.info.task_templates == []
  
  
  
  
  
  
  		def       lowerCAmelCase_  (  self							)->			Optional[Any]:
  						'''simple docstring'''
  
  
  						A__     :							Dict   				=Features({'''text''': Value('''string'''							), '''label''': ClassLabel(names=('''pos''', '''neg''')							)}							)
  						A__     :							Dict   				=TextClassification(text_column='''text'''	,     label_column='''label'''							)
  						A__     :							Union[str, Any]   				=DatasetInfo(features=UpperCamelCase_	,     task_templates=UpperCamelCase_							)
  						A__     :							Dict   				=Dataset.from_dict({'''text''': ['''A sentence.'''], '''label''': ['''pos''']}	,     info=UpperCamelCase_							)
  
  						def process(__UpperCamelCase							):
  										return example
  
  						A__     :							Tuple   				=dataset.remove_columns('''label'''							)
  						A__     :							List[str]   				=modified_dataset.map(UpperCamelCase_							)
  						assert mapped_dataset.info.task_templates == []
  
  
  
  
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_torch_available,
  )
  
  
  __lowerCamelCase       :       str				   =			{
      "configuration_align": [
          "ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP",
          "AlignConfig",
          "AlignTextConfig",
          "AlignVisionConfig",
      ],
      "processing_align": ["AlignProcessor"],
  }
  
  try:
  						if not is_torch_available():
  												raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  						pass
  else:
  						__lowerCamelCase       :       Dict				   =			[
  						    "ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST",
  						    "AlignModel",
  						    "AlignPreTrainedModel",
  						    "AlignTextModel",
  						    "AlignVisionModel",
  						]
  
  if TYPE_CHECKING:
  						from .configuration_align import (
  						    ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
  						    AlignConfig,
  						    AlignTextConfig,
  						    AlignVisionConfig,
  						)
  						from .processing_align import AlignProcessor
  
  						try:
  												if not is_torch_available():
  																		raise OptionalDependencyNotAvailable()
  						except OptionalDependencyNotAvailable:
  												pass
  						else:
  												from .modeling_align import (
  												    ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
  												    AlignModel,
  												    AlignPreTrainedModel,
  												    AlignTextModel,
  												    AlignVisionModel,
  												)
  
  else:
  						import sys
  
  						__lowerCamelCase       :       List[str]				   =			_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
  
  
  
  