




import unittest

from parameterized import parameterized

from transformers import OpenLlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
	import torch

	from transformers import OpenLlamaForCausalLM, OpenLlamaForSequenceClassification, OpenLlamaModel


class    SCREAMING_SNAKE_CASE_				:



	"""simple docstring"""


	def __init__(					self		:						Any					,     lowerCAmelCase		:						List[Any]					,     lowerCAmelCase		:						int=13					,     lowerCAmelCase		:						str=7					,     lowerCAmelCase		:						Optional[Any]=True					,     lowerCAmelCase		:						Optional[int]=True					,     lowerCAmelCase		:						List[Any]=False					,     lowerCAmelCase		:						int=True					,     lowerCAmelCase		:						int=99					,     lowerCAmelCase		:						Any=32					,     lowerCAmelCase		:						Optional[int]=5					,     lowerCAmelCase		:						Optional[int]=4					,     lowerCAmelCase		:						List[str]=37					,     lowerCAmelCase		:						int="gelu"					,     lowerCAmelCase		:						List[Any]=0.1					,     lowerCAmelCase		:						str=0.1					,     lowerCAmelCase		:						str=512					,     lowerCAmelCase		:						Union[str, Any]=16					,     lowerCAmelCase		:						List[Any]=2					,     lowerCAmelCase		:						List[Any]=0.02					,     lowerCAmelCase		:						int=3					,     lowerCAmelCase		:						Optional[Any]=4					,     lowerCAmelCase		:						List[Any]=None					,     )	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      parent
						__UpperCamelCase					:	str             =      batch_size
						__UpperCamelCase					:	Dict             =      seq_length
						__UpperCamelCase					:	Optional[Any]             =      is_training
						__UpperCamelCase					:	List[Any]             =      use_input_mask
						__UpperCamelCase					:	int             =      use_token_type_ids
						__UpperCamelCase					:	str             =      use_labels
						__UpperCamelCase					:	List[str]             =      vocab_size
						__UpperCamelCase					:	Optional[Any]             =      hidden_size
						__UpperCamelCase					:	Union[str, Any]             =      num_hidden_layers
						__UpperCamelCase					:	Optional[Any]             =      num_attention_heads
						__UpperCamelCase					:	List[str]             =      intermediate_size
						__UpperCamelCase					:	Optional[int]             =      hidden_act
						__UpperCamelCase					:	Optional[int]             =      hidden_dropout_prob
						__UpperCamelCase					:	int             =      attention_probs_dropout_prob
						__UpperCamelCase					:	int             =      max_position_embeddings
						__UpperCamelCase					:	List[Any]             =      type_vocab_size
						__UpperCamelCase					:	Tuple             =      type_sequence_label_size
						__UpperCamelCase					:	str             =      initializer_range
						__UpperCamelCase					:	Optional[Any]             =      num_labels
						__UpperCamelCase					:	Optional[Any]             =      num_choices
						__UpperCamelCase					:	List[Any]             =      scope






	def 					lowerCamelCase__     (					self		:						Optional[Any]	)	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      ids_tensor([self.batch_size, self.seq_length]					,     self.vocab_size	)

						__UpperCamelCase					:	Any             =      None
						if self.use_input_mask:
											__UpperCamelCase					:	List[Any]             =      random_attention_mask([self.batch_size, self.seq_length]	)

						__UpperCamelCase					:	List[Any]             =      None
						if self.use_token_type_ids:
											__UpperCamelCase					:	Dict             =      ids_tensor([self.batch_size, self.seq_length]					,     self.type_vocab_size	)

						__UpperCamelCase					:	List[Any]             =      None
						__UpperCamelCase					:	List[Any]             =      None
						__UpperCamelCase					:	Optional[int]             =      None
						if self.use_labels:
											__UpperCamelCase					:	Optional[Any]             =      ids_tensor([self.batch_size]					,     self.type_sequence_label_size	)
											__UpperCamelCase					:	List[Any]             =      ids_tensor([self.batch_size, self.seq_length]					,     self.num_labels	)
											__UpperCamelCase					:	List[str]             =      ids_tensor([self.batch_size]					,     self.num_choices	)

						__UpperCamelCase					:	str             =      self.get_config()

						return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels






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







						"""simple docstring"""







						return OpenLlamaConfig(
						    vocab_size=self.vocab_size					,     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					,     max_position_embeddings=self.max_position_embeddings					,     type_vocab_size=self.type_vocab_size					,     is_decoder=lowerCAmelCase					,     initializer_range=self.initializer_range					,     use_stable_embedding=lowerCAmelCase					,     )






	def 					lowerCamelCase__     (					self		:						Dict					,     lowerCAmelCase		:						Dict					,     lowerCAmelCase		:						Tuple					,     lowerCAmelCase		:						Any					,     lowerCAmelCase		:						Any					,     lowerCAmelCase		:						List[str]					,     lowerCAmelCase		:						str					,     lowerCAmelCase		:						List[Any]	)	->       Union[str, Any]:







						"""simple docstring"""







						__UpperCamelCase					:	List[Any]             =      OpenLlamaModel(config=lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()
						__UpperCamelCase					:	Optional[int]             =      model(lowerCAmelCase					,     attention_mask=lowerCAmelCase	)
						__UpperCamelCase					:	Union[str, Any]             =      model(lowerCAmelCase	)
						self.parent.assertEqual(result.last_hidden_state.shape					,     (self.batch_size, self.seq_length, self.hidden_size)	)






	def 					lowerCamelCase__     (					self		:						Optional[int]					,     lowerCAmelCase		:						Optional[int]					,     lowerCAmelCase		:						Union[str, Any]					,     lowerCAmelCase		:						List[str]					,     lowerCAmelCase		:						Any					,     lowerCAmelCase		:						List[str]					,     lowerCAmelCase		:						int					,     lowerCAmelCase		:						Dict					,     lowerCAmelCase		:						Union[str, Any]					,     lowerCAmelCase		:						Optional[Any]					,     )	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	Tuple             =      True
						__UpperCamelCase					:	List[Any]             =      OpenLlamaModel(lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()
						__UpperCamelCase					:	Dict             =      model(
						    lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     encoder_hidden_states=lowerCAmelCase					,     encoder_attention_mask=lowerCAmelCase					,     )
						__UpperCamelCase					:	List[Any]             =      model(
						    lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     encoder_hidden_states=lowerCAmelCase					,     )
						__UpperCamelCase					:	Optional[int]             =      model(lowerCAmelCase					,     attention_mask=lowerCAmelCase	)
						self.parent.assertEqual(result.last_hidden_state.shape					,     (self.batch_size, self.seq_length, self.hidden_size)	)






	def 					lowerCamelCase__     (					self		:						Optional[int]					,     lowerCAmelCase		:						int					,     lowerCAmelCase		:						Optional[int]					,     lowerCAmelCase		:						List[Any]					,     lowerCAmelCase		:						List[Any]					,     lowerCAmelCase		:						Dict					,     lowerCAmelCase		:						List[str]					,     lowerCAmelCase		:						List[str]					,     lowerCAmelCase		:						Dict					,     lowerCAmelCase		:						Optional[int]					,     )	->       Union[str, Any]:







						"""simple docstring"""







						__UpperCamelCase					:	Optional[Any]             =      OpenLlamaForCausalLM(config=lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()
						__UpperCamelCase					:	int             =      model(lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     labels=lowerCAmelCase	)
						self.parent.assertEqual(result.logits.shape					,     (self.batch_size, self.seq_length, self.vocab_size)	)






	def 					lowerCamelCase__     (					self		:						Dict					,     lowerCAmelCase		:						List[Any]					,     lowerCAmelCase		:						Optional[Any]					,     lowerCAmelCase		:						Optional[int]					,     lowerCAmelCase		:						Optional[int]					,     lowerCAmelCase		:						str					,     lowerCAmelCase		:						Any					,     lowerCAmelCase		:						Optional[Any]					,     lowerCAmelCase		:						Optional[Any]					,     lowerCAmelCase		:						int					,     )	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	str             =      True
						__UpperCamelCase					:	int             =      True
						__UpperCamelCase					:	Optional[int]             =      OpenLlamaForCausalLM(config=lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()

						# first forward pass
						__UpperCamelCase					:	Optional[int]             =      model(
						    lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     encoder_hidden_states=lowerCAmelCase					,     encoder_attention_mask=lowerCAmelCase					,     use_cache=lowerCAmelCase					,     )
						__UpperCamelCase					:	List[str]             =      outputs.past_key_values

						# create hypothetical multiple next token and extent to next_input_ids
						__UpperCamelCase					:	str             =      ids_tensor((self.batch_size, 3)					,     config.vocab_size	)
						__UpperCamelCase					:	List[str]             =      ids_tensor((self.batch_size, 3)					,     vocab_size=2	)

						# append to next input_ids and
						__UpperCamelCase					:	Tuple             =      torch.cat([input_ids, next_tokens]					,     dim=-1	)
						__UpperCamelCase					:	List[Any]             =      torch.cat([input_mask, next_mask]					,     dim=-1	)

						__UpperCamelCase					:	Dict             =      model(
						    lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     encoder_hidden_states=lowerCAmelCase					,     encoder_attention_mask=lowerCAmelCase					,     output_hidden_states=lowerCAmelCase					,     )["""hidden_states"""][0]
						__UpperCamelCase					:	Dict             =      model(
						    lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     encoder_hidden_states=lowerCAmelCase					,     encoder_attention_mask=lowerCAmelCase					,     past_key_values=lowerCAmelCase					,     output_hidden_states=lowerCAmelCase					,     )["""hidden_states"""][0]

						# select random slice
						__UpperCamelCase					:	List[str]             =      ids_tensor((1,)					,     output_from_past.shape[-1]	).item()
						__UpperCamelCase					:	Dict             =      output_from_no_past[:, -3:, random_slice_idx].detach()
						__UpperCamelCase					:	int             =      output_from_past[:, :, random_slice_idx].detach()

						self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]	)

						# test that outputs are equal for slice
						self.parent.assertTrue(torch.allclose(lowerCAmelCase					,     lowerCAmelCase					,     atol=1E-3	)	)






	def 					lowerCamelCase__     (					self		:						Optional[int]	)	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase					:	int             =      self.prepare_config_and_inputs()
						(
						    (
						    __UpperCamelCase
						)      ,			(
						    __UpperCamelCase
						)      ,			(
						    __UpperCamelCase
						)      ,			(
						    __UpperCamelCase
						)      ,			(
						    __UpperCamelCase
						)      ,			(
						    __UpperCamelCase
						)      ,			(
						    __UpperCamelCase
						)      ,			
						)					:	Optional[int]             =      config_and_inputs
						__UpperCamelCase					:	Tuple             =      {"""input_ids""": input_ids, """attention_mask""": input_mask}
						return config, inputs_dict






@require_torch
class    SCREAMING_SNAKE_CASE_				(       _UpperCamelCase	,  _UpperCamelCase	,  _UpperCamelCase	,  unittest.TestCase   ):



	"""simple docstring"""


	__magic_name__   :       Tuple      	=		(
	    (OpenLlamaModel, OpenLlamaForCausalLM, OpenLlamaForSequenceClassification) if is_torch_available() else ()
	)
	__magic_name__   :       int      	=		(OpenLlamaForCausalLM,) if is_torch_available() else ()
	__magic_name__   :       Tuple      	=		(
	    {
	        'feature-extraction': OpenLlamaModel,
	        'text-classification': OpenLlamaForSequenceClassification,
	        'text-generation': OpenLlamaForCausalLM,
	        'zero-shot': OpenLlamaForSequenceClassification,
	    }
	    if is_torch_available()
	    else {}
	)
	__magic_name__   :       Optional[int]      	=		False
	__magic_name__   :       Tuple      	=		False






	def 					lowerCamelCase__     (					self		:						Optional[Any]	)	->       Union[str, Any]:







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      OpenLlamaModelTester(self	)
						__UpperCamelCase					:	Tuple             =      ConfigTester(self					,     config_class=lowerCAmelCase					,     hidden_size=37	)






	def 					lowerCamelCase__     (					self		:						List[Any]	)	->       Dict:







						"""simple docstring"""







						self.config_tester.run_common_tests()






	def 					lowerCamelCase__     (					self		:						Dict	)	->       Tuple:







						"""simple docstring"""







						__UpperCamelCase					:	Any             =      self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_model(*lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						str	)	->       Tuple:







						"""simple docstring"""







						__UpperCamelCase					:	Dict             =      self.model_tester.prepare_config_and_inputs()
						for type in ["absolute", "relative_key", "relative_key_query"]:
											__UpperCamelCase					:	List[Any]             =      type
											self.model_tester.create_and_check_model(*lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						Optional[Any]	)	->       Tuple:







						"""simple docstring"""







						__UpperCamelCase      ,			__UpperCamelCase					:	Dict             =      self.model_tester.prepare_config_and_inputs_for_common()
						__UpperCamelCase					:	int             =      3
						__UpperCamelCase					:	Union[str, Any]             =      input_dict["""input_ids"""]
						__UpperCamelCase					:	int             =      input_ids.ne(1	).to(lowerCAmelCase	)
						__UpperCamelCase					:	Dict             =      ids_tensor([self.model_tester.batch_size]					,     self.model_tester.type_sequence_label_size	)
						__UpperCamelCase					:	Optional[Any]             =      OpenLlamaForSequenceClassification(lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()
						__UpperCamelCase					:	Union[str, Any]             =      model(lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     labels=lowerCAmelCase	)
						self.assertEqual(result.logits.shape					,     (self.model_tester.batch_size, self.model_tester.num_labels)	)






	def 					lowerCamelCase__     (					self		:						Any	)	->       str:







						"""simple docstring"""







						__UpperCamelCase      ,			__UpperCamelCase					:	Optional[Any]             =      self.model_tester.prepare_config_and_inputs_for_common()
						__UpperCamelCase					:	int             =      3
						__UpperCamelCase					:	Dict             =      """single_label_classification"""
						__UpperCamelCase					:	Tuple             =      input_dict["""input_ids"""]
						__UpperCamelCase					:	Any             =      input_ids.ne(1	).to(lowerCAmelCase	)
						__UpperCamelCase					:	Tuple             =      ids_tensor([self.model_tester.batch_size]					,     self.model_tester.type_sequence_label_size	)
						__UpperCamelCase					:	Optional[int]             =      OpenLlamaForSequenceClassification(lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()
						__UpperCamelCase					:	Union[str, Any]             =      model(lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     labels=lowerCAmelCase	)
						self.assertEqual(result.logits.shape					,     (self.model_tester.batch_size, self.model_tester.num_labels)	)






	def 					lowerCamelCase__     (					self		:						Optional[int]	)	->       Optional[Any]:







						"""simple docstring"""







						__UpperCamelCase      ,			__UpperCamelCase					:	Tuple             =      self.model_tester.prepare_config_and_inputs_for_common()
						__UpperCamelCase					:	Optional[int]             =      3
						__UpperCamelCase					:	Dict             =      """multi_label_classification"""
						__UpperCamelCase					:	List[str]             =      input_dict["""input_ids"""]
						__UpperCamelCase					:	Any             =      input_ids.ne(1	).to(lowerCAmelCase	)
						__UpperCamelCase					:	List[Any]             =      ids_tensor(
						    [self.model_tester.batch_size, config.num_labels]					,     self.model_tester.type_sequence_label_size	).to(torch.float	)
						__UpperCamelCase					:	int             =      OpenLlamaForSequenceClassification(lowerCAmelCase	)
						model.to(lowerCAmelCase	)
						model.eval()
						__UpperCamelCase					:	List[str]             =      model(lowerCAmelCase					,     attention_mask=lowerCAmelCase					,     labels=lowerCAmelCase	)
						self.assertEqual(result.logits.shape					,     (self.model_tester.batch_size, self.model_tester.num_labels)	)






	@unittest.skip("""Open-Llama buffers include complex numbers, which breaks this test"""	)
	def 					lowerCamelCase__     (					self		:						int	)	->       Optional[Any]:







						"""simple docstring"""







						pass






	@parameterized.expand([("""linear""",), ("""dynamic""",)]	)
	def 					lowerCamelCase__     (					self		:						int					,     lowerCAmelCase		:						Union[str, Any]	)	->       Optional[int]:







						"""simple docstring"""







						__UpperCamelCase      ,			__UpperCamelCase					:	int             =      self.model_tester.prepare_config_and_inputs_for_common()
						__UpperCamelCase					:	Any             =      ids_tensor([1, 10]					,     config.vocab_size	)
						__UpperCamelCase					:	Any             =      ids_tensor([1, int(config.max_position_embeddings * 1.5	)]					,     config.vocab_size	)

						set_seed(42	)  # Fixed seed at init time so the two models get the same random weights
						__UpperCamelCase					:	Dict             =      OpenLlamaModel(lowerCAmelCase	)
						original_model.to(lowerCAmelCase	)
						original_model.eval()
						__UpperCamelCase					:	List[Any]             =      original_model(lowerCAmelCase	).last_hidden_state
						__UpperCamelCase					:	Optional[Any]             =      original_model(lowerCAmelCase	).last_hidden_state

						set_seed(42	)  # Fixed seed at init time so the two models get the same random weights
						__UpperCamelCase					:	Optional[Any]             =      {"""type""": scaling_type, """factor""": 10.0}
						__UpperCamelCase					:	List[str]             =      OpenLlamaModel(lowerCAmelCase	)
						scaled_model.to(lowerCAmelCase	)
						scaled_model.eval()
						__UpperCamelCase					:	int             =      scaled_model(lowerCAmelCase	).last_hidden_state
						__UpperCamelCase					:	Any             =      scaled_model(lowerCAmelCase	).last_hidden_state

						# Dynamic scaling does not change the RoPE embeddings until it receives an input longer than the original
						# maximum sequence length, so the outputs for the short input should match.
						if scaling_type == "dynamic":
											self.assertTrue(torch.allclose(lowerCAmelCase					,     lowerCAmelCase					,     atol=1E-5	)	)
						else:
											self.assertFalse(torch.allclose(lowerCAmelCase					,     lowerCAmelCase					,     atol=1E-5	)	)

						# The output should be different for long inputs
						self.assertFalse(torch.allclose(lowerCAmelCase					,     lowerCAmelCase					,     atol=1E-5	)	)












import logging
import os
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

from tqdm import auto as tqdm_lib


a__		     =     {
    '''debug''': logging.DEBUG,
    '''info''': logging.INFO,
    '''warning''': logging.WARNING,
    '''error''': logging.ERROR,
    '''critical''': logging.CRITICAL,
}

a__		     =     logging.WARNING





def 				A__ ()     ->						Any:
					__UpperCamelCase					:	Union[str, Any]             =      os.getenv("""DATASETS_VERBOSITY"""		,	snake_case				)
					if env_level_str:
										if env_level_str in log_levels:
															return log_levels[env_level_str]
										else:
															logging.getLogger().warning(
															    F'''Unknown option DATASETS_VERBOSITY={env_level_str}, '''
															    F'''has to be one of: { ", ".join(log_levels.keys()				) }'''				)
					return _default_log_level





def 				A__ ()     ->						str:
					return __name__.split("""."""				)[0]





def 				A__ ()     ->						logging.Logger:
					return logging.getLogger(_get_library_name()				)





def 				A__ ()     ->						None:
					# Apply our default configuration to the library root logger.
					__UpperCamelCase					:	Any             =      _get_library_root_logger()
					library_root_logger.setLevel(_get_default_logging_level()				)





def 				A__ ()     ->						None:
					__UpperCamelCase					:	List[Any]             =      _get_library_root_logger()
					library_root_logger.setLevel(logging.NOTSET				)





def 				A__ (snake_case   :		Optional[str] = None				)     ->						logging.Logger:
					if name is None:
										__UpperCamelCase					:	Optional[int]             =      _get_library_name()
					return logging.getLogger(snake_case				)





def 				A__ ()     ->						int:
					return _get_library_root_logger().getEffectiveLevel()





def 				A__ (snake_case   :		int				)     ->						None:
					_get_library_root_logger().setLevel(snake_case				)





def 				A__ ()     ->						Dict:
					return set_verbosity(snake_case				)





def 				A__ ()     ->						Any:
					return set_verbosity(snake_case				)





def 				A__ ()     ->						Dict:
					return set_verbosity(snake_case				)





def 				A__ ()     ->						str:
					return set_verbosity(snake_case				)





def 				A__ ()     ->						None:
					__UpperCamelCase					:	str             =      False





def 				A__ ()     ->						None:
					__UpperCamelCase					:	List[str]             =      True


# Configure the library root logger at the module level (singleton-like)
_configure_library_root_logger()


class    SCREAMING_SNAKE_CASE_				:



	"""simple docstring"""


	def __init__(					self		:						Optional[int]					,     *lowerCAmelCase		:						str					,     **lowerCAmelCase		:						List[str]	)	->       Union[str, Any]:  # pylint: disable=unused-argument







						"""simple docstring"""







						__UpperCamelCase					:	List[str]             =      args[0] if args else None






	def __iter__(					self		:						List[Any]	)	->       List[Any]:







						"""simple docstring"""







						return iter(self._iterator	)






	def __getattr__(					self		:						int					,     lowerCAmelCase		:						List[str]	)	->       Dict:







						"""simple docstring"""







						def empty_fn(*lowerCAmelCase		:						List[Any]					,     **lowerCAmelCase		:						Dict	):  # pylint: disable=unused-argument
											return

						return empty_fn






	def __enter__(					self		:						Tuple	)	->       Any:







						"""simple docstring"""







						return self






	def __exit__(					self		:						str					,     lowerCAmelCase		:						Dict					,     lowerCAmelCase		:						Dict					,     lowerCAmelCase		:						List[str]	)	->       Tuple:







						"""simple docstring"""







						return






a__		     =     True


class    SCREAMING_SNAKE_CASE_				:



	"""simple docstring"""


	def __call__(					self		:						str					,     *lowerCAmelCase		:						List[Any]					,     lowerCAmelCase		:						Dict=False					,     **lowerCAmelCase		:						Tuple	)	->       Optional[Any]:







						"""simple docstring"""







						if _tqdm_active and not disable:
											return tqdm_lib.tqdm(*lowerCAmelCase					,     **lowerCAmelCase	)
						else:
											return EmptyTqdm(*lowerCAmelCase					,     **lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						Any					,     *lowerCAmelCase		:						List[str]					,     **lowerCAmelCase		:						str	)	->       Dict:







						"""simple docstring"""







						__UpperCamelCase					:	Any             =      None
						if _tqdm_active:
											return tqdm_lib.tqdm.set_lock(*lowerCAmelCase					,     **lowerCAmelCase	)






	def 					lowerCamelCase__     (					self		:						Dict	)	->       Union[str, Any]:







						"""simple docstring"""







						if _tqdm_active:
											return tqdm_lib.tqdm.get_lock()






a__		     =     _tqdm_cls()





def 				A__ ()     ->						bool:
					global _tqdm_active
					return bool(_tqdm_active				)





def 				A__ ()     ->						List[str]:
					global _tqdm_active
					__UpperCamelCase					:	Tuple             =      True







def 				A__ ()     ->						int:
					global _tqdm_active
					__UpperCamelCase					:	Any             =      False






