
'''simple docstring'''


import copy
import os
from typing import Union

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


__lowercase							:   int					=     logging.get_logger(__name__)

__lowercase							:   Tuple					=     {
    '''google/pix2struct-textcaps-base''': (
        '''https://huggingface.co/google/pix2struct-textcaps-base/resolve/main/config.json'''
    ),
}

class 	__lowercase				(  _lowercase    ):
			lowerCamelCase			:		List[str]	      =			"pix2struct_text_model"
			lowerCamelCase			:		Optional[int]	      =			["past_key_values"]
			lowerCamelCase			:		str	      =			{
			    "hidden_size": "hidden_size",
			    "num_attention_heads": "num_heads",
			    "num_hidden_layers": "num_layers",
			}

			def __init__(self			,   A=5_0_2_4_4			,   A=7_6_8			,   A=6_4			,   A=2_0_4_8			,   A=1_2			,   A=1_2			,   A=3_2			,   A=1_2_8			,   A=0.1			,   A=1E-6			,   A=1.0			,   A="gelu_new"			,   A=0			,   A=False			,   A=0			,   A=1			,   A=False			,   A=True			,   **A			,   ):
								lowerCamelCase_					:      List[str]     =		vocab_size
								lowerCamelCase_					:      Dict     =		hidden_size
								lowerCamelCase_					:      Optional[Any]     =		d_kv
								lowerCamelCase_					:      Any     =		d_ff
								lowerCamelCase_					:      Any     =		num_layers
								lowerCamelCase_					:      List[Any]     =		num_heads
								lowerCamelCase_					:      List[str]     =		relative_attention_num_buckets
								lowerCamelCase_					:      str     =		relative_attention_max_distance
								lowerCamelCase_					:      int     =		dropout_rate
								lowerCamelCase_					:      Union[str, Any]     =		layer_norm_epsilon
								lowerCamelCase_					:      Any     =		initializer_factor
								lowerCamelCase_					:      str     =		use_cache

								lowerCamelCase_					:      List[str]     =		eos_token_id
								lowerCamelCase_					:      List[str]     =		decoder_start_token_id

								# for backwards compatibility
								lowerCamelCase_					:      Union[str, Any]     =		dense_act_fn

								super().__init__(
								    pad_token_id=A			,   eos_token_id=A			,   decoder_start_token_id=A			,   tie_word_embeddings=A			,   is_decoder=A			,   **A			,   )






			@classmethod
			def        UpperCAmelCase__ (cls			,   A			,   **A      ):
								cls._set_token_in_kwargs(A      )

								lowerCamelCase_,      lowerCamelCase_					:      List[Any]     =		cls.get_config_dict(A			,   **A      )

								# get the text config dict if we are loading from Pix2StructConfig
								if config_dict.get('''model_type'''      ) == "pix2struct":
													lowerCamelCase_					:      Dict     =		config_dict['''text_config''']

								if "model_type" in config_dict and hasattr(cls			,   '''model_type'''      ) and config_dict["model_type"] != cls.model_type:
													logger.warning(
													    F"""You are using a model of type {config_dict["model_type"]} to instantiate a model of type """
													    F"""{cls.model_type}. This is not supported for all configurations of models and can yield errors."""      )

								return cls.from_dict(A			,   **A      )

class 	__lowercase				(  _lowercase    ):
			lowerCamelCase			:		Optional[int]	      =			"pix2struct_vision_model"

			def __init__(self			,   A=7_6_8			,   A=7_6_8			,   A=2_0_4_8			,   A=6_4			,   A=1_2			,   A=1_2			,   A="gelu_new"			,   A=1E-6			,   A=0.0			,   A=0.0			,   A=1E-10			,   A=1.0			,   A=4_0_9_6			,   A=3_2			,   A=1_2_8			,   **A			,   ):
								super().__init__(**A      )

								lowerCamelCase_					:      Union[str, Any]     =		hidden_size
								lowerCamelCase_					:      Union[str, Any]     =		patch_embed_hidden_size
								lowerCamelCase_					:      Optional[int]     =		d_ff
								lowerCamelCase_					:      Union[str, Any]     =		dropout_rate
								lowerCamelCase_					:      List[str]     =		num_hidden_layers
								lowerCamelCase_					:      List[Any]     =		num_attention_heads
								lowerCamelCase_					:      Any     =		initializer_range
								lowerCamelCase_					:      Union[str, Any]     =		initializer_factor
								lowerCamelCase_					:      Any     =		attention_dropout
								lowerCamelCase_					:      List[Any]     =		layer_norm_eps
								lowerCamelCase_					:      Optional[Any]     =		dense_act_fn
								lowerCamelCase_					:      List[str]     =		seq_len
								lowerCamelCase_					:      Union[str, Any]     =		relative_attention_num_buckets
								lowerCamelCase_					:      List[str]     =		relative_attention_max_distance
								lowerCamelCase_					:      Optional[Any]     =		d_kv






			@classmethod
			def        UpperCAmelCase__ (cls			,   A			,   **A      ):
								cls._set_token_in_kwargs(A      )

								lowerCamelCase_,      lowerCamelCase_					:      List[str]     =		cls.get_config_dict(A			,   **A      )

								# get the vision config dict if we are loading from Pix2StructConfig
								if config_dict.get('''model_type'''      ) == "pix2struct":
													lowerCamelCase_					:      Optional[Any]     =		config_dict['''vision_config''']

								if "model_type" in config_dict and hasattr(cls			,   '''model_type'''      ) and config_dict["model_type"] != cls.model_type:
													logger.warning(
													    F"""You are using a model of type {config_dict["model_type"]} to instantiate a model of type """
													    F"""{cls.model_type}. This is not supported for all configurations of models and can yield errors."""      )

								return cls.from_dict(A			,   **A      )

class 	__lowercase				(  _lowercase    ):
			lowerCamelCase			:		List[str]	      =			"pix2struct"
			lowerCamelCase			:		Tuple	      =			True

			def __init__(self			,   A=None			,   A=None			,   A=1.0			,   A=0.02			,   A=False			,   A=False			,   A=True			,   **A			,   ):
								super().__init__(tie_word_embeddings=A			,   is_encoder_decoder=A			,   **A      )

								if text_config is None:
													lowerCamelCase_					:      int     =		{}
													logger.info('''text_config is None. Initializing the Pix2StructTextConfig with default values.'''      )

								if vision_config is None:
													lowerCamelCase_					:      int     =		{}
													logger.info('''vision_config is None. Initializing the Pix2StructVisionConfig with default values.'''      )

								lowerCamelCase_					:      Any     =		PixaStructTextConfig(**A      )
								lowerCamelCase_					:      Optional[Any]     =		PixaStructVisionConfig(**A      )

								lowerCamelCase_					:      List[str]     =		self.text_config.decoder_start_token_id
								lowerCamelCase_					:      Any     =		self.text_config.pad_token_id
								lowerCamelCase_					:      Optional[int]     =		self.text_config.eos_token_id

								lowerCamelCase_					:      Union[str, Any]     =		initializer_factor
								lowerCamelCase_					:      Any     =		initializer_range

								lowerCamelCase_					:      int     =		self.initializer_range
								lowerCamelCase_					:      Tuple     =		self.initializer_range

								lowerCamelCase_					:      List[Any]     =		is_vqa

			@classmethod
			def        UpperCAmelCase__ (cls			,   A			,   A			,   **A      ):
								return cls(text_config=text_config.to_dict()			,   vision_config=vision_config.to_dict()			,   **A      )






			def        UpperCAmelCase__ (self      ):
								lowerCamelCase_					:      List[Any]     =		copy.deepcopy(self.__dict__      )
								lowerCamelCase_					:      int     =		self.text_config.to_dict()
								lowerCamelCase_					:      Dict     =		self.vision_config.to_dict()
								lowerCamelCase_					:      List[Any]     =		self.__class__.model_type
								return output




'''simple docstring'''


import os
from math import logaa




def lowercase_	(   _lowercase = "base_exp.txt"				)     ->							int:
					'''simple docstring'''

					lowerCamelCase_					:      float     =		0
					lowerCamelCase_					:      Dict     =		0
					for i, line in enumerate(open(os.path.join(os.path.dirname(_lowercase				)			,       _lowercase				)				)				):
										lowerCamelCase_,      lowerCamelCase_					:      Dict     =		list(map(_lowercase			,       line.split(''','''				)				)				)
										if x * logaa(_lowercase				) > largest:
															lowerCamelCase_					:      List[str]     =		x * logaa(_lowercase				)
															lowerCamelCase_					:      Union[str, Any]     =		i + 1
					return result


if __name__ == "__main__":
					print(solution())


