





"""simple docstring"""
import copy
import os
from typing import TYPE_CHECKING, List, Union


if TYPE_CHECKING:
  pass

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


lowerCamelCase_       =		logging.get_logger(__name__)

lowerCamelCase_       =		{
    "kakaobrain/align-base": "https://huggingface.co/kakaobrain/align-base/resolve/main/config.json",
}






class  _SCREAMING_SNAKE_CASE(       A  ):
       SCREAMING_SNAKE_CASE_       :				Dict     						=  '''align_text_model'''




       def __init__(						self		,SCREAMING_SNAKE_CASE__=3_05_22		,SCREAMING_SNAKE_CASE__=7_68		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=12		,SCREAMING_SNAKE_CASE__=30_72		,SCREAMING_SNAKE_CASE__="gelu"		,SCREAMING_SNAKE_CASE__=0.1		,SCREAMING_SNAKE_CASE__=0.1		,SCREAMING_SNAKE_CASE__=5_12		,SCREAMING_SNAKE_CASE__=2		,SCREAMING_SNAKE_CASE__=0.0_2		,SCREAMING_SNAKE_CASE__=1E-12		,SCREAMING_SNAKE_CASE__=0		,SCREAMING_SNAKE_CASE__="absolute"		,SCREAMING_SNAKE_CASE__=True		,**SCREAMING_SNAKE_CASE__		,)      ->				List[str]:





             """simple docstring"""






             super().__init__(**SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Tuple		    =  vocab_size
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  hidden_size
             __SCREAMING_SNAKE_CASE       :str		    =  num_hidden_layers
             __SCREAMING_SNAKE_CASE       :Dict		    =  num_attention_heads
             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  hidden_act
             __SCREAMING_SNAKE_CASE       :List[str]		    =  intermediate_size
             __SCREAMING_SNAKE_CASE       :str		    =  hidden_dropout_prob
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  attention_probs_dropout_prob
             __SCREAMING_SNAKE_CASE       :Any		    =  max_position_embeddings
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  type_vocab_size
             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  initializer_range
             __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  layer_norm_eps
             __SCREAMING_SNAKE_CASE       :List[str]		    =  position_embedding_type
             __SCREAMING_SNAKE_CASE       :Dict		    =  use_cache
             __SCREAMING_SNAKE_CASE       :int		    =  pad_token_id




       @classmethod
       def    _UpperCamelCase					(						cls		,SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)      ->				"PretrainedConfig":





             """simple docstring"""






             cls._set_token_in_kwargs(SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  cls.get_config_dict(SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)

             # get the text config dict if we are loading from AlignConfig
             if config_dict.get('''model_type'''							) == "align":
                   __SCREAMING_SNAKE_CASE       :int		    =  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(SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)






class  _SCREAMING_SNAKE_CASE(       A  ):
       SCREAMING_SNAKE_CASE_       :				Optional[Any]     						=  '''align_vision_model'''




       def __init__(						self		,SCREAMING_SNAKE_CASE__ = 3		,SCREAMING_SNAKE_CASE__ = 6_00		,SCREAMING_SNAKE_CASE__ = 2.0		,SCREAMING_SNAKE_CASE__ = 3.1		,SCREAMING_SNAKE_CASE__ = 8		,SCREAMING_SNAKE_CASE__ = [3, 3, 5, 3, 5, 5, 3]		,SCREAMING_SNAKE_CASE__ = [32, 16, 24, 40, 80, 1_12, 1_92]		,SCREAMING_SNAKE_CASE__ = [16, 24, 40, 80, 1_12, 1_92, 3_20]		,SCREAMING_SNAKE_CASE__ = []		,SCREAMING_SNAKE_CASE__ = [1, 2, 2, 2, 1, 2, 1]		,SCREAMING_SNAKE_CASE__ = [1, 2, 2, 3, 3, 4, 1]		,SCREAMING_SNAKE_CASE__ = [1, 6, 6, 6, 6, 6, 6]		,SCREAMING_SNAKE_CASE__ = 0.2_5		,SCREAMING_SNAKE_CASE__ = "swish"		,SCREAMING_SNAKE_CASE__ = 25_60		,SCREAMING_SNAKE_CASE__ = "mean"		,SCREAMING_SNAKE_CASE__ = 0.0_2		,SCREAMING_SNAKE_CASE__ = 0.0_0_1		,SCREAMING_SNAKE_CASE__ = 0.9_9		,SCREAMING_SNAKE_CASE__ = 0.2		,**SCREAMING_SNAKE_CASE__		,)      ->				str:





             """simple docstring"""






             super().__init__(**SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Any		    =  num_channels
             __SCREAMING_SNAKE_CASE       :Tuple		    =  image_size
             __SCREAMING_SNAKE_CASE       :Dict		    =  width_coefficient
             __SCREAMING_SNAKE_CASE       :List[Any]		    =  depth_coefficient
             __SCREAMING_SNAKE_CASE       :str		    =  depth_divisor
             __SCREAMING_SNAKE_CASE       :int		    =  kernel_sizes
             __SCREAMING_SNAKE_CASE       :Tuple		    =  in_channels
             __SCREAMING_SNAKE_CASE       :Optional[int]		    =  out_channels
             __SCREAMING_SNAKE_CASE       :int		    =  depthwise_padding
             __SCREAMING_SNAKE_CASE       :Dict		    =  strides
             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  num_block_repeats
             __SCREAMING_SNAKE_CASE       :Any		    =  expand_ratios
             __SCREAMING_SNAKE_CASE       :Any		    =  squeeze_expansion_ratio
             __SCREAMING_SNAKE_CASE       :Dict		    =  hidden_act
             __SCREAMING_SNAKE_CASE       :Any		    =  hidden_dim
             __SCREAMING_SNAKE_CASE       :Any		    =  pooling_type
             __SCREAMING_SNAKE_CASE       :List[str]		    =  initializer_range
             __SCREAMING_SNAKE_CASE       :str		    =  batch_norm_eps
             __SCREAMING_SNAKE_CASE       :str		    =  batch_norm_momentum
             __SCREAMING_SNAKE_CASE       :Any		    =  drop_connect_rate
             __SCREAMING_SNAKE_CASE       :Dict		    =  sum(SCREAMING_SNAKE_CASE__							) * 4




       @classmethod
       def    _UpperCamelCase					(						cls		,SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)      ->				"PretrainedConfig":





             """simple docstring"""






             cls._set_token_in_kwargs(SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Tuple		    =  cls.get_config_dict(SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)

             # get the vision config dict if we are loading from AlignConfig
             if config_dict.get('''model_type'''							) == "align":
                   __SCREAMING_SNAKE_CASE       :List[str]		    =  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(SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)






class  _SCREAMING_SNAKE_CASE(       A  ):
       SCREAMING_SNAKE_CASE_       :				Optional[Any]     						=  '''align'''
       SCREAMING_SNAKE_CASE_       :				int     						=  True




       def __init__(						self		,SCREAMING_SNAKE_CASE__=None		,SCREAMING_SNAKE_CASE__=None		,SCREAMING_SNAKE_CASE__=6_40		,SCREAMING_SNAKE_CASE__=1.0		,SCREAMING_SNAKE_CASE__=0.0_2		,**SCREAMING_SNAKE_CASE__		,)      ->				Any:





             """simple docstring"""






             super().__init__(**SCREAMING_SNAKE_CASE__							)

             if text_config is None:
                   __SCREAMING_SNAKE_CASE       :str		    =  {}
                   logger.info('''text_config is None. Initializing the AlignTextConfig with default values.'''							)

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

             __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  AlignTextConfig(**SCREAMING_SNAKE_CASE__							)
             __SCREAMING_SNAKE_CASE       :Any		    =  AlignVisionConfig(**SCREAMING_SNAKE_CASE__							)

             __SCREAMING_SNAKE_CASE       :Any		    =  projection_dim
             __SCREAMING_SNAKE_CASE       :str		    =  temperature_init_value
             __SCREAMING_SNAKE_CASE       :List[Any]		    =  initializer_range




       @classmethod
       def    _UpperCamelCase					(						cls		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)      ->				Any:





             """simple docstring"""






             return cls(text_config=text_config.to_dict()		,vision_config=vision_config.to_dict()		,**SCREAMING_SNAKE_CASE__							)




       def    _UpperCamelCase					(						self							)      ->				str:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE       :int		    =  copy.deepcopy(self.__dict__							)
             __SCREAMING_SNAKE_CASE       :str		    =  self.text_config.to_dict()
             __SCREAMING_SNAKE_CASE       :List[Any]		    =  self.vision_config.to_dict()
             __SCREAMING_SNAKE_CASE       :str		    =  self.__class__.model_type
             return output








"""simple docstring"""
from itertools import product



def 					__lowerCamelCase       (							a_					:		int			,       a_					:		int							)      ->				list[int]:
      __SCREAMING_SNAKE_CASE       :Tuple		    =  sides_number
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  max_face_number * dice_number
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  [0] * (max_total + 1)

      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  1
      __SCREAMING_SNAKE_CASE       :Tuple		    =  range(a_			,       max_face_number + 1							)
      for dice_numbers in product(a_			,       repeat=a_							):
            __SCREAMING_SNAKE_CASE       :Any		    =  sum(a_							)
            totals_frequencies[total] += 1

      return totals_frequencies



def 					__lowerCamelCase       (							)      ->				float:
      __SCREAMING_SNAKE_CASE       :Dict		    =  total_frequency_distribution(
          sides_number=4			,       dice_number=9							)
      __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  total_frequency_distribution(
          sides_number=6			,       dice_number=6							)

      __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  0
      __SCREAMING_SNAKE_CASE       :Any		    =  9
      __SCREAMING_SNAKE_CASE       :List[str]		    =  4 * 9
      __SCREAMING_SNAKE_CASE       :Dict		    =  6
      for peter_total in range(a_			,       max_peter_total + 1							):
            peter_wins_count += peter_totals_frequencies[peter_total] * sum(
                colin_totals_frequencies[min_colin_total:peter_total]							)

      __SCREAMING_SNAKE_CASE       :List[str]		    =  (4**9) * (6**6)
      __SCREAMING_SNAKE_CASE       :Union[str, Any]		    =  peter_wins_count / total_games_number

      __SCREAMING_SNAKE_CASE       :str		    =  round(a_			,       ndigits=7							)

      return rounded_peter_win_probability


if __name__ == "__main__":
  print(f'{solution() = }')