


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


__a	 =      logging.get_logger(__name__)

__a	 =      {}






class 	__lowercase					(	a_	):
      UpperCamelCase										=							'''llama'''
      UpperCamelCase										=							['''past_key_values''']





      def __init__(		self    :       Optional[int]       ,							__lowerCamelCase    :       Dict=3_2_0_0_0       ,							__lowerCamelCase    :       Dict=4_0_9_6       ,							__lowerCamelCase    :       List[Any]=1_1_0_0_8       ,							__lowerCamelCase    :       Tuple=3_2       ,							__lowerCamelCase    :       List[str]=3_2       ,							__lowerCamelCase    :       Tuple=None       ,							__lowerCamelCase    :       int="silu"       ,							__lowerCamelCase    :       List[Any]=2_0_4_8       ,							__lowerCamelCase    :       Optional[Any]=0.02       ,							__lowerCamelCase    :       Optional[int]=1e-6       ,							__lowerCamelCase    :       List[str]=True       ,							__lowerCamelCase    :       List[Any]=0       ,							__lowerCamelCase    :       Dict=1       ,							__lowerCamelCase    :       Optional[int]=2       ,							__lowerCamelCase    :       Optional[int]=1       ,							__lowerCamelCase    :       Dict=False       ,							__lowerCamelCase    :       Union[str, Any]=None       ,							**__lowerCamelCase    :       Optional[Any]       ,							)     -> Any:






         """simple docstring"""







         UpperCAmelCase      					=  vocab_size
         UpperCAmelCase      					=  max_position_embeddings
         UpperCAmelCase      					=  hidden_size
         UpperCAmelCase      					=  intermediate_size
         UpperCAmelCase      					=  num_hidden_layers
         UpperCAmelCase      					=  num_attention_heads

         # for backward compatibility
         if num_key_value_heads is None:
            UpperCAmelCase      					=  num_attention_heads

         UpperCAmelCase      					=  num_key_value_heads
         UpperCAmelCase      					=  hidden_act
         UpperCAmelCase      					=  initializer_range
         UpperCAmelCase      					=  rms_norm_eps
         UpperCAmelCase      					=  pretraining_tp
         UpperCAmelCase      					=  use_cache
         UpperCAmelCase      					=  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 							_lowercase					(		self    :       Any							)     -> 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}"""							)
         UpperCAmelCase      					=  self.rope_scaling.get("""type"""       ,							__UpperCamelCase							)
         UpperCAmelCase      					=  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}"""							)











from __future__ import annotations





def    __lowerCAmelCase   (    __snake_case							):
     __lowerCAmelCase             =       len(__snake_case							)
     # We need to create solution object to save path.
     __lowerCAmelCase             =       [[0 for _ in range(__snake_case							)] for _ in range(__snake_case							)]
     __lowerCAmelCase             =       run_maze(__snake_case       ,			0       ,			0       ,			__snake_case							)
     if solved:
          print("\n".join(str(__snake_case							) for row in solutions							)							)
     else:
          print("No solution exists!"							)
     return solved





def    __lowerCAmelCase   (    __snake_case       ,			__snake_case       ,			__snake_case       ,			__snake_case							):
     __lowerCAmelCase             =       len(__snake_case							)
     # Final check point.
     if i == j == (size - 1):
          __lowerCAmelCase             =       1
          return True

     __lowerCAmelCase             =       (not i < 0) and (not j < 0)  # Check lower bounds
     __lowerCAmelCase             =       (i < size) and (j < size)  # Check upper bounds

     if lower_flag and upper_flag:
          # check for already visited and block points.
          __lowerCAmelCase             =       (not solutions[i][j]) and (not maze[i][j])
          if block_flag:
               # check visited
               __lowerCAmelCase             =       1

               # check for directions
               if (
                   run_maze(__snake_case       ,			i + 1       ,			__snake_case       ,			__snake_case							)
                   or run_maze(__snake_case       ,			__snake_case       ,			j + 1       ,			__snake_case							)
                   or run_maze(__snake_case       ,			i - 1       ,			__snake_case       ,			__snake_case							)
                   or run_maze(__snake_case       ,			__snake_case       ,			j - 1       ,			__snake_case							)
               ):
                    return True

               __lowerCAmelCase             =       0
               return False
     return False


if __name__ == "__main__":
 import doctest

 doctest.testmod()






