





"""simple docstring"""




from ...configuration_utils import PretrainedConfig
from ...utils import logging


a						: Union[str, Any]     	=			logging.get_logger(__name__)

a						: Optional[Any]     	=			{
    '''tiiuae/falcon-40b''': '''https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json''',
    '''tiiuae/falcon-7b''': '''https://huggingface.co/tiiuae/falcon-7b/resolve/main/config.json''',
}


class        __UpperCamelCase				(						a__						):
							lowerCamelCase   :					Optional[int]      					="""falcon"""
							lowerCamelCase   :					Union[str, Any]      					=["""past_key_values"""]






							def __init__(   self      ,					lowerCAmelCase__=6_5024      ,					lowerCAmelCase__=4544      ,					lowerCAmelCase__=32      ,					lowerCAmelCase__=71      ,					lowerCAmelCase__=1E-5      ,					lowerCAmelCase__=0.02      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=0.0      ,					lowerCAmelCase__=0.0      ,					lowerCAmelCase__=None      ,					lowerCAmelCase__=False      ,					lowerCAmelCase__=False      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=True      ,					lowerCAmelCase__=False      ,					lowerCAmelCase__=11      ,					lowerCAmelCase__=11      ,					**lowerCAmelCase__      ,					)	-> Any:
								a      :		Optional[int]	=				vocab_size
								# Backward compatibility with n_embed kwarg
								a      :		Tuple	=				kwargs.pop("n_embed"      ,					lowerCAmelCase__      )
								a      :		int	=				hidden_size if n_embed is None else n_embed
								a      :		Dict	=				num_hidden_layers
								a      :		Any	=				num_attention_heads
								a      :		List[str]	=				layer_norm_epsilon
								a      :		Any	=				initializer_range
								a      :		Dict	=				use_cache
								a      :		Optional[int]	=				hidden_dropout
								a      :		Optional[int]	=				attention_dropout

								a      :		Optional[int]	=				bos_token_id
								a      :		List[Any]	=				eos_token_id
								a      :		str	=				num_attention_heads if num_kv_heads is None else num_kv_heads
								a      :		Union[str, Any]	=				alibi
								a      :		Any	=				new_decoder_architecture
								a      :		Dict	=				multi_query  # Ignored when new_decoder_architecture is True
								a      :		List[Any]	=				parallel_attn
								a      :		List[str]	=				bias

								super().__init__(bos_token_id=lowerCAmelCase__      ,					eos_token_id=lowerCAmelCase__      ,					**lowerCAmelCase__      )






							@property
							def     __a   (   self      )	-> Optional[int]:
								return self.hidden_size // self.num_attention_heads






							@property
							def     __a   (   self      )	-> Dict:
								return not self.alibi









'''simple docstring'''




from .integrations import (
    is_optuna_available,
    is_ray_available,
    is_sigopt_available,
    is_wandb_available,
    run_hp_search_optuna,
    run_hp_search_ray,
    run_hp_search_sigopt,
    run_hp_search_wandb,
)
from .trainer_utils import (
    HPSearchBackend,
    default_hp_space_optuna,
    default_hp_space_ray,
    default_hp_space_sigopt,
    default_hp_space_wandb,
)
from .utils import logging


__SCREAMING_SNAKE_CASE     :int       =				logging.get_logger(__name__)







class   A_	:
 _lowerCamelCase  : str
 _lowerCamelCase  : str           =							None




 @staticmethod
 def      lowercase	(					):
      raise NotImplementedError




 def      lowercase	(					self       :    Union[str, Any]	,			snake_case_       :    Optional[int]	,			snake_case_       :    int	,			snake_case_       :    str	,			**snake_case_       :    List[Any]    ):
      raise NotImplementedError




 def      lowercase	(					self       :    Any	,			snake_case_       :    int    ):
      raise NotImplementedError




 def      lowercase	(					self       :    List[str]    ):
      if not self.is_available():
           raise RuntimeError(
               f'You picked the {self.name} backend, but it is not installed. Run {self.pip_install()}.'    )




 @classmethod
 def      lowercase	(					cls       :    List[Any]    ):
      return f'`pip install {cls.pip_package or cls.name}`'







class   A_	(  lowerCAmelCase_			):
 _lowerCamelCase  : int           =							"""optuna"""




 @staticmethod
 def      lowercase	(					):
      return is_optuna_available()




 def      lowercase	(					self       :    List[str]	,			snake_case_       :    Any	,			snake_case_       :    int	,			snake_case_       :    str	,			**snake_case_       :    Tuple    ):
      return run_hp_search_optuna(snake_case_	,			snake_case_	,			snake_case_	,			**snake_case_    )




 def      lowercase	(					self       :    int	,			snake_case_       :    Optional[int]    ):
      return default_hp_space_optuna(snake_case_    )







class   A_	(  lowerCAmelCase_			):
 _lowerCamelCase  : Any           =							"""ray"""
 _lowerCamelCase  : Tuple           =							"""'ray[tune]'"""




 @staticmethod
 def      lowercase	(					):
      return is_ray_available()




 def      lowercase	(					self       :    Optional[Any]	,			snake_case_       :    Any	,			snake_case_       :    int	,			snake_case_       :    str	,			**snake_case_       :    List[str]    ):
      return run_hp_search_ray(snake_case_	,			snake_case_	,			snake_case_	,			**snake_case_    )




 def      lowercase	(					self       :    Any	,			snake_case_       :    str    ):
      return default_hp_space_ray(snake_case_    )







class   A_	(  lowerCAmelCase_			):
 _lowerCamelCase  : int           =							"""sigopt"""




 @staticmethod
 def      lowercase	(					):
      return is_sigopt_available()




 def      lowercase	(					self       :    Any	,			snake_case_       :    int	,			snake_case_       :    int	,			snake_case_       :    str	,			**snake_case_       :    Dict    ):
      return run_hp_search_sigopt(snake_case_	,			snake_case_	,			snake_case_	,			**snake_case_    )




 def      lowercase	(					self       :    Dict	,			snake_case_       :    Optional[Any]    ):
      return default_hp_space_sigopt(snake_case_    )







class   A_	(  lowerCAmelCase_			):
 _lowerCamelCase  : Optional[int]           =							"""wandb"""




 @staticmethod
 def      lowercase	(					):
      return is_wandb_available()




 def      lowercase	(					self       :    Optional[Any]	,			snake_case_       :    Optional[Any]	,			snake_case_       :    int	,			snake_case_       :    str	,			**snake_case_       :    Optional[Any]    ):
      return run_hp_search_wandb(snake_case_	,			snake_case_	,			snake_case_	,			**snake_case_    )




 def      lowercase	(					self       :    Any	,			snake_case_       :    Union[str, Any]    ):
      return default_hp_space_wandb(snake_case_    )





__SCREAMING_SNAKE_CASE     :Dict       =				{
    HPSearchBackend(backend.name): backend for backend in [OptunaBackend, RayTuneBackend, SigOptBackend, WandbBackend]
}
def 	UpperCAmelCase_							(					)		->       str:


     '''simple docstring'''



     _UpperCAmelCase     							=   [backend for backend in ALL_HYPERPARAMETER_SEARCH_BACKENDS.values() if backend.is_available()]
     if len(__lowercase       ) > 0:
          _UpperCAmelCase     							=   available_backends[0].name
          if len(__lowercase       ) > 1:
               logger.info(
                   f'{len(__lowercase       )} hyperparameter search backends available. Using {name} as the default.'       )
          return name
     raise RuntimeError(
         "No hyperparameter search backend available.\n"
         + "\n".join(
             f' - To install {backend.name} run {backend.pip_install()}'
             for backend in ALL_HYPERPARAMETER_SEARCH_BACKENDS.values()       )       )




