





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


UpperCamelCase__           =			logging.get_logger(__name__)

UpperCamelCase__           =			{
    "tanreinama/GPTSAN-2.8B-spout_is_uniform": (
        "https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.json"
    ),
}

class 							__SCREAMING_SNAKE_CASE       (  _a							):
							snake_case  :   Optional[Any]      =							"""gptsan-japanese"""
							snake_case  :   Any      =							[
							    """past_key_values""",
							]
							snake_case  :   str      =							{
							    """hidden_size""": """d_model""",
							    """num_attention_heads""": """num_heads""",
							    """num_hidden_layers""": """num_layers""",
							}






							def __init__(    self	,			__lowerCAmelCase=36000	,			__lowerCAmelCase=1280	,			__lowerCAmelCase=1024	,			__lowerCAmelCase=8192	,			__lowerCAmelCase=4096	,			__lowerCAmelCase=128	,			__lowerCAmelCase=10	,			__lowerCAmelCase=0	,			__lowerCAmelCase=16	,			__lowerCAmelCase=16	,			__lowerCAmelCase=128	,			__lowerCAmelCase=0.0	,			__lowerCAmelCase=1E-5	,			__lowerCAmelCase=False	,			__lowerCAmelCase=0.0	,			__lowerCAmelCase="float32"	,			__lowerCAmelCase=False	,			__lowerCAmelCase=False	,			__lowerCAmelCase=False	,			__lowerCAmelCase=0.002	,			__lowerCAmelCase=False	,			__lowerCAmelCase=True	,			__lowerCAmelCase=35998	,			__lowerCAmelCase=35995	,			__lowerCAmelCase=35999	,			**__lowerCAmelCase	,			):
														UpperCamelCase__					  =      vocab_size
														UpperCamelCase__					  =      max_position_embeddings
														UpperCamelCase__					  =      d_model
														UpperCamelCase__					  =      d_ff
														UpperCamelCase__					  =      d_ext
														UpperCamelCase__					  =      d_spout
														UpperCamelCase__					  =      num_switch_layers
														UpperCamelCase__					  =      num_ext_layers
														UpperCamelCase__					  =      num_switch_layers + num_ext_layers
														UpperCamelCase__					  =      num_heads
														UpperCamelCase__					  =      num_experts
														UpperCamelCase__					  =      expert_capacity
														UpperCamelCase__					  =      dropout_rate
														UpperCamelCase__					  =      layer_norm_epsilon
														UpperCamelCase__					  =      router_bias
														UpperCamelCase__					  =      router_jitter_noise
														UpperCamelCase__					  =      router_dtype
														UpperCamelCase__					  =      router_ignore_padding_tokens
														UpperCamelCase__					  =      output_hidden_states
														UpperCamelCase__					  =      output_attentions
														UpperCamelCase__					  =      initializer_factor
														UpperCamelCase__					  =      output_router_logits
														UpperCamelCase__					  =      use_cache

														super().__init__(
														    separator_token_id=__lowerCAmelCase	,			pad_token_id=__lowerCAmelCase	,			eos_token_id=__lowerCAmelCase	,			**__lowerCAmelCase	,			)











from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
UpperCamelCase__           =			10





def      _UpperCamelCase  (a__ :int ,      a__ :int ,      a__ :list[int] ,      a__ :int							):






							"""simple docstring"""





							for i in range(a__ ,      a__							):
														if array[i] == target:
																					return i
							return -1





def      _UpperCamelCase  (a__ :list[int] ,      a__ :int							):






							"""simple docstring"""





							UpperCamelCase__					  =      0
							UpperCamelCase__					  =      len(a__							)
							while left <= right:
														if right - left < precision:
																					return lin_search(a__ ,      a__ ,      a__ ,      a__							)

														UpperCamelCase__					  =      (left + right) // 3 + 1
														UpperCamelCase__					  =      2 * (left + right) // 3 + 1

														if array[one_third] == target:
																					return one_third
														elif array[two_third] == target:
																					return two_third

														elif target < array[one_third]:
																					UpperCamelCase__					  =      one_third - 1
														elif array[two_third] < target:
																					UpperCamelCase__					  =      two_third + 1

														else:
																					UpperCamelCase__					  =      one_third + 1
																					UpperCamelCase__					  =      two_third - 1
							else:
														return -1





def      _UpperCamelCase  (a__ :int ,      a__ :int ,      a__ :list[int] ,      a__ :int							):






							"""simple docstring"""





							if left < right:
														if right - left < precision:
																					return lin_search(a__ ,      a__ ,      a__ ,      a__							)
														UpperCamelCase__					  =      (left + right) // 3 + 1
														UpperCamelCase__					  =      2 * (left + right) // 3 + 1

														if array[one_third] == target:
																					return one_third
														elif array[two_third] == target:
																					return two_third

														elif target < array[one_third]:
																					return rec_ternary_search(a__ ,      one_third - 1 ,      a__ ,      a__							)
														elif array[two_third] < target:
																					return rec_ternary_search(two_third + 1 ,      a__ ,      a__ ,      a__							)
														else:
																					return rec_ternary_search(one_third + 1 ,      two_third - 1 ,      a__ ,      a__							)
							else:
														return -1


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					UpperCamelCase__           =			input("Enter numbers separated by comma:\n").strip()
					UpperCamelCase__           =			[int(item.strip()) for item in user_input.split(",")]
					assert collection == sorted(collection), f"List must be ordered.\n{collection}."
					UpperCamelCase__           =			int(input("Enter the number to be found in the list:\n").strip())
					UpperCamelCase__           =			ite_ternary_search(collection, target)
					UpperCamelCase__           =			rec_ternary_search(0, len(collection) - 1, collection, target)
					if resulta != -1:
										print(f"""Iterative search: {target} found at positions: {resulta}""")
										print(f"""Recursive search: {target} found at positions: {resulta}""")
					else:
										print("Not found")




