
import copy
import os
import tempfile
from unittest import TestCase
from unittest.mock import patch

import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
import pytest

from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence
from datasets.features import ArrayaD, ClassLabel, Features, Image, Value
from datasets.features.features import ArrayaDExtensionType, cast_to_python_objects
from datasets.keyhash import DuplicatedKeysError, InvalidKeyError

from .utils import require_pil





class 							UpperCAmelCase				(  __lowercase  ):




	'''simple docstring'''





	def     UpperCamelCase_  (	self :			Optional[int]			):
					__A             =			pa.array(TypedSequence([1, 2, 3]			)			)
					self.assertEqual(arr.type							,pa.intaa()			)






	def     UpperCamelCase_  (	self :			Union[str, Any]			):
					with self.assertRaises(_a			):
									__A             =			pa.array(TypedSequence([1, 2, 3]			)							,type=pa.intaa()			)






	def     UpperCamelCase_  (	self :			Dict			):
					with self.assertRaises(_a			):
									__A             =			pa.array(TypedSequence([1, 2, 3]							,try_type=Value("bool"			)							,type=Value("int64"			)			)			)






	def     UpperCamelCase_  (	self :			int			):
					__A             =			pa.array(TypedSequence([1, 2, 3]							,type=Value("int32"			)			)			)
					self.assertEqual(arr.type							,pa.intaa()			)






	def     UpperCamelCase_  (	self :			Optional[int]			):
					with self.assertRaises((TypeError, pa.lib.ArrowInvalid)			):
									__A             =			pa.array(TypedSequence(["foo", "bar"]							,type=Value("int64"			)			)			)






	def     UpperCamelCase_  (	self :			Union[str, Any]			):
					__A             =			pa.array(TypedSequence([1, 2, 3]							,try_type=Value("int32"			)			)			)
					self.assertEqual(arr.type							,pa.intaa()			)






	def     UpperCamelCase_  (	self :			Dict			):
					__A             =			pa.array(TypedSequence(["foo", "bar"]							,try_type=Value("int64"			)			)			)
					self.assertEqual(arr.type							,pa.string()			)






	def     UpperCamelCase_  (	self :			List[str]			):
					__A             =			pa.array(TypedSequence([[[1, 2, 3]]]							,type=ArrayaD((1, 3)							,"int64"			)			)			)
					self.assertEqual(arr.type							,ArrayaDExtensionType((1, 3)							,"int64"			)			)






	def     UpperCamelCase_  (	self :			Union[str, Any]			):
					with self.assertRaises((TypeError, pa.lib.ArrowInvalid)			):
									__A             =			pa.array(TypedSequence(["foo", "bar"]							,type=ArrayaD((1, 3)							,"int64"			)			)			)






	def     UpperCamelCase_  (	self :			Optional[Any]			):
					__A             =			pa.array(TypedSequence([[[1, 2, 3]]]							,try_type=ArrayaD((1, 3)							,"int64"			)			)			)
					self.assertEqual(arr.type							,ArrayaDExtensionType((1, 3)							,"int64"			)			)






	def     UpperCamelCase_  (	self :			Optional[Any]			):
					__A             =			pa.array(TypedSequence(["foo", "bar"]							,try_type=ArrayaD((1, 3)							,"int64"			)			)			)
					self.assertEqual(arr.type							,pa.string()			)







	@require_pil
	def     UpperCamelCase_  (	self :			Optional[Any]			):
					import PIL.Image

					__A             =			PIL.Image.fromarray(np.arange(10							,dtype=np.uinta			).reshape(2							,5			)			)
					with patch(
					    "datasets.arrow_writer.cast_to_python_objects"							,side_effect=_a			) as mock_cast_to_python_objects:
									__A             =			pa.array(TypedSequence([{"path": None, "bytes": B"image_bytes"}, pil_image]							,type=Image()			)			)
									__A      ,							__A             =			mock_cast_to_python_objects.call_args_list[-1]
									self.assertIn("optimize_list_casting"							,_a			)
									self.assertFalse(kwargs["optimize_list_casting"]			)





def 						UpperCamelCase__      (     a_		,       a_						)		->     Union[str, Any]:







				"""simple docstring"""



				__A             =			pa.BufferReader(__a						) if isinstance(__a		,       pa.Buffer						) else pa.memory_map(__a						)
				__A             =			pa.ipc.open_stream(__a						)
				__A             =			f.read_all()
				assert len(pa_table.to_batches()						) == expected_num_chunks
				assert pa_table.to_pydict() == {"col_1": ["foo", "bar"], "col_2": [1, 2]}
				del pa_table


@pytest.mark.parametrize("writer_batch_size"		,       [None, 1, 1_0]						)
@pytest.mark.parametrize(
    "fields"		,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]						)
def 						UpperCamelCase__      (     a_		,       a_						)		->     List[Any]:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				__A             =			pa.schema(__a						) if fields else None
				with ArrowWriter(stream=__a		,       schema=__a		,       writer_batch_size=__a						) as writer:
								writer.write({"col_1": "foo", "col_2": 1}						)
								writer.write({"col_1": "bar", "col_2": 2}						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				if not fields:
								__A             =			{"col_1": pa.string(), "col_2": pa.intaa()}
				assert writer._schema == pa.schema(__a		,       metadata=writer._schema.metadata						)
				_check_output(output.getvalue()		,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1						)


def 						UpperCamelCase__      (     )		->     str:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				__A             =			Features({"labels": ClassLabel(names=["neg", "pos"]						)}						)
				with ArrowWriter(stream=__a		,       features=__a						) as writer:
								writer.write({"labels": 0}						)
								writer.write({"labels": 1}						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				assert writer._schema == features.arrow_schema
				assert writer._schema.metadata == features.arrow_schema.metadata
				__A             =			pa.BufferReader(output.getvalue()						)
				__A             =			pa.ipc.open_stream(__a						)
				__A             =			f.read_all()
				__A             =			pa_table.schema
				assert pa_table.num_rows == 2
				assert schema == features.arrow_schema
				assert schema.metadata == features.arrow_schema.metadata
				assert features == Features.from_arrow_schema(__a						)


@pytest.mark.parametrize("writer_batch_size"		,       [None, 1, 1_0]						)
def 						UpperCamelCase__      (     a_						)		->     Union[str, Any]:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				with ArrowWriter(
				    stream=__a		,       writer_batch_size=__a		,       hash_salt="split_name"		,       check_duplicates=__a		,       ) as writer:
								with pytest.raises(__a						):
												writer.write({"col_1": "foo", "col_2": 1}		,       key=[1, 2]						)
												__A      ,							__A             =			writer.finalize()


@pytest.mark.parametrize("writer_batch_size"		,       [None, 2, 1_0]						)
def 						UpperCamelCase__      (     a_						)		->     int:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				with ArrowWriter(
				    stream=__a		,       writer_batch_size=__a		,       hash_salt="split_name"		,       check_duplicates=__a		,       ) as writer:
								with pytest.raises(__a						):
												writer.write({"col_1": "foo", "col_2": 1}		,       key=1_0						)
												writer.write({"col_1": "bar", "col_2": 2}		,       key=1_0						)
												__A      ,							__A             =			writer.finalize()


@pytest.mark.parametrize("writer_batch_size"		,       [None, 2, 1_0]						)
def 						UpperCamelCase__      (     a_						)		->     List[str]:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				with ArrowWriter(
				    stream=__a		,       writer_batch_size=__a		,       hash_salt="split_name"		,       check_duplicates=__a		,       ) as writer:
								writer.write({"col_1": "foo", "col_2": 1}		,       key=1						)
								writer.write({"col_1": "bar", "col_2": 2}		,       key=2						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				_check_output(output.getvalue()		,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1						)


@pytest.mark.parametrize("writer_batch_size"		,       [None, 1, 1_0]						)
@pytest.mark.parametrize(
    "fields"		,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]						)
def 						UpperCamelCase__      (     a_		,       a_						)		->     List[str]:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				__A             =			pa.schema(__a						) if fields else None
				with ArrowWriter(stream=__a		,       schema=__a		,       writer_batch_size=__a						) as writer:
								writer.write_batch({"col_1": ["foo", "bar"], "col_2": [1, 2]}						)
								writer.write_batch({"col_1": [], "col_2": []}						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				if not fields:
								__A             =			{"col_1": pa.string(), "col_2": pa.intaa()}
				assert writer._schema == pa.schema(__a		,       metadata=writer._schema.metadata						)
				_check_output(output.getvalue()		,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1						)


@pytest.mark.parametrize("writer_batch_size"		,       [None, 1, 1_0]						)
@pytest.mark.parametrize(
    "fields"		,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]						)
def 						UpperCamelCase__      (     a_		,       a_						)		->     Optional[Any]:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				__A             =			pa.schema(__a						) if fields else None
				with ArrowWriter(stream=__a		,       schema=__a		,       writer_batch_size=__a						) as writer:
								writer.write_table(pa.Table.from_pydict({"col_1": ["foo", "bar"], "col_2": [1, 2]}						)						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				if not fields:
								__A             =			{"col_1": pa.string(), "col_2": pa.intaa()}
				assert writer._schema == pa.schema(__a		,       metadata=writer._schema.metadata						)
				_check_output(output.getvalue()		,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1						)


@pytest.mark.parametrize("writer_batch_size"		,       [None, 1, 1_0]						)
@pytest.mark.parametrize(
    "fields"		,       [None, {"col_1": pa.string(), "col_2": pa.intaa()}, {"col_1": pa.string(), "col_2": pa.intaa()}]						)
def 						UpperCamelCase__      (     a_		,       a_						)		->     List[str]:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				__A             =			pa.schema(__a						) if fields else None
				with ArrowWriter(stream=__a		,       schema=__a		,       writer_batch_size=__a						) as writer:
								writer.write_row(pa.Table.from_pydict({"col_1": ["foo"], "col_2": [1]}						)						)
								writer.write_row(pa.Table.from_pydict({"col_1": ["bar"], "col_2": [2]}						)						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				if not fields:
								__A             =			{"col_1": pa.string(), "col_2": pa.intaa()}
				assert writer._schema == pa.schema(__a		,       metadata=writer._schema.metadata						)
				_check_output(output.getvalue()		,       expected_num_chunks=num_examples if writer_batch_size == 1 else 1						)


def 						UpperCamelCase__      (     )		->     Any:







				"""simple docstring"""



				with tempfile.TemporaryDirectory() as tmp_dir:
								__A             =			{"col_1": pa.string(), "col_2": pa.intaa()}
								__A             =			os.path.join(__a		,       "test.arrow"						)
								with ArrowWriter(path=__a		,       schema=pa.schema(__a						)						) as writer:
												writer.write_batch({"col_1": ["foo", "bar"], "col_2": [1, 2]}						)
												__A      ,							__A             =			writer.finalize()
								assert num_examples == 2
								assert num_bytes > 0
								assert writer._schema == pa.schema(__a		,       metadata=writer._schema.metadata						)
								_check_output(__a		,       1						)


def 						UpperCamelCase__      (     a_						)		->     List[Any]:







				"""simple docstring"""



				if pa.types.is_list(__a						):
								return get_base_dtype(arr_type.value_type						)
				else:
								return arr_type


def 						UpperCamelCase__      (     a_		,       a_						)		->     Optional[int]:







				"""simple docstring"""



				if isinstance(lst[0]		,       __a						):
								change_first_primitive_element_in_list(lst[0]		,       __a						)
				else:
								__A             =			value


@pytest.mark.parametrize("optimized_int_type, expected_dtype"		,       [(None, pa.intaa()), (Value("int32"						), pa.intaa())]						)
@pytest.mark.parametrize("sequence"		,       [[1, 2, 3], [[1, 2, 3]], [[[1, 2, 3]]]]						)
def 						UpperCamelCase__      (     a_		,       a_		,       a_						)		->     Dict:







				"""simple docstring"""



				__A             =			pa.array(TypedSequence(__a		,       optimized_int_type=__a						)						)
				assert get_base_dtype(arr.type						) == expected_dtype


@pytest.mark.parametrize(
    "col, expected_dtype"		,       [
        ("attention_mask", pa.inta()),
        ("special_tokens_mask", pa.inta()),
        ("token_type_ids", pa.inta()),
        ("input_ids", pa.intaa()),
        ("other", pa.intaa()),
    ]		,       )
@pytest.mark.parametrize("sequence"		,       [[1, 2, 3], [[1, 2, 3]], [[[1, 2, 3]]]]						)
def 						UpperCamelCase__      (     a_		,       a_		,       a_						)		->     Dict:







				"""simple docstring"""



				__A             =			pa.array(OptimizedTypedSequence(__a		,       col=__a						)						)
				assert get_base_dtype(arr.type						) == expected_dtype

				# not in range
				if col != "other":
								# avoids errors due to in-place modifications
								__A             =			copy.deepcopy(__a						)
								__A             =			np.iinfo(expected_dtype.to_pandas_dtype()						).max + 1
								change_first_primitive_element_in_list(__a		,       __a						)
								__A             =			pa.array(OptimizedTypedSequence(__a		,       col=__a						)						)
								assert get_base_dtype(arr.type						) == pa.intaa()


@pytest.mark.parametrize("raise_exception"		,       [False, True]						)
def 						UpperCamelCase__      (     a_		,       a_						)		->     int:







				"""simple docstring"""



				__A             =			str(tmp_path / "dataset-train.arrow"						)
				try:
								with ArrowWriter(path=__a						) as writer:
												if raise_exception:
																raise pa.lib.ArrowInvalid()
												else:
																writer.stream.close()
				except pa.lib.ArrowInvalid:
								pass
				finally:
								assert writer.stream.closed


def 						UpperCamelCase__      (     a_						)		->     List[str]:







				"""simple docstring"""



				__A             =			"mock://dataset-train.arrow"
				with ArrowWriter(path=__a		,       storage_options=mockfs.storage_options						) as writer:
								assert isinstance(writer._fs		,       type(__a						)						)
								assert writer._fs.storage_options == mockfs.storage_options
								writer.write({"col_1": "foo", "col_2": 1}						)
								writer.write({"col_1": "bar", "col_2": 2}						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				assert mockfs.exists(__a						)


def 						UpperCamelCase__      (     )		->     str:







				"""simple docstring"""



				__A             =			pa.BufferOutputStream()
				with ParquetWriter(stream=__a						) as writer:
								writer.write({"col_1": "foo", "col_2": 1}						)
								writer.write({"col_1": "bar", "col_2": 2}						)
								__A      ,							__A             =			writer.finalize()
				assert num_examples == 2
				assert num_bytes > 0
				__A             =			pa.BufferReader(output.getvalue()						)
				__A             =			pq.read_table(__a						)
				assert pa_table.to_pydict() == {"col_1": ["foo", "bar"], "col_2": [1, 2]}


@require_pil
@pytest.mark.parametrize("embed_local_files"		,       [False, True]						)
def 						UpperCamelCase__      (     a_		,       a_						)		->     str:







				"""simple docstring"""



				import PIL.Image

				__A             =			str(tmp_path / "test_image_rgb.jpg"						)
				PIL.Image.fromarray(np.zeros((5, 5)		,       dtype=np.uinta						)						).save(__a		,       format="png"						)
				__A             =			pa.BufferOutputStream()
				with ParquetWriter(
				    stream=__a		,       features=Features({"image": Image()}						)		,       embed_local_files=__a						) as writer:
								writer.write({"image": image_path}						)
								writer.finalize()
				__A             =			pa.BufferReader(output.getvalue()						)
				__A             =			pq.read_table(__a						)
				__A             =			pa_table.to_pydict()
				if embed_local_files:
								assert isinstance(out["image"][0]["path"]		,       __a						)
								with open(__a		,       "rb"						) as f:
												assert out["image"][0]["bytes"] == f.read()
				else:
								assert out["image"][0]["path"] == image_path
								assert out["image"][0]["bytes"] is None


def 						UpperCamelCase__      (     )		->     Dict:







				"""simple docstring"""



				__A             =			pa.schema([pa.field("col_1"		,       pa.string()		,       nullable=__a						)]						)
				__A             =			pa.BufferOutputStream()
				with ArrowWriter(stream=__a						) as writer:
								writer._build_writer(inferred_schema=__a						)
								assert writer._schema == pa.schema([pa.field("col_1"		,       pa.string()						)]						)


# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from packaging import version

from .. import __version__
from .constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD
from .doc import (
    add_code_sample_docstrings,
    add_end_docstrings,
    add_start_docstrings,
    add_start_docstrings_to_model_forward,
    copy_func,
    replace_return_docstrings,
)
from .generic import (
    ContextManagers,
    ExplicitEnum,
    ModelOutput,
    PaddingStrategy,
    TensorType,
    add_model_info_to_auto_map,
    cached_property,
    can_return_loss,
    expand_dims,
    find_labels,
    flatten_dict,
    infer_framework,
    is_jax_tensor,
    is_numpy_array,
    is_tensor,
    is_tf_symbolic_tensor,
    is_tf_tensor,
    is_torch_device,
    is_torch_dtype,
    is_torch_tensor,
    reshape,
    squeeze,
    strtobool,
    tensor_size,
    to_numpy,
    to_py_obj,
    transpose,
    working_or_temp_dir,
)
from .hub import (
    CLOUDFRONT_DISTRIB_PREFIX,
    DISABLE_TELEMETRY,
    HF_MODULES_CACHE,
    HUGGINGFACE_CO_PREFIX,
    HUGGINGFACE_CO_RESOLVE_ENDPOINT,
    PYTORCH_PRETRAINED_BERT_CACHE,
    PYTORCH_TRANSFORMERS_CACHE,
    S3_BUCKET_PREFIX,
    TRANSFORMERS_CACHE,
    TRANSFORMERS_DYNAMIC_MODULE_NAME,
    EntryNotFoundError,
    PushToHubMixin,
    RepositoryNotFoundError,
    RevisionNotFoundError,
    cached_file,
    default_cache_path,
    define_sagemaker_information,
    download_url,
    extract_commit_hash,
    get_cached_models,
    get_file_from_repo,
    get_full_repo_name,
    has_file,
    http_user_agent,
    is_offline_mode,
    is_remote_url,
    move_cache,
    send_example_telemetry,
    try_to_load_from_cache,
)
from .import_utils import (
    ENV_VARS_TRUE_AND_AUTO_VALUES,
    ENV_VARS_TRUE_VALUES,
    TORCH_FX_REQUIRED_VERSION,
    USE_JAX,
    USE_TF,
    USE_TORCH,
    DummyObject,
    OptionalDependencyNotAvailable,
    _LazyModule,
    ccl_version,
    direct_transformers_import,
    get_torch_version,
    is_accelerate_available,
    is_apex_available,
    is_bitsandbytes_available,
    is_bsa_available,
    is_coloredlogs_available,
    is_cython_available,
    is_datasets_available,
    is_decord_available,
    is_detectrona_available,
    is_faiss_available,
    is_flax_available,
    is_ftfy_available,
    is_in_notebook,
    is_ipex_available,
    is_jieba_available,
    is_jumanpp_available,
    is_kenlm_available,
    is_keras_nlp_available,
    is_librosa_available,
    is_natten_available,
    is_ninja_available,
    is_onnx_available,
    is_openai_available,
    is_optimum_available,
    is_pandas_available,
    is_peft_available,
    is_phonemizer_available,
    is_protobuf_available,
    is_psutil_available,
    is_pyanvml_available,
    is_pyctcdecode_available,
    is_pytesseract_available,
    is_pytest_available,
    is_pytorch_quantization_available,
    is_rjieba_available,
    is_sacremoses_available,
    is_safetensors_available,
    is_sagemaker_dp_enabled,
    is_sagemaker_mp_enabled,
    is_scipy_available,
    is_sentencepiece_available,
    is_seqio_available,
    is_sklearn_available,
    is_soundfile_availble,
    is_spacy_available,
    is_speech_available,
    is_sudachi_available,
    is_tensorflow_probability_available,
    is_tensorflow_text_available,
    is_tfaonnx_available,
    is_tf_available,
    is_timm_available,
    is_tokenizers_available,
    is_torch_available,
    is_torch_bfaa_available,
    is_torch_bfaa_cpu_available,
    is_torch_bfaa_gpu_available,
    is_torch_compile_available,
    is_torch_cuda_available,
    is_torch_fx_available,
    is_torch_fx_proxy,
    is_torch_mps_available,
    is_torch_neuroncore_available,
    is_torch_tensorrt_fx_available,
    is_torch_tfaa_available,
    is_torch_tpu_available,
    is_torchaudio_available,
    is_torchdistx_available,
    is_torchdynamo_available,
    is_torchvision_available,
    is_training_run_on_sagemaker,
    is_vision_available,
    requires_backends,
    torch_only_method,
)


SCREAMING_SNAKE_CASE							:Tuple										=    'pytorch_model.bin'
SCREAMING_SNAKE_CASE							:str										=    'pytorch_model.bin.index.json'
SCREAMING_SNAKE_CASE							:int										=    'adapter_config.json'
SCREAMING_SNAKE_CASE							:List[str]										=    'adapter_model.bin'
SCREAMING_SNAKE_CASE							:Any										=    'adapter_model.safetensors'
SCREAMING_SNAKE_CASE							:int										=    'tf_model.h5'
SCREAMING_SNAKE_CASE							:Tuple										=    'tf_model.h5.index.json'
SCREAMING_SNAKE_CASE							:List[Any]										=    'model.ckpt'
SCREAMING_SNAKE_CASE							:Optional[int]										=    'flax_model.msgpack'
SCREAMING_SNAKE_CASE							:List[Any]										=    'flax_model.msgpack.index.json'
SCREAMING_SNAKE_CASE							:List[Any]										=    'model.safetensors'
SCREAMING_SNAKE_CASE							:Any										=    'model.safetensors.index.json'
SCREAMING_SNAKE_CASE							:int										=    'config.json'
SCREAMING_SNAKE_CASE							:List[str]										=    'preprocessor_config.json'
SCREAMING_SNAKE_CASE							:Optional[int]										=    FEATURE_EXTRACTOR_NAME
SCREAMING_SNAKE_CASE							:Optional[Any]										=    'generation_config.json'
SCREAMING_SNAKE_CASE							:Dict										=    'modelcard.json'

SCREAMING_SNAKE_CASE							:Optional[Any]										=    '▁'
SCREAMING_SNAKE_CASE							:Any										=    SENTENCEPIECE_UNDERLINE  # Kept for backward compatibility

SCREAMING_SNAKE_CASE							:Tuple										=    [
    [[0, 1, 0, 1], [1, 0, 0, 1]]
] * 2  # Needs to have 0s and 1s only since XLM uses it for langs too.
SCREAMING_SNAKE_CASE							:Union[str, Any]										=    [[7, 6, 0, 0, 1], [1, 2, 3, 0, 0], [0, 0, 0, 4, 5]]
SCREAMING_SNAKE_CASE							:Tuple										=    [[1, 1, 1, 1, 1], [1, 1, 1, 0, 0], [0, 0, 0, 1, 1]]


def 						UpperCAmelCase      (     a_						)		->     List[str]:







				"""simple docstring"""



				if version.parse(a_						) < version.parse(a_						):
								if "dev" in min_version:
												__A             =			(
												    "This example requires a source install from HuggingFace Transformers (see "
												    "`https://huggingface.co/docs/transformers/installation#install-from-source`),"
												)
								else:
												__A             =			F'''This example requires a minimum version of {min_version},'''
								error_message += F''' but the version found is {__version__}.\n'''
								raise ImportError(
								    error_message
								    + "Check out https://github.com/huggingface/transformers/tree/main/examples#important-note for the examples corresponding to other "
								    "versions of HuggingFace Transformers."						)
