


'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__snake_case							      =     {
    '''configuration_mobilebert''': [
        '''MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''MobileBertConfig''',
        '''MobileBertOnnxConfig''',
    ],
    '''tokenization_mobilebert''': ['''MobileBertTokenizer'''],
}

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case							      =     ['''MobileBertTokenizerFast''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case							      =     [
		    '''MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''MobileBertForMaskedLM''',
		    '''MobileBertForMultipleChoice''',
		    '''MobileBertForNextSentencePrediction''',
		    '''MobileBertForPreTraining''',
		    '''MobileBertForQuestionAnswering''',
		    '''MobileBertForSequenceClassification''',
		    '''MobileBertForTokenClassification''',
		    '''MobileBertLayer''',
		    '''MobileBertModel''',
		    '''MobileBertPreTrainedModel''',
		    '''load_tf_weights_in_mobilebert''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__snake_case							      =     [
		    '''TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFMobileBertForMaskedLM''',
		    '''TFMobileBertForMultipleChoice''',
		    '''TFMobileBertForNextSentencePrediction''',
		    '''TFMobileBertForPreTraining''',
		    '''TFMobileBertForQuestionAnswering''',
		    '''TFMobileBertForSequenceClassification''',
		    '''TFMobileBertForTokenClassification''',
		    '''TFMobileBertMainLayer''',
		    '''TFMobileBertModel''',
		    '''TFMobileBertPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_mobilebert import (
		    MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    MobileBertConfig,
		    MobileBertOnnxConfig,
		)
		from .tokenization_mobilebert import MobileBertTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_mobilebert_fast import MobileBertTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_mobilebert import (
				    MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    MobileBertForMaskedLM,
				    MobileBertForMultipleChoice,
				    MobileBertForNextSentencePrediction,
				    MobileBertForPreTraining,
				    MobileBertForQuestionAnswering,
				    MobileBertForSequenceClassification,
				    MobileBertForTokenClassification,
				    MobileBertLayer,
				    MobileBertModel,
				    MobileBertPreTrainedModel,
				    load_tf_weights_in_mobilebert,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_mobilebert import (
				    TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFMobileBertForMaskedLM,
				    TFMobileBertForMultipleChoice,
				    TFMobileBertForNextSentencePrediction,
				    TFMobileBertForPreTraining,
				    TFMobileBertForQuestionAnswering,
				    TFMobileBertForSequenceClassification,
				    TFMobileBertForTokenClassification,
				    TFMobileBertMainLayer,
				    TFMobileBertModel,
				    TFMobileBertPreTrainedModel,
				)

else:
		import sys

		__snake_case							      =     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict
@pytest.mark.parametrize(
    '''split_dict'''		,  [
        SplitDict(),
        SplitDict({'''train''': SplitInfo(name='''train'''		,  num_bytes=1_337		,  num_examples=42		,  dataset_name='''my_dataset'''						)}						),
        SplitDict({'''train''': SplitInfo(name='''train'''		,  num_bytes=1_337		,  num_examples=42						)}						),
        SplitDict({'''train''': SplitInfo()}						),
    ]		,  )
def       A	(    _lowercase						):
						SCREAMING_SNAKE_CASE							:    Tuple							=							split_dict._to_yaml_list()
						assert len(_lowercase						) == len(_lowercase						)
						SCREAMING_SNAKE_CASE							:    Tuple							=							SplitDict._from_yaml_list(_lowercase						)
						for split_name, split_info in split_dict.items():
												# dataset_name field is deprecated, and is therefore not part of the YAML dump
												SCREAMING_SNAKE_CASE							:    Any							=							None
												# the split name of split_dict takes over the name of the split info object
												SCREAMING_SNAKE_CASE							:    Optional[Any]							=							split_name
						assert split_dict == reloaded



@pytest.mark.parametrize(
    '''split_info'''		,  [SplitInfo(), SplitInfo(dataset_name=_lowercase						), SplitInfo(dataset_name='''my_dataset'''						)]						)
def       A	(    _lowercase						):
						# For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
						# field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
						SCREAMING_SNAKE_CASE							:    List[Any]							=							asdict(SplitDict({'''train''': split_info}						)						)
						assert "dataset_name" in split_dict_asdict["train"]
						assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name





