

"""simple docstring"""






import logging
import os

from .state import PartialState







class       snake_case__  ( logging.LoggerAdapter     ):







			@staticmethod
			def 			__lowerCAmelCase				(			lowercase			: str  ):





								'''simple docstring'''



								UpperCAmelCase			:   str      =				PartialState()
								return not main_process_only or (main_process_only and state.is_main_process)







			def 			__lowerCAmelCase				(			self			: Any			,  lowercase			: List[Any]			,  lowercase			: Union[str, Any]			,  *lowercase			: Union[str, Any]			,  **lowercase			: str  ):





								'''simple docstring'''



								if PartialState._shared_state == {}:
													raise RuntimeError(
													    "You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility."  )
								UpperCAmelCase			:   List[Any]      =				kwargs.pop("main_process_only"			,  lowercase  )
								UpperCAmelCase			:   Optional[int]      =				kwargs.pop("in_order"			,  lowercase  )

								if self.isEnabledFor(lowercase  ):
													if self._should_log(lowercase  ):
																		UpperCAmelCase			:   Dict      =				self.process(lowercase			,  lowercase  )
																		self.logger.log(lowercase			,  lowercase			,  *lowercase			,  **lowercase  )

													elif in_order:
																		UpperCAmelCase			:   Union[str, Any]      =				PartialState()
																		for i in range(state.num_processes  ):
																							if i == state.process_index:
																												UpperCAmelCase			:   Optional[Any]      =				self.process(lowercase			,  lowercase  )
																												self.logger.log(lowercase			,  lowercase			,  *lowercase			,  **lowercase  )
																							state.wait_for_everyone()



def   lowercase_	(    _lowercase       :		str							,      _lowercase       :		str = None	):




					'''simple docstring'''






					if log_level is None:
										UpperCAmelCase			:   Optional[Any]      =				os.environ.get("ACCELERATE_LOG_LEVEL"							,      _lowercase	)
					UpperCAmelCase			:   List[str]      =				logging.getLogger(_lowercase	)
					if log_level is not None:
										logger.setLevel(log_level.upper()	)
										logger.root.setLevel(log_level.upper()	)
					return MultiProcessAdapter(_lowercase							,      {}	)





"""simple docstring"""






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


snake_case_   :   List[Any]        =       logging.get_logger(__name__)

snake_case_   :   List[Any]        =       {
    """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-430m-pile""": """https://huggingface.co/RWKV/rwkv-4-430m-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-1b5-pile""": """https://huggingface.co/RWKV/rwkv-4-1b5-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-3b-pile""": """https://huggingface.co/RWKV/rwkv-4-3b-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-7b-pile""": """https://huggingface.co/RWKV/rwkv-4-7b-pile/resolve/main/config.json""",
    """RWKV/rwkv-4-14b-pile""": """https://huggingface.co/RWKV/rwkv-4-14b-pile/resolve/main/config.json""",
    """RWKV/rwkv-raven-1b5""": """https://huggingface.co/RWKV/rwkv-raven-1b5/resolve/main/config.json""",
    """RWKV/rwkv-raven-3b""": """https://huggingface.co/RWKV/rwkv-raven-3b/resolve/main/config.json""",
    """RWKV/rwkv-raven-7b""": """https://huggingface.co/RWKV/rwkv-raven-7b/resolve/main/config.json""",
    """RWKV/rwkv-raven-14b""": """https://huggingface.co/RWKV/rwkv-raven-14b/resolve/main/config.json""",
}







class       snake_case__  ( lowerCAmelCase_     ):
			SCREAMING_SNAKE_CASE__     				=						'''rwkv'''
			SCREAMING_SNAKE_CASE__     				=						{'''max_position_embeddings''': '''context_length'''}







			def __init__(			self			: int			,  lowercase			: Optional[Any]=5_02_77			,  lowercase			: Union[str, Any]=10_24			,  lowercase			: Union[str, Any]=40_96			,  lowercase			: List[str]=32			,  lowercase			: str=None			,  lowercase			: Tuple=None			,  lowercase			: Dict=1E-5			,  lowercase			: Any=0			,  lowercase			: List[Any]=0			,  lowercase			: int=6			,  lowercase			: Dict=False			,  lowercase			: Dict=True			,  **lowercase			: Optional[Any]			,  ):





								'''simple docstring'''



								UpperCAmelCase			:   Optional[int]      =				vocab_size
								UpperCAmelCase			:   List[str]      =				context_length
								UpperCAmelCase			:   Optional[Any]      =				hidden_size
								UpperCAmelCase			:   List[Any]      =				num_hidden_layers
								UpperCAmelCase			:   Union[str, Any]      =				attention_hidden_size if attention_hidden_size is not None else hidden_size
								UpperCAmelCase			:   List[Any]      =				intermediate_size if intermediate_size is not None else 4 * hidden_size
								UpperCAmelCase			:   Tuple      =				layer_norm_epsilon
								UpperCAmelCase			:   Optional[int]      =				rescale_every
								UpperCAmelCase			:   Tuple      =				use_cache

								UpperCAmelCase			:   Union[str, Any]      =				bos_token_id
								UpperCAmelCase			:   Optional[int]      =				eos_token_id

								super().__init__(
								    tie_word_embeddings=lowercase			,  bos_token_id=lowercase			,  eos_token_id=lowercase			,  **lowercase  )


