

import inspect
import unittest
import warnings

from transformers import DeiTConfig
from transformers.models.auto import get_values
from transformers.testing_utils import (
    require_accelerate,
    require_torch,
    require_torch_gpu,
    require_vision,
    slow,
    torch_device,
)
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
			import torch
			from torch import nn

			from transformers import (
			    MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
			    MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
			    MODEL_MAPPING,
			    DeiTForImageClassification,
			    DeiTForImageClassificationWithTeacher,
			    DeiTForMaskedImageModeling,
			    DeiTModel,
			)
			from transformers.models.deit.modeling_deit import DEIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
			from PIL import Image

			from transformers import DeiTImageProcessor






class _UpperCamelCase				:
			'''simple docstring'''







			def __init__(      self				:			Tuple   ,   a				:			List[Any]   ,   a				:			List[Any]=13   ,   a				:			List[str]=30   ,   a				:			Optional[int]=2   ,   a				:			Optional[Any]=3   ,   a				:			Optional[Any]=True   ,   a				:			List[Any]=True   ,   a				:			Dict=32   ,   a				:			List[str]=5   ,   a				:			Tuple=4   ,   a				:			Dict=37   ,   a				:			List[Any]="gelu"   ,   a				:			str=0.1   ,   a				:			Dict=0.1   ,   a				:			Optional[Any]=10   ,   a				:			Optional[int]=0.02   ,   a				:			int=3   ,   a				:			Union[str, Any]=None   ,   a				:			Union[str, Any]=2   ,   )				->							str:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   List[Any]					  =							parent
				SCREAMING_SNAKE_CASE :   List[Any]					  =							batch_size
				SCREAMING_SNAKE_CASE :   List[str]					  =							image_size
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							patch_size
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							num_channels
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							is_training
				SCREAMING_SNAKE_CASE :   Any					  =							use_labels
				SCREAMING_SNAKE_CASE :   Any					  =							hidden_size
				SCREAMING_SNAKE_CASE :   str					  =							num_hidden_layers
				SCREAMING_SNAKE_CASE :   List[Any]					  =							num_attention_heads
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							intermediate_size
				SCREAMING_SNAKE_CASE :   Dict					  =							hidden_act
				SCREAMING_SNAKE_CASE :   str					  =							hidden_dropout_prob
				SCREAMING_SNAKE_CASE :   Optional[int]					  =							attention_probs_dropout_prob
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							type_sequence_label_size
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							initializer_range
				SCREAMING_SNAKE_CASE :   Optional[int]					  =							scope
				SCREAMING_SNAKE_CASE :   List[str]					  =							encoder_stride

				# in DeiT, the seq length equals the number of patches + 2 (we add 2 for the [CLS] and distilation tokens)
				SCREAMING_SNAKE_CASE :   Tuple					  =							(image_size // patch_size) ** 2
				SCREAMING_SNAKE_CASE :   int					  =							num_patches + 2
			def 				__UpperCamelCase			(      self				:			Dict						)				->							Dict:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   List[Any]					  =							floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]						)

				SCREAMING_SNAKE_CASE :   List[str]					  =							None
				if self.use_labels:
					SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							ids_tensor([self.batch_size]   ,   self.type_sequence_label_size						)

				SCREAMING_SNAKE_CASE :   str					  =							self.get_config()

				return config, pixel_values, labels
			def 				__UpperCamelCase			(      self				:			str						)				->							Dict:

				"""simple docstring"""

				return DeiTConfig(
				    image_size=self.image_size   ,   patch_size=self.patch_size   ,   num_channels=self.num_channels   ,   hidden_size=self.hidden_size   ,   num_hidden_layers=self.num_hidden_layers   ,   num_attention_heads=self.num_attention_heads   ,   intermediate_size=self.intermediate_size   ,   hidden_act=self.hidden_act   ,   hidden_dropout_prob=self.hidden_dropout_prob   ,   attention_probs_dropout_prob=self.attention_probs_dropout_prob   ,   is_decoder=__A   ,   initializer_range=self.initializer_range   ,   encoder_stride=self.encoder_stride   ,   )
			def 				__UpperCamelCase			(      self				:			str   ,   a				:			Dict   ,   a				:			List[str]   ,   a				:			Any						)				->							Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Any					  =							DeiTModel(config=__A						)
				model.to(__A						)
				model.eval()
				SCREAMING_SNAKE_CASE :   Optional[int]					  =							model(__A						)
				self.parent.assertEqual(result.last_hidden_state.shape   ,   (self.batch_size, self.seq_length, self.hidden_size)						)
			def 				__UpperCamelCase			(      self				:			str   ,   a				:			Dict   ,   a				:			int   ,   a				:			Tuple						)				->							str:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   List[str]					  =							DeiTForMaskedImageModeling(config=__A						)
				model.to(__A						)
				model.eval()
				SCREAMING_SNAKE_CASE :   int					  =							model(__A						)
				self.parent.assertEqual(
				    result.reconstruction.shape   ,   (self.batch_size, self.num_channels, self.image_size, self.image_size)						)

				# test greyscale images
				SCREAMING_SNAKE_CASE :   Dict					  =							1
				SCREAMING_SNAKE_CASE :   Tuple					  =							DeiTForMaskedImageModeling(__A						)
				model.to(__A						)
				model.eval()

				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							floats_tensor([self.batch_size, 1, self.image_size, self.image_size]						)
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							model(__A						)
				self.parent.assertEqual(result.reconstruction.shape   ,   (self.batch_size, 1, self.image_size, self.image_size)						)
			def 				__UpperCamelCase			(      self				:			int   ,   a				:			int   ,   a				:			Any   ,   a				:			List[Any]						)				->							Optional[int]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							self.type_sequence_label_size
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							DeiTForImageClassification(__A						)
				model.to(__A						)
				model.eval()
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							model(__A   ,   labels=__A						)
				self.parent.assertEqual(result.logits.shape   ,   (self.batch_size, self.type_sequence_label_size)						)

				# test greyscale images
				SCREAMING_SNAKE_CASE :   Optional[int]					  =							1
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							DeiTForImageClassification(__A						)
				model.to(__A						)
				model.eval()

				SCREAMING_SNAKE_CASE :   Optional[int]					  =							floats_tensor([self.batch_size, 1, self.image_size, self.image_size]						)
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							model(__A   ,   labels=__A						)
				self.parent.assertEqual(result.logits.shape   ,   (self.batch_size, self.type_sequence_label_size)						)






			def 				__UpperCamelCase			(      self				:			int						)				->							List[str]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							self.prepare_config_and_inputs()
				(
				    SCREAMING_SNAKE_CASE				
				) :   Optional[int]					  =							config_and_inputs
				SCREAMING_SNAKE_CASE :   str					  =							{"""pixel_values""": pixel_values}
				return config, inputs_dict






@require_torch
class _UpperCamelCase				(				_lowercase				,						_lowercase				,						unittest.TestCase ):
			'''simple docstring'''







			lowerCamelCase__							     =(
			    (
			        DeiTModel,
			        DeiTForImageClassification,
			        DeiTForImageClassificationWithTeacher,
			        DeiTForMaskedImageModeling,
			    )
			    if is_torch_available()
			    else ()
			)
			lowerCamelCase__							     =(
			    {
			        '''feature-extraction''': DeiTModel,
			        '''image-classification''': (DeiTForImageClassification, DeiTForImageClassificationWithTeacher),
			    }
			    if is_torch_available()
			    else {}
			)

			lowerCamelCase__							     =False
			lowerCamelCase__							     =False
			lowerCamelCase__							     =False
			def 				__UpperCamelCase			(      self				:			str						)				->							Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Dict					  =							DeiTModelTester(self						)
				SCREAMING_SNAKE_CASE :   int					  =							ConfigTester(self   ,   config_class=__A   ,   has_text_modality=__A   ,   hidden_size=37						)
			def 				__UpperCamelCase			(      self				:			Tuple						)				->							Dict:

				"""simple docstring"""

				self.config_tester.run_common_tests()
			@unittest.skip(reason="DeiT does not use inputs_embeds"						)
			def 				__UpperCamelCase			(      self				:			Any						)				->							Tuple:

				"""simple docstring"""

				pass
			def 				__UpperCamelCase			(      self				:			int						)				->							Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Dict					  =							self.model_tester.prepare_config_and_inputs_for_common()

				for model_class in self.all_model_classes:
					SCREAMING_SNAKE_CASE :   Any					  =							model_class(__A						)
					self.assertIsInstance(model.get_input_embeddings()   ,   (nn.Module)						)
					SCREAMING_SNAKE_CASE :   Any					  =							model.get_output_embeddings()
					self.assertTrue(x is None or isinstance(__A   ,   nn.Linear						)						)
			def 				__UpperCamelCase			(      self				:			str						)				->							Optional[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							self.model_tester.prepare_config_and_inputs_for_common()

				for model_class in self.all_model_classes:
					SCREAMING_SNAKE_CASE :   Optional[Any]					  =							model_class(__A						)
					SCREAMING_SNAKE_CASE :   Dict					  =							inspect.signature(model.forward						)
					# signature.parameters is an OrderedDict => so arg_names order is deterministic
					SCREAMING_SNAKE_CASE :   Dict					  =							[*signature.parameters.keys()]

					SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							["""pixel_values"""]
					self.assertListEqual(arg_names[:1]   ,   __A						)
			def 				__UpperCamelCase			(      self				:			Any						)				->							Dict:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Dict					  =							self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_model(*__A						)
			def 				__UpperCamelCase			(      self				:			Tuple						)				->							Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_for_masked_image_modeling(*__A						)
			def 				__UpperCamelCase			(      self				:			str						)				->							List[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_for_image_classification(*__A						)
			def 				__UpperCamelCase			(      self				:			Optional[Any]   ,   a				:			int   ,   a				:			Dict   ,   a				:			Optional[Any]=False						)				->							str:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Any					  =							super()._prepare_for_class(__A   ,   __A   ,   return_labels=__A						)

				if return_labels:
					if model_class.__name__ == "DeiTForImageClassificationWithTeacher":
						del inputs_dict["labels"]

				return inputs_dict
			def 				__UpperCamelCase			(      self				:			Optional[int]						)				->							Tuple:

				"""simple docstring"""

				if not self.model_tester.is_training:
					return

				SCREAMING_SNAKE_CASE :   int					  =							self.model_tester.prepare_config_and_inputs_for_common()
				SCREAMING_SNAKE_CASE :   Any					  =							True

				for model_class in self.all_model_classes:
					# DeiTForImageClassificationWithTeacher supports inference-only
					if (
					    model_class in get_values(__A						)
					    or model_class.__name__ == "DeiTForImageClassificationWithTeacher"
					):
						continue
					SCREAMING_SNAKE_CASE :   List[str]					  =							model_class(__A						)
					model.to(__A						)
					model.train()
					SCREAMING_SNAKE_CASE :   Dict					  =							self._prepare_for_class(__A   ,   __A   ,   return_labels=__A						)
					SCREAMING_SNAKE_CASE :   Any					  =							model(**__A						).loss
					loss.backward()
			def 				__UpperCamelCase			(      self				:			Tuple						)				->							str:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							self.model_tester.prepare_config_and_inputs_for_common()
				if not self.model_tester.is_training:
					return

				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							False
				SCREAMING_SNAKE_CASE :   List[Any]					  =							True

				for model_class in self.all_model_classes:
					if model_class in get_values(__A						) or not model_class.supports_gradient_checkpointing:
						continue
					# DeiTForImageClassificationWithTeacher supports inference-only
					if model_class.__name__ == "DeiTForImageClassificationWithTeacher":
						continue
					SCREAMING_SNAKE_CASE :   Any					  =							model_class(__A						)
					model.gradient_checkpointing_enable()
					model.to(__A						)
					model.train()
					SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							self._prepare_for_class(__A   ,   __A   ,   return_labels=__A						)
					SCREAMING_SNAKE_CASE :   int					  =							model(**__A						).loss
					loss.backward()
			def 				__UpperCamelCase			(      self				:			List[Any]						)				->							Tuple:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Optional[int]					  =							self.model_tester.prepare_config_and_inputs_for_common()

				SCREAMING_SNAKE_CASE :   str					  =							[
				    {"""title""": """multi_label_classification""", """num_labels""": 2, """dtype""": torch.float},
				    {"""title""": """single_label_classification""", """num_labels""": 1, """dtype""": torch.long},
				    {"""title""": """regression""", """num_labels""": 1, """dtype""": torch.float},
				]

				for model_class in self.all_model_classes:
					if (
					    model_class
					    not in [
					        *get_values(__A						),
					        *get_values(__A						),
					    ]
					    or model_class.__name__ == "DeiTForImageClassificationWithTeacher"
					):
						continue

					for problem_type in problem_types:
						with self.subTest(msg=F"Testing {model_class} with {problem_type['title']}"						):
							SCREAMING_SNAKE_CASE :   Tuple					  =							problem_type["""title"""]
							SCREAMING_SNAKE_CASE :   Optional[int]					  =							problem_type["""num_labels"""]

							SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							model_class(__A						)
							model.to(__A						)
							model.train()

							SCREAMING_SNAKE_CASE :   int					  =							self._prepare_for_class(__A   ,   __A   ,   return_labels=__A						)

							if problem_type["num_labels"] > 1:
								SCREAMING_SNAKE_CASE :   int					  =							inputs["""labels"""].unsqueeze(1						).repeat(1   ,   problem_type["num_labels"]						)

							SCREAMING_SNAKE_CASE :   Optional[Any]					  =							inputs["""labels"""].to(problem_type["dtype"]						)

							# This tests that we do not trigger the warning form PyTorch "Using a target size that is different
							# to the input size. This will likely lead to incorrect results due to broadcasting. Please ensure
							# they have the same size." which is a symptom something in wrong for the regression problem.
							# See https://github.com/huggingface/transformers/issues/11780
							with warnings.catch_warnings(record=__A						) as warning_list:
								SCREAMING_SNAKE_CASE :   List[str]					  =							model(**__A						).loss
							for w in warning_list:
								if "Using a target size that is different to the input size" in str(w.message						):
									raise ValueError(
									    F"Something is going wrong in the regression problem: intercepted {w.message}"						)

							loss.backward()






			@slow
			def 				__UpperCamelCase			(      self				:			Union[str, Any]						)				->							Optional[int]:

				"""simple docstring"""

				for model_name in DEIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					SCREAMING_SNAKE_CASE :   Optional[Any]					  =							DeiTModel.from_pretrained(__A						)
					self.assertIsNotNone(__A						)

def 			lowerCamelCase__			(       ):
	SCREAMING_SNAKE_CASE :   Any					  =							Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png")
	return image






@require_torch
@require_vision
class _UpperCamelCase				(				unittest.TestCase ):
			'''simple docstring'''







			@cached_property
			def 				__UpperCamelCase			(      self				:			List[Any]						)				->							List[str]:

				"""simple docstring"""

				return (
				    DeiTImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224"						)
				    if is_vision_available()
				    else None
				)
			@slow
			def 				__UpperCamelCase			(      self				:			Optional[int]						)				->							Optional[int]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Any					  =							DeiTForImageClassificationWithTeacher.from_pretrained("facebook/deit-base-distilled-patch16-224"						).to(
				    __A						)

				SCREAMING_SNAKE_CASE :   int					  =							self.default_image_processor
				SCREAMING_SNAKE_CASE :   List[str]					  =							prepare_img()
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							image_processor(images=__A   ,   return_tensors="pt"						).to(__A						)

				# forward pass
				with torch.no_grad():
					SCREAMING_SNAKE_CASE :   int					  =							model(**__A						)

				# verify the logits
				SCREAMING_SNAKE_CASE :   Optional[Any]					  =							torch.Size((1, 1000)						)
				self.assertEqual(outputs.logits.shape   ,   __A						)

				SCREAMING_SNAKE_CASE :   str					  =							torch.tensor([-1.0266, 0.1912, -1.2861]						).to(__A						)

				self.assertTrue(torch.allclose(outputs.logits[0, :3]   ,   __A   ,   atol=1e-4						)						)






			@slow
			@require_accelerate
			@require_torch_gpu
			def 				__UpperCamelCase			(      self				:			str						)				->							List[str]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   List[str]					  =							DeiTModel.from_pretrained(
				    "facebook/deit-base-distilled-patch16-224"   ,   torch_dtype=torch.floataa   ,   device_map="auto"						)
				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							self.default_image_processor

				SCREAMING_SNAKE_CASE :   Any					  =							prepare_img()
				SCREAMING_SNAKE_CASE :   List[str]					  =							image_processor(images=__A   ,   return_tensors="pt"						)
				SCREAMING_SNAKE_CASE :   List[Any]					  =							inputs.pixel_values.to(__A						)

				# forward pass to make sure inference works in fp16
				with torch.no_grad():
					SCREAMING_SNAKE_CASE :   Tuple					  =							model(__A						)


import os
from tempfile import TemporaryDirectory
from unittest import TestCase

import pytest
from absl.testing import parameterized

from datasets import config
from datasets.arrow_reader import HF_GCP_BASE_URL
from datasets.builder import DatasetBuilder
from datasets.dataset_dict import IterableDatasetDict
from datasets.iterable_dataset import IterableDataset
from datasets.load import dataset_module_factory, import_main_class
from datasets.utils.file_utils import cached_path


UpperCAmelCase_							:					Optional[Any]		 =   [
    {'''dataset''': '''wikipedia''', '''config_name''': '''20220301.de'''},
    {'''dataset''': '''wikipedia''', '''config_name''': '''20220301.en'''},
    {'''dataset''': '''wikipedia''', '''config_name''': '''20220301.fr'''},
    {'''dataset''': '''wikipedia''', '''config_name''': '''20220301.frr'''},
    {'''dataset''': '''wikipedia''', '''config_name''': '''20220301.it'''},
    {'''dataset''': '''wikipedia''', '''config_name''': '''20220301.simple'''},
    {'''dataset''': '''snli''', '''config_name''': '''plain_text'''},
    {'''dataset''': '''eli5''', '''config_name''': '''LFQA_reddit'''},
    {'''dataset''': '''wiki40b''', '''config_name''': '''en'''},
    {'''dataset''': '''wiki_dpr''', '''config_name''': '''psgs_w100.nq.compressed'''},
    {'''dataset''': '''wiki_dpr''', '''config_name''': '''psgs_w100.nq.no_index'''},
    {'''dataset''': '''wiki_dpr''', '''config_name''': '''psgs_w100.multiset.no_index'''},
    {'''dataset''': '''natural_questions''', '''config_name''': '''default'''},
]
def 							__SCREAMING_SNAKE_CASE     (   a__    :   str=True       )					->				List[Any]:
	if with_config:
		return [
		    {
		        "testcase_name": d["dataset"] + "/" + d["config_name"],
		        "dataset": d["dataset"],
		        "config_name": d["config_name"],
		    }
		    for d in DATASETS_ON_HF_GCP
		]
	else:
		return [
		    {"testcase_name": dataset, "dataset": dataset} for dataset in {d["dataset"] for d in DATASETS_ON_HF_GCP}
		]






@parameterized.named_parameters(list_datasets_on_hf_gcp_parameters(with_config=_lowercase	)	)
class      lowerCamelCase_      (	_lowercase	):
	_lowercase		:   Optional[int]     					=				None
	_lowercase		:   str     					=				None




	def        lowerCAmelCase_       (     self						:     Dict					,      __A						:     Optional[int]					,      __A						:     Optional[Any]							):
		with TemporaryDirectory() as tmp_dir:
			__A :			List[Any]		    =			dataset_module_factory(__A					,      cache_dir=__A							)

			__A :			Tuple		    =			import_main_class(dataset_module.module_path					,      dataset=__A							)

			__A :			DatasetBuilder		    =			builder_cls(
			    cache_dir=__A					,      config_name=__A					,      hash=dataset_module.hash					,      )

			__A :			List[Any]		    =			"""/""".join(
			    [
			        HF_GCP_BASE_URL,
			        builder_instance._relative_data_dir(with_hash=__A							).replace(os.sep					,      """/"""							),
			        config.DATASET_INFO_FILENAME,
			    ]							)
			__A :			Union[str, Any]		    =			cached_path(__A					,      cache_dir=__A							)
			self.assertTrue(os.path.exists(__A							)							)






@pytest.mark.integration
def 							__SCREAMING_SNAKE_CASE     (   a__    :   Dict       )					->				Optional[Any]:
	__A :			Optional[Any]		    =			tmp_path_factory.mktemp("""test_hf_gcp"""       ) / """test_wikipedia_simple"""
	__A :			Union[str, Any]		    =			dataset_module_factory("""wikipedia"""			,cache_dir=a__       )
	__A :			List[Any]		    =			import_main_class(dataset_module.module_path       )
	__A :			DatasetBuilder		    =			builder_cls(
	    cache_dir=a__			,config_name="""20220301.frr"""			,hash=dataset_module.hash			,)
	# use the HF cloud storage, not the original download_and_prepare that uses apache-beam
	__A :			Any		    =			None
	builder_instance.download_and_prepare()
	__A :			Union[str, Any]		    =			builder_instance.as_dataset()
	assert ds







@pytest.mark.integration
def 							__SCREAMING_SNAKE_CASE     (   a__    :   List[str]       )					->				List[str]:
	__A :			Tuple		    =			dataset_module_factory("""wikipedia"""			,cache_dir=a__       )
	__A :			str		    =			import_main_class(dataset_module.module_path			,dataset=a__       )
	__A :			DatasetBuilder		    =			builder_cls(
	    cache_dir=a__			,config_name="""20220301.frr"""			,hash=dataset_module.hash			,)
	__A :			Optional[int]		    =			builder_instance.as_streaming_dataset()
	assert ds
	assert isinstance(a__			,a__       )
	assert "train" in ds
	assert isinstance(ds["""train"""]			,a__       )
	assert next(iter(ds["""train"""]       )       )





