
"""simple docstring"""


# Lint as: python3
# pylint: enable=line-too-long
# pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position

_lowercase				 =					'''2.13.1'''

import platform

import pyarrow
from packaging import version


if version.parse(platform.python_version()) < version.parse('''3.7'''):
		raise ImportWarning(
		    '''To use `datasets`, Python>=3.7 is required, and the current version of Python doesn\'t match this condition.'''
		)

if version.parse(pyarrow.__version__).major < 8:
		raise ImportWarning(
		    '''To use `datasets`, the module `pyarrow>=8.0.0` is required, and the current version of `pyarrow` doesn\'t match this condition.\n'''
		    '''If you are running this in a Google Colab, you should probably just restart the runtime to use the right version of `pyarrow`.'''
		)

del platform
del pyarrow
del version

from .arrow_dataset import Dataset
from .arrow_reader import ReadInstruction
from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder
from .combine import concatenate_datasets, interleave_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .download import *
from .features import *
from .fingerprint import disable_caching, enable_caching, is_caching_enabled, set_caching_enabled
from .info import DatasetInfo, MetricInfo
from .inspect import (
    get_dataset_config_info,
    get_dataset_config_names,
    get_dataset_infos,
    get_dataset_split_names,
    inspect_dataset,
    inspect_metric,
    list_datasets,
    list_metrics,
)
from .iterable_dataset import IterableDataset
from .load import load_dataset, load_dataset_builder, load_from_disk, load_metric
from .metric import Metric
from .splits import (
    NamedSplit,
    NamedSplitAll,
    Split,
    SplitBase,
    SplitDict,
    SplitGenerator,
    SplitInfo,
    SubSplitInfo,
    percent,
)
from .tasks import *
from .utils import *
from .utils import logging


# deprecated modules
from datasets import arrow_dataset as _arrow_dataset  # isort:skip
from datasets import utils as _utils  # isort:skip
from datasets.utils import download_manager as _deprecated_download_manager  # isort:skip

_lowercase				 =					concatenate_datasets
_lowercase				 =					DownloadConfig
_lowercase				 =					DownloadManager
_lowercase				 =					DownloadMode
_lowercase				 =					DownloadConfig
_lowercase				 =					DownloadMode
_lowercase				 =					DownloadManager

del _arrow_dataset, _utils, _deprecated_download_manager



'''simple docstring'''
import unittest

from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow


if is_flax_available():
							import jax

							from transformers.models.auto.modeling_flax_auto import FlaxAutoModel
							from transformers.models.bert.modeling_flax_bert import FlaxBertModel
							from transformers.models.roberta.modeling_flax_roberta import FlaxRobertaModel






@require_flax
class 					__lowerCAmelCase   (   unittest.TestCase						):

						"""simple docstring"""






						@slow
						def 				_UpperCAmelCase       (  self							:      Dict	):
													for model_name in ["bert-base-cased", "bert-large-uncased"]:
																				with self.subTest(lowerCAmelCase	):
																											A_			    =		AutoConfig.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)

																											A_			    =		FlaxAutoModel.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)






						@slow
						def 				_UpperCAmelCase       (  self							:      Union[str, Any]	):
													for model_name in ["roberta-base", "roberta-large"]:
																				with self.subTest(lowerCAmelCase	):
																											A_			    =		AutoConfig.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)

																											A_			    =		FlaxAutoModel.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)






						@slow
						def 				_UpperCAmelCase       (  self							:      List[Any]	):
													for model_name in ["bert-base-cased", "bert-large-uncased"]:
																				A_			    =		AutoTokenizer.from_pretrained(lowerCAmelCase	)
																				A_			    =		FlaxBertModel.from_pretrained(lowerCAmelCase	)
																				A_			    =		tokenizer("Do you support jax jitted function?" ,  return_tensors=TensorType.JAX	)

																				@jax.jit
																				def eval(**lowerCAmelCase							:      Tuple	):
																											return model(**lowerCAmelCase	)

																				eval(**lowerCAmelCase	).block_until_ready()






						@slow
						def 				_UpperCAmelCase       (  self							:      str	):
													for model_name in ["roberta-base", "roberta-large"]:
																				A_			    =		AutoTokenizer.from_pretrained(lowerCAmelCase	)
																				A_			    =		FlaxRobertaModel.from_pretrained(lowerCAmelCase	)
																				A_			    =		tokenizer("Do you support jax jitted function?" ,  return_tensors=TensorType.JAX	)

																				@jax.jit
																				def eval(**lowerCAmelCase							:      Any	):
																											return model(**lowerCAmelCase	)

																				eval(**lowerCAmelCase	).block_until_ready()






						def 				_UpperCAmelCase       (  self							:      List[Any]	):
													with self.assertRaisesRegex(
													    lowerCAmelCase ,  "bert-base is not a local folder and is not a valid model identifier"	):
																				A_			    =		FlaxAutoModel.from_pretrained("bert-base"	)






						def 				_UpperCAmelCase       (  self							:      Any	):
													with self.assertRaisesRegex(
													    lowerCAmelCase ,  r"aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"	):
																				A_			    =		FlaxAutoModel.from_pretrained(lowerCAmelCase ,  revision="aaaaaa"	)






						def 				_UpperCAmelCase       (  self							:      Dict	):
													with self.assertRaisesRegex(
													    lowerCAmelCase ,  "hf-internal-testing/config-no-model does not appear to have a file named flax_model.msgpack" ,  ):
																				A_			    =		FlaxAutoModel.from_pretrained("hf-internal-testing/config-no-model"	)






						def 				_UpperCAmelCase       (  self							:      Any	):
													with self.assertRaisesRegex(lowerCAmelCase ,  "Use `from_pt=True` to load this model"	):
																				A_			    =		FlaxAutoModel.from_pretrained("hf-internal-testing/tiny-bert-pt-only"	)





