






'''simple docstring'''

import inspect
import unittest

from transformers import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

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 transformers import MODEL_MAPPING, GLPNConfig, GLPNForDepthEstimation, GLPNModel
						from transformers.models.glpn.modeling_glpn import GLPN_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
						from PIL import Image

						from transformers import GLPNImageProcessor






class 				__magic_name__  (						UpperCAmelCase_					):







	"""simple docstring"""



	def 							lowerCamelCase__		(				self							)    ->	str:
							lowercase_   : List[str]   	=      self.config_class(**self.inputs_dict							)
							self.parent.assertTrue(hasattr(_lowercase	,   'hidden_sizes'							)							)
							self.parent.assertTrue(hasattr(_lowercase	,   'num_attention_heads'							)							)
							self.parent.assertTrue(hasattr(_lowercase	,   'num_encoder_blocks'							)							)






class 				__magic_name__  :







	"""simple docstring"""



	def __init__(				self	,   _lowercase	,   _lowercase=13	,   _lowercase=64	,   _lowercase=3	,   _lowercase=4	,   _lowercase=[2, 2, 2, 2]	,   _lowercase=[8, 4, 2, 1]	,   _lowercase=[16, 32, 64, 128]	,   _lowercase=[1, 4, 8, 16]	,   _lowercase=[1, 2, 4, 8]	,   _lowercase=True	,   _lowercase=True	,   _lowercase="gelu"	,   _lowercase=0.1	,   _lowercase=0.1	,   _lowercase=0.02	,   _lowercase=16	,   _lowercase=3	,   _lowercase=None	,   )    ->	Dict:
							lowercase_   : Optional[int]   	=      parent
							lowercase_   : List[Any]   	=      batch_size
							lowercase_   : Tuple   	=      image_size
							lowercase_   : Optional[Any]   	=      num_channels
							lowercase_   : Optional[Any]   	=      num_encoder_blocks
							lowercase_   : List[Any]   	=      sr_ratios
							lowercase_   : Tuple   	=      depths
							lowercase_   : List[str]   	=      hidden_sizes
							lowercase_   : Any   	=      downsampling_rates
							lowercase_   : Optional[Any]   	=      num_attention_heads
							lowercase_   : Any   	=      is_training
							lowercase_   : Any   	=      use_labels
							lowercase_   : Optional[Any]   	=      hidden_act
							lowercase_   : List[str]   	=      hidden_dropout_prob
							lowercase_   : List[str]   	=      attention_probs_dropout_prob
							lowercase_   : Dict   	=      initializer_range
							lowercase_   : int   	=      decoder_hidden_size
							lowercase_   : List[Any]   	=      num_labels
							lowercase_   : Optional[int]   	=      scope
	def 							lowerCamelCase__		(				self							)    ->	Tuple:
							lowercase_   : List[Any]   	=      floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]							)

							lowercase_   : Union[str, Any]   	=      None
							if self.use_labels:
													lowercase_   : Optional[Any]   	=      ids_tensor([self.batch_size, self.image_size, self.image_size]	,   self.num_labels							)

							lowercase_   : int   	=      self.get_config()
							return config, pixel_values, labels
	def 							lowerCamelCase__		(				self							)    ->	Union[str, Any]:
							return GLPNConfig(
							    image_size=self.image_size	,   num_channels=self.num_channels	,   num_encoder_blocks=self.num_encoder_blocks	,   depths=self.depths	,   hidden_sizes=self.hidden_sizes	,   num_attention_heads=self.num_attention_heads	,   hidden_act=self.hidden_act	,   hidden_dropout_prob=self.hidden_dropout_prob	,   attention_probs_dropout_prob=self.attention_probs_dropout_prob	,   initializer_range=self.initializer_range	,   decoder_hidden_size=self.decoder_hidden_size	,   )
	def 							lowerCamelCase__		(				self	,   _lowercase	,   _lowercase	,   _lowercase							)    ->	Optional[int]:
							lowercase_   : List[Any]   	=      GLPNModel(config=_lowercase							)
							model.to(_lowercase							)
							model.eval()
							lowercase_   : List[str]   	=      model(_lowercase							)
							lowercase_   : List[Any]   	=      self.image_size // (self.downsampling_rates[-1] * 2)
							self.parent.assertEqual(
							    result.last_hidden_state.shape	,   (self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)							)
	def 							lowerCamelCase__		(				self	,   _lowercase	,   _lowercase	,   _lowercase							)    ->	Tuple:
							lowercase_   : Any   	=      self.num_labels
							lowercase_   : int   	=      GLPNForDepthEstimation(_lowercase							)
							model.to(_lowercase							)
							model.eval()
							lowercase_   : Optional[int]   	=      model(_lowercase							)
							self.parent.assertEqual(result.predicted_depth.shape	,   (self.batch_size, self.image_size, self.image_size)							)
							lowercase_   : List[Any]   	=      model(_lowercase	,   labels=_lowercase							)
							self.parent.assertEqual(result.predicted_depth.shape	,   (self.batch_size, self.image_size, self.image_size)							)







	def 							lowerCamelCase__		(				self							)    ->	Tuple:
							lowercase_   : Any   	=      self.prepare_config_and_inputs()
							lowercase_	,   lowercase_	,   lowercase_   : List[str]   	=      config_and_inputs
							lowercase_   : List[str]   	=      {'pixel_values': pixel_values}
							return config, inputs_dict






@require_torch
class 				__magic_name__  (						UpperCAmelCase_,    UpperCAmelCase_,    unittest.TestCase					):







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_       :   Optional[int]   =	(GLPNModel, GLPNForDepthEstimation) if is_torch_available() else ()
	SCREAMING_SNAKE_CASE_       :   Tuple   =	(
	    {'depth-estimation': GLPNForDepthEstimation, 'feature-extraction': GLPNModel} if is_torch_available() else {}
	)

	SCREAMING_SNAKE_CASE_       :   int   =	False
	SCREAMING_SNAKE_CASE_       :   Optional[int]   =	False
	SCREAMING_SNAKE_CASE_       :   Union[str, Any]   =	False
	def 							lowerCamelCase__		(				self							)    ->	Tuple:
							lowercase_   : List[Any]   	=      GLPNModelTester(self							)
							lowercase_   : Tuple   	=      GLPNConfigTester(self	,   config_class=_lowercase							)
	def 							lowerCamelCase__		(				self							)    ->	List[str]:
							self.config_tester.run_common_tests()
	def 							lowerCamelCase__		(				self							)    ->	Tuple:
							lowercase_   : str   	=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*_lowercase							)
	def 							lowerCamelCase__		(				self							)    ->	Dict:
							lowercase_   : Dict   	=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_depth_estimation(*_lowercase							)
	@unittest.skip('GLPN does not use inputs_embeds'							)
	def 							lowerCamelCase__		(				self							)    ->	Dict:
							pass
	@unittest.skip('GLPN does not have get_input_embeddings method and get_output_embeddings methods'							)
	def 							lowerCamelCase__		(				self							)    ->	str:
							pass
	def 							lowerCamelCase__		(				self							)    ->	Optional[int]:
							lowercase_	,   lowercase_   : str   	=      self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
													lowercase_   : Optional[int]   	=      model_class(_lowercase							)
													lowercase_   : Tuple   	=      inspect.signature(model.forward							)
													# signature.parameters is an OrderedDict => so arg_names order is deterministic
													lowercase_   : List[Any]   	=      [*signature.parameters.keys()]

													lowercase_   : int   	=      ['pixel_values']
													self.assertListEqual(arg_names[:1]	,   _lowercase							)
	def 							lowerCamelCase__		(				self							)    ->	List[Any]:
							lowercase_	,   lowercase_   : str   	=      self.model_tester.prepare_config_and_inputs_for_common()
							lowercase_   : int   	=      True

							for model_class in self.all_model_classes:
													lowercase_   : Optional[int]   	=      True
													lowercase_   : Optional[int]   	=      False
													lowercase_   : Tuple   	=      True
													lowercase_   : int   	=      model_class(_lowercase							)
													model.to(_lowercase							)
													model.eval()
													with torch.no_grad():
																			lowercase_   : Any   	=      model(**self._prepare_for_class(_lowercase	,   _lowercase							)							)
													lowercase_   : Union[str, Any]   	=      outputs.attentions

													lowercase_   : Union[str, Any]   	=      sum(self.model_tester.depths							)
													self.assertEqual(len(_lowercase							)	,   _lowercase							)

													# check that output_attentions also work using config
													del inputs_dict["output_attentions"]
													lowercase_   : Tuple   	=      True
													lowercase_   : List[Any]   	=      model_class(_lowercase							)
													model.to(_lowercase							)
													model.eval()
													with torch.no_grad():
																			lowercase_   : List[str]   	=      model(**self._prepare_for_class(_lowercase	,   _lowercase							)							)
													lowercase_   : str   	=      outputs.attentions

													self.assertEqual(len(_lowercase							)	,   _lowercase							)

													# verify the first attentions (first block, first layer)
													lowercase_   : Any   	=      (self.model_tester.image_size // 4) ** 2
													lowercase_   : List[Any]   	=      (self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
													self.assertListEqual(
													    list(attentions[0].shape[-3:]							)	,   [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]	,   )

													# verify the last attentions (last block, last layer)
													lowercase_   : int   	=      (self.model_tester.image_size // 32) ** 2
													lowercase_   : Dict   	=      (self.model_tester.image_size // (32 * self.model_tester.sr_ratios[-1])) ** 2
													self.assertListEqual(
													    list(attentions[-1].shape[-3:]							)	,   [self.model_tester.num_attention_heads[-1], expected_seq_len, expected_reduced_seq_len]	,   )
													lowercase_   : int   	=      len(_lowercase							)

													# Check attention is always last and order is fine
													lowercase_   : List[str]   	=      True
													lowercase_   : Tuple   	=      True
													lowercase_   : Tuple   	=      model_class(_lowercase							)
													model.to(_lowercase							)
													model.eval()
													with torch.no_grad():
																			lowercase_   : List[str]   	=      model(**self._prepare_for_class(_lowercase	,   _lowercase							)							)

													self.assertEqual(out_len + 1	,   len(_lowercase							)							)

													lowercase_   : Any   	=      outputs.attentions

													self.assertEqual(len(_lowercase							)	,   _lowercase							)
													# verify the first attentions (first block, first layer)
													lowercase_   : List[str]   	=      (self.model_tester.image_size // 4) ** 2
													lowercase_   : List[str]   	=      (self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
													self.assertListEqual(
													    list(self_attentions[0].shape[-3:]							)	,   [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len]	,   )
	def 							lowerCamelCase__		(				self							)    ->	Tuple:
							def check_hidden_states_output(_lowercase	,   _lowercase	,   _lowercase							):
													lowercase_   : Optional[Any]   	=      model_class(_lowercase							)
													model.to(_lowercase							)
													model.eval()

													with torch.no_grad():
																			lowercase_   : Optional[int]   	=      model(**self._prepare_for_class(_lowercase	,   _lowercase							)							)

													lowercase_   : List[str]   	=      outputs.hidden_states

													lowercase_   : Optional[int]   	=      self.model_tester.num_encoder_blocks
													self.assertEqual(len(_lowercase							)	,   _lowercase							)

													# verify the first hidden states (first block)
													self.assertListEqual(
													    list(hidden_states[0].shape[-3:]							)	,   [
													        self.model_tester.hidden_sizes[0],
													        self.model_tester.image_size // 4,
													        self.model_tester.image_size // 4,
													    ]	,   )

							lowercase_	,   lowercase_   : List[Any]   	=      self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
													lowercase_   : Tuple   	=      True
													check_hidden_states_output(_lowercase	,   _lowercase	,   _lowercase							)

													# check that output_hidden_states also work using config
													del inputs_dict["output_hidden_states"]
													lowercase_   : Union[str, Any]   	=      True

													check_hidden_states_output(_lowercase	,   _lowercase	,   _lowercase							)
	def 							lowerCamelCase__		(				self							)    ->	str:
							if not self.model_tester.is_training:
													return

							lowercase_	,   lowercase_   : List[str]   	=      self.model_tester.prepare_config_and_inputs_for_common()
							lowercase_   : List[str]   	=      True

							for model_class in self.all_model_classes:
													if model_class in get_values(_lowercase							):
																			continue
													# TODO: remove the following 3 lines once we have a MODEL_FOR_DEPTH_ESTIMATION_MAPPING
													# this can then be incorporated into _prepare_for_class in test_modeling_common.py
													if model_class.__name__ == "GLPNForDepthEstimation":
																			lowercase_	,   lowercase_	,   lowercase_	,   lowercase_   : Optional[Any]   	=      inputs_dict['pixel_values'].shape
																			lowercase_   : Tuple   	=      torch.zeros(
																			    [self.model_tester.batch_size, height, width]	,   device=_lowercase							).long()
													lowercase_   : List[Any]   	=      model_class(_lowercase							)
													model.to(_lowercase							)
													model.train()
													lowercase_   : str   	=      self._prepare_for_class(_lowercase	,   _lowercase	,   return_labels=_lowercase							)
													lowercase_   : int   	=      model(**_lowercase							).loss
													loss.backward()







	@slow
	def 							lowerCamelCase__		(				self							)    ->	List[Any]:
							for model_name in GLPN_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
													lowercase_   : Dict   	=      GLPNModel.from_pretrained(_lowercase							)
													self.assertIsNotNone(_lowercase							)






def 						_UpperCAmelCase     (	)      ->      Optional[int]:





						"""simple docstring"""
						lowercase_   : Union[str, Any]   	=      Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'				)
						return image






@require_torch
@require_vision
@slow
class 				__magic_name__  (						unittest.TestCase					):







	"""simple docstring"""



	@slow
	def 							lowerCamelCase__		(				self							)    ->	List[str]:
							lowercase_   : Optional[Any]   	=      GLPNImageProcessor.from_pretrained(GLPN_PRETRAINED_MODEL_ARCHIVE_LIST[0]							)
							lowercase_   : int   	=      GLPNForDepthEstimation.from_pretrained(GLPN_PRETRAINED_MODEL_ARCHIVE_LIST[0]							).to(_lowercase							)

							lowercase_   : Dict   	=      prepare_img()
							lowercase_   : List[Any]   	=      image_processor(images=_lowercase	,   return_tensors='pt'							).to(_lowercase							)

							# forward pass
							with torch.no_grad():
													lowercase_   : List[str]   	=      model(**_lowercase							)

							# verify the predicted depth
							lowercase_   : int   	=      torch.Size([1, 480, 640]							)
							self.assertEqual(outputs.predicted_depth.shape	,   _lowercase							)

							lowercase_   : Union[str, Any]   	=      torch.tensor(
							    [[3.42_91, 2.78_65, 2.51_51], [3.28_41, 2.70_21, 2.35_02], [3.11_47, 2.46_25, 2.24_81]]							).to(_lowercase							)

							self.assertTrue(torch.allclose(outputs.predicted_depth[0, :3, :3]	,   _lowercase	,   atol=1E-4							)							)








'''simple docstring'''

import importlib
import os
import platform
from pathlib import Path

from packaging import version

from .utils.logging import get_logger


A:   str						=					get_logger(__name__)

# Datasets
A:   Optional[Any]						=					"https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets"
A:   Any						=					"https://cdn-datasets.huggingface.co/datasets/datasets"
A:   Dict						=					"https://raw.githubusercontent.com/huggingface/datasets/{revision}/datasets/{path}/{name}"

# Metrics
A:   List[str]						=					"https://s3.amazonaws.com/datasets.huggingface.co/datasets/metrics"
A:   Any						=					"https://cdn-datasets.huggingface.co/datasets/metric"
A:   List[str]						=					"https://raw.githubusercontent.com/huggingface/datasets/{revision}/metrics/{path}/{name}"

# Hub
A:   str						=					os.environ.get("HF_ENDPOINT", "https://huggingface.co")
A:   List[Any]						=					HF_ENDPOINT + "/datasets/{repo_id}/resolve/{revision}/{path}"
A:   List[Any]						=					"main"

A:   Any						=					version.parse(platform.python_version())

if PY_VERSION < version.parse("3.8"):
						import importlib_metadata
else:
						import importlib.metadata as importlib_metadata

# General environment variables accepted values for booleans
A:   Optional[Any]						=					{"1", "ON", "YES", "TRUE"}
A:   Optional[int]						=					ENV_VARS_TRUE_VALUES.union({"AUTO"})


# Imports
A:   Any						=					version.parse(importlib_metadata.version("dill"))
A:   str						=					version.parse(importlib_metadata.version("pandas"))
A:   Tuple						=					version.parse(importlib_metadata.version("pyarrow"))

A:   str						=					os.environ.get("USE_TF", "AUTO").upper()
A:   List[Any]						=					os.environ.get("USE_TORCH", "AUTO").upper()
A:   Union[str, Any]						=					os.environ.get("USE_JAX", "AUTO").upper()

A:   Dict						=					"N/A"
A:   Optional[int]						=					False

if USE_TORCH in ENV_VARS_TRUE_AND_AUTO_VALUES and USE_TF not in ENV_VARS_TRUE_VALUES:
						A:   List[str]						=					importlib.util.find_spec("torch") is not None
						if TORCH_AVAILABLE:
												try:
																		A:   List[str]						=					version.parse(importlib_metadata.version("torch"))
																		logger.info(f"""PyTorch version {TORCH_VERSION} available.""")
												except importlib_metadata.PackageNotFoundError:
																		pass
else:
						logger.info("Disabling PyTorch because USE_TF is set")

A:   Union[str, Any]						=					"N/A"
A:   Dict						=					False

if USE_TF in ENV_VARS_TRUE_AND_AUTO_VALUES and USE_TORCH not in ENV_VARS_TRUE_VALUES:
						A:   Optional[Any]						=					importlib.util.find_spec("tensorflow") is not None
						if TF_AVAILABLE:
												# For the metadata, we have to look for both tensorflow and tensorflow-cpu
												for package in [
												    "tensorflow",
												    "tensorflow-cpu",
												    "tensorflow-gpu",
												    "tf-nightly",
												    "tf-nightly-cpu",
												    "tf-nightly-gpu",
												    "intel-tensorflow",
												    "tensorflow-rocm",
												    "tensorflow-macos",
												]:
																		try:
																								A:   Any						=					version.parse(importlib_metadata.version(package))
																		except importlib_metadata.PackageNotFoundError:
																								continue
																		else:
																								break
												else:
																		A:   Any						=					False
						if TF_AVAILABLE:
												if TF_VERSION.major < 2:
																		logger.info(f"""TensorFlow found but with version {TF_VERSION}. `datasets` requires version 2 minimum.""")
																		A:   Tuple						=					False
												else:
																		logger.info(f"""TensorFlow version {TF_VERSION} available.""")
else:
						logger.info("Disabling Tensorflow because USE_TORCH is set")


A:   Any						=					"N/A"
A:   int						=					False

if USE_JAX in ENV_VARS_TRUE_AND_AUTO_VALUES:
						A:   Dict						=					importlib.util.find_spec("jax") is not None and importlib.util.find_spec("jaxlib") is not None
						if JAX_AVAILABLE:
												try:
																		A:   List[str]						=					version.parse(importlib_metadata.version("jax"))
																		logger.info(f"""JAX version {JAX_VERSION} available.""")
												except importlib_metadata.PackageNotFoundError:
																		pass
else:
						logger.info("Disabling JAX because USE_JAX is set to False")


A:   Optional[Any]						=					os.environ.get("USE_BEAM", "AUTO").upper()
A:   Any						=					"N/A"
A:   List[Any]						=					False
if USE_BEAM in ENV_VARS_TRUE_AND_AUTO_VALUES:
						try:
												A:   Tuple						=					version.parse(importlib_metadata.version("apache_beam"))
												A:   Dict						=					True
												logger.info(f"""Apache Beam version {BEAM_VERSION} available.""")
						except importlib_metadata.PackageNotFoundError:
												pass
else:
						logger.info("Disabling Apache Beam because USE_BEAM is set to False")


# Optional tools for data loading
A:   Union[str, Any]						=					importlib.util.find_spec("sqlalchemy") is not None

# Optional tools for feature decoding
A:   Optional[int]						=					importlib.util.find_spec("PIL") is not None
A:   Dict						=					importlib.util.find_spec("soundfile") is not None and version.parse(
    importlib.import_module("soundfile").__libsndfile_version__
) >= version.parse("1.0.31")
A:   Any						=					importlib.util.find_spec("soundfile") is not None and version.parse(
    importlib.import_module("soundfile").__libsndfile_version__
) >= version.parse("1.1.0")

# Optional compression tools
A:   Optional[Any]						=					importlib.util.find_spec("rarfile") is not None
A:   Any						=					importlib.util.find_spec("zstandard") is not None
A:   Union[str, Any]						=					importlib.util.find_spec("lz4") is not None
A:   str						=					importlib.util.find_spec("py7zr") is not None


# Cache location
A:   Any						=					"~/.cache"
A:   Tuple						=					os.getenv("XDG_CACHE_HOME", DEFAULT_XDG_CACHE_HOME)
A:   Dict						=					os.path.join(XDG_CACHE_HOME, "huggingface")
A:   List[str]						=					os.path.expanduser(os.getenv("HF_HOME", DEFAULT_HF_CACHE_HOME))

A:   int						=					os.path.join(HF_CACHE_HOME, "datasets")
A:   int						=					Path(os.getenv("HF_DATASETS_CACHE", DEFAULT_HF_DATASETS_CACHE))

A:   int						=					os.path.join(HF_CACHE_HOME, "metrics")
A:   int						=					Path(os.getenv("HF_METRICS_CACHE", DEFAULT_HF_METRICS_CACHE))

A:   Any						=					os.path.join(HF_CACHE_HOME, "modules")
A:   Tuple						=					Path(os.getenv("HF_MODULES_CACHE", DEFAULT_HF_MODULES_CACHE))

A:   List[str]						=					"downloads"
A:   Tuple						=					os.path.join(HF_DATASETS_CACHE, DOWNLOADED_DATASETS_DIR)
A:   Union[str, Any]						=					Path(os.getenv("HF_DATASETS_DOWNLOADED_DATASETS_PATH", DEFAULT_DOWNLOADED_DATASETS_PATH))

A:   Tuple						=					"extracted"
A:   Optional[int]						=					os.path.join(DEFAULT_DOWNLOADED_DATASETS_PATH, EXTRACTED_DATASETS_DIR)
A:   Optional[int]						=					Path(os.getenv("HF_DATASETS_EXTRACTED_DATASETS_PATH", DEFAULT_EXTRACTED_DATASETS_PATH))

# Download count for the website
A:   Union[str, Any]						=					(
    os.environ.get("HF_UPDATE_DOWNLOAD_COUNTS", "AUTO").upper() in ENV_VARS_TRUE_AND_AUTO_VALUES
)

# Batch size constants. For more info, see:
# https://github.com/apache/arrow/blob/master/docs/source/cpp/arrays.rst#size-limitations-and-recommendations)
A:   List[str]						=					1_0_0_0

# Size of the preloaded record batch in `Dataset.__iter__`
A:   Tuple						=					1_0

# Pickling tables works only for small tables (<4GiB)
# For big tables, we write them on disk instead
A:   List[Any]						=					4 << 3_0

# Max shard size in bytes (e.g. to shard parquet datasets in push_to_hub or download_and_prepare)
A:   List[str]						=					"500MB"

# Parquet configuration
A:   Union[str, Any]						=					1_0_0
A:   Optional[int]						=					1_0_0
A:   Any						=					1_0_0

# Offline mode
A:   List[str]						=					os.environ.get("HF_DATASETS_OFFLINE", "AUTO").upper() in ENV_VARS_TRUE_VALUES

# In-memory
A:   Any						=					0  # Disabled
A:   List[str]						=					float(os.environ.get("HF_DATASETS_IN_MEMORY_MAX_SIZE", DEFAULT_IN_MEMORY_MAX_SIZE))

# File names
A:   List[str]						=					"dataset.arrow"
A:   Optional[int]						=					"indices.arrow"
A:   List[str]						=					"state.json"
A:   Tuple						=					"dataset_info.json"
A:   Tuple						=					"dataset_infos.json"
A:   Dict						=					"LICENSE"
A:   Optional[Any]						=					"metric_info.json"
A:   Any						=					"dataset_dict.json"

A:   Dict						=					"datasets_modules"

A:   List[str]						=					2_5_5

# Streaming
A:   Any						=					2_0
A:   Dict						=					5

# Datasets without script
A:   Union[str, Any]						=					2_0_0
A:   Union[str, Any]						=					1_0
A:   List[Any]						=					2_0_0

# Progress bars
A:   Tuple						=					0.05  # 20 progress updates per sec
