






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


UpperCAmelCase__      			=						logging.get_logger(__name__)

UpperCAmelCase__      			=						{}




class 							snake_case_       (    __UpperCamelCase      ):

						"""simple docstring"""



						snake_case__        =      """llama"""
						snake_case__        =      ["""past_key_values"""]



						def __init__(self:					int ,					__UpperCAmelCase:					List[str]=32000 ,					__UpperCAmelCase:					Union[str, Any]=4096 ,					__UpperCAmelCase:					Any=11008 ,					__UpperCAmelCase:					Optional[int]=32 ,					__UpperCAmelCase:					int=32 ,					__UpperCAmelCase:					Any=None ,					__UpperCAmelCase:					List[Any]="silu" ,					__UpperCAmelCase:					Optional[int]=2048 ,					__UpperCAmelCase:					str=0.02 ,					__UpperCAmelCase:					int=1E-6 ,					__UpperCAmelCase:					int=True ,					__UpperCAmelCase:					str=0 ,					__UpperCAmelCase:					List[str]=1 ,					__UpperCAmelCase:					int=2 ,					__UpperCAmelCase:					Dict=1 ,					__UpperCAmelCase:					List[Any]=False ,					__UpperCAmelCase:					Any=None ,					**__UpperCAmelCase:					List[Any] ,					)    ->     Any:




											'''simple docstring'''



											__a					:						Any      =					vocab_size
											__a					:						Union[str, Any]      =					max_position_embeddings
											__a					:						Optional[Any]      =					hidden_size
											__a					:						int      =					intermediate_size
											__a					:						Union[str, Any]      =					num_hidden_layers
											__a					:						Optional[int]      =					num_attention_heads

											# for backward compatibility
											if num_key_value_heads is None:
																__a					:						Optional[int]      =					num_attention_heads

											__a					:						Optional[Any]      =					num_key_value_heads
											__a					:						Dict      =					hidden_act
											__a					:						Optional[int]      =					initializer_range
											__a					:						Optional[Any]      =					rms_norm_eps
											__a					:						List[Any]      =					pretraining_tp
											__a					:						Optional[int]      =					use_cache
											__a					:						Dict      =					rope_scaling
											self._rope_scaling_validation()

											super().__init__(
											    pad_token_id=__UpperCAmelCase ,					bos_token_id=__UpperCAmelCase ,					eos_token_id=__UpperCAmelCase ,					tie_word_embeddings=__UpperCAmelCase ,					**__UpperCAmelCase ,					)



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




											'''simple docstring'''



											if self.rope_scaling is None:
																return

											if not isinstance(self.rope_scaling ,					__UpperCAmelCase   ) or len(self.rope_scaling   ) != 2:
																raise ValueError(
																    "`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, "
																    f'got {self.rope_scaling}'   )
											__a					:						Optional[int]      =					self.rope_scaling.get("type" ,					__UpperCAmelCase   )
											__a					:						str      =					self.rope_scaling.get("factor" ,					__UpperCAmelCase   )
											if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
																raise ValueError(
																    f'`rope_scaling`\'s name field must be one of [\'linear\', \'dynamic\'], got {rope_scaling_type}'   )
											if rope_scaling_factor is None or not isinstance(__UpperCAmelCase ,					__UpperCAmelCase   ) or rope_scaling_factor <= 1.0:
																raise ValueError(f'`rope_scaling`\'s factor field must be an float > 1, got {rope_scaling_factor}'   )













def     a_   (__A				,       __A				,       __A				,       __A      )				->						int:



					"""simple docstring"""
					__a      ,			__a					:						Any      =					len(__A      ), len(grid[0]      )
					if (
					    min(__A				,       __A      ) < 0
					    or row == row_length
					    or col == col_length
					    or (row, col) in visit
					    or grid[row][col] == 1
					):
										return 0
					if row == row_length - 1 and col == col_length - 1:
										return 1

					visit.add((row, col)      )

					__a					:						Dict      =					0
					count += depth_first_search(__A				,       row + 1				,       __A				,       __A      )
					count += depth_first_search(__A				,       row - 1				,       __A				,       __A      )
					count += depth_first_search(__A				,       __A				,       col + 1				,       __A      )
					count += depth_first_search(__A				,       __A				,       col - 1				,       __A      )

					visit.remove((row, col)      )
					return count


if __name__ == "__main__":
			import doctest

			doctest.testmod()





